Skip to content

Commit 0af31fe

Browse files
authored
ci: harden GitHub Actions automation
Closes #9
1 parent d7bf244 commit 0af31fe

4 files changed

Lines changed: 94 additions & 22 deletions

File tree

.github/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# GitHub Automation
2+
3+
## Workflows
4+
5+
- Keep workflow jobs on explicit runner images, such as `ubuntu-24.04`, so CI changes are reviewed instead of inherited from moving aliases.
6+
- Keep third-party actions pinned to full commit SHAs. Preserve the upstream version comment next to each SHA so reviews can see the intended release line.
7+
- Keep workflow permissions scoped per job. Prefer top-level read-only permissions, or `permissions: {}` when every job declares its own permissions.
8+
- Keep `timeout-minutes` on each job to avoid stuck runners consuming the Actions queue.
9+
10+
## Dependency Updates
11+
12+
Dependabot checks GitHub Actions, Cargo crates, and npm packages weekly. For GitHub Actions updates, accept the Dependabot PR only after confirming the new commit SHA still belongs to the expected upstream release tag.

.github/dependabot.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: github-actions
5+
directory: /
6+
schedule:
7+
interval: weekly
8+
day: monday
9+
time: "09:00"
10+
timezone: Asia/Tokyo
11+
groups:
12+
github-actions:
13+
patterns:
14+
- "*"
15+
16+
- package-ecosystem: cargo
17+
directory: /
18+
schedule:
19+
interval: weekly
20+
day: monday
21+
time: "09:15"
22+
timezone: Asia/Tokyo
23+
groups:
24+
rust-dependencies:
25+
patterns:
26+
- "*"
27+
28+
- package-ecosystem: npm
29+
directory: /
30+
schedule:
31+
interval: weekly
32+
day: monday
33+
time: "09:30"
34+
timezone: Asia/Tokyo
35+
groups:
36+
javascript-dependencies:
37+
patterns:
38+
- "*"

.github/workflows/ci.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: CI
22

33
on:
4+
workflow_dispatch:
45
pull_request:
56
push:
67
branches:
@@ -9,16 +10,25 @@ on:
910
permissions:
1011
contents: read
1112

13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
1217
jobs:
1318
verify:
14-
runs-on: ubuntu-latest
19+
name: Verify
20+
runs-on: ubuntu-24.04
21+
timeout-minutes: 30
22+
23+
env:
24+
RUST_TOOLCHAIN: 1.93.0
1525

1626
steps:
1727
- name: Checkout
18-
uses: actions/checkout@v5
28+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
1929

2030
- name: Set up Vite+
21-
uses: voidzero-dev/setup-vp@v1
31+
uses: voidzero-dev/setup-vp@ca1c46663915d6c1042ae23bd39ab85718bfb0fa # v1
2232
with:
2333
node-version: 22
2434
cache: true
@@ -27,14 +37,14 @@ jobs:
2737
2838
- name: Install Rust toolchain
2939
run: |
30-
rustup toolchain install stable --profile minimal --component clippy
31-
rustup default stable
32-
rustup target add wasm32-unknown-unknown
40+
rustup toolchain install "$RUST_TOOLCHAIN" --profile minimal --component clippy
41+
rustup default "$RUST_TOOLCHAIN"
42+
rustup target add wasm32-unknown-unknown --toolchain "$RUST_TOOLCHAIN"
3343
3444
- name: Install WebAssembly linker
3545
run: |
3646
sudo apt-get update
37-
sudo apt-get install --yes lld
47+
sudo apt-get install --no-install-recommends --yes lld
3848
3949
- name: Run workspace CI
4050
run: vp run ci

.github/workflows/playground-pages.yml

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,35 @@ on:
66
branches:
77
- main
88

9-
permissions:
10-
contents: read
11-
id-token: write
12-
pages: write
9+
permissions: {}
1310

1411
concurrency:
1512
group: playground-pages
1613
cancel-in-progress: true
1714

1815
jobs:
1916
build:
20-
runs-on: ubuntu-latest
17+
name: Build
18+
runs-on: ubuntu-24.04
19+
timeout-minutes: 30
20+
21+
permissions:
22+
contents: read
23+
pages: write
24+
25+
env:
26+
RUST_TOOLCHAIN: 1.93.0
2127

2228
steps:
2329
- name: Checkout
24-
uses: actions/checkout@v5
30+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
2531

2632
- name: Set up Pages
2733
id: pages
28-
uses: actions/configure-pages@v5
34+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
2935

3036
- name: Set up Vite+
31-
uses: voidzero-dev/setup-vp@v1
37+
uses: voidzero-dev/setup-vp@ca1c46663915d6c1042ae23bd39ab85718bfb0fa # v1
3238
with:
3339
node-version: 22
3440
cache: true
@@ -37,33 +43,39 @@ jobs:
3743
3844
- name: Install Rust toolchain
3945
run: |
40-
rustup toolchain install stable --profile minimal
41-
rustup default stable
42-
rustup target add wasm32-unknown-unknown
46+
rustup toolchain install "$RUST_TOOLCHAIN" --profile minimal
47+
rustup default "$RUST_TOOLCHAIN"
48+
rustup target add wasm32-unknown-unknown --toolchain "$RUST_TOOLCHAIN"
4349
4450
- name: Install WebAssembly linker
4551
run: |
4652
sudo apt-get update
47-
sudo apt-get install --yes lld
53+
sudo apt-get install --no-install-recommends --yes lld
4854
4955
- name: Build playground
5056
env:
5157
PAGES_BASE_PATH: /${{ github.event.repository.name }}/
5258
run: vp run playground:build
5359

5460
- name: Upload Pages artifact
55-
uses: actions/upload-pages-artifact@v4
61+
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4
5662
with:
5763
path: ./playground/dist
5864

5965
deploy:
66+
name: Deploy
6067
environment:
6168
name: github-pages
6269
url: ${{ steps.deployment.outputs.page_url }}
6370
needs: build
64-
runs-on: ubuntu-latest
71+
runs-on: ubuntu-24.04
72+
timeout-minutes: 10
73+
74+
permissions:
75+
id-token: write
76+
pages: write
6577

6678
steps:
6779
- name: Deploy to GitHub Pages
6880
id: deployment
69-
uses: actions/deploy-pages@v4
81+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4

0 commit comments

Comments
 (0)