Skip to content

Commit 0481c36

Browse files
committed
.github: reorganize the github action files
1. Renamed workflows to follow a consistent naming convention (`action-*`) 2. Extracted reusable workflows Signed-off-by: Jiaxiao (mossaka) Zhou <[email protected]>
1 parent fefb8df commit 0481c36

File tree

7 files changed

+86
-67
lines changed

7 files changed

+86
-67
lines changed
File renamed without changes.

.github/workflows/action-check.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Run Check
2+
3+
on:
4+
workflow_call:
5+
env:
6+
CARGO_TERM_COLOR: always
7+
8+
jobs:
9+
check:
10+
name: check
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions-rust-lang/setup-rust-toolchain@v1
15+
with:
16+
components: rustfmt, clippy
17+
- run:
18+
rustup toolchain install nightly --component rustfmt
19+
- name: Setup build env
20+
run: |
21+
make setup
22+
- name: fmt
23+
run: |
24+
make fmt

.github/workflows/docker-build-push.yaml renamed to .github/workflows/action-docker-build-push.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
description: 'Is this a test run?'
77
type: boolean
88
required: true
9+
910
jobs:
1011
build_and_push:
1112
permissions:

.github/workflows/action-test.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Run Check
2+
3+
on:
4+
workflow_call:
5+
runs-on: ubuntu-latest
6+
env:
7+
ARCH: x86_64
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: actions/download-artifact@v4
11+
- uses: azure/setup-kubectl@v4
12+
- uses: fermyon/actions/spin/setup@v1
13+
with:
14+
version: "v2.7.0"
15+
16+
- name: Setup build env
17+
run: |
18+
make setup
19+
20+
- name: Extract containerd-shim-spin-linux-${{ env.ARCH }}
21+
run: |
22+
mkdir -p ./bin
23+
for f in containerd-shim-spin-*-linux-${{ env.ARCH }}/containerd-shim-spin-*-linux-${{ env.ARCH }}.tar.gz
24+
do tar -xzf "$f" -C ./bin
25+
done
26+
27+
- name: install k3d
28+
run: make install-k3d
29+
30+
- name: run integration tests
31+
run: BIN_DIR="./bin" IS_CI=true make integration-tests
32+
33+
- name: run collect debug logs
34+
if: failure()
35+
run: make tests/collect-debug-logs
36+
37+
- name: upload debug logs
38+
if: failure()
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: debug-logs
42+
path: debug-logs/
43+
retention-days: 5
44+
45+
- name: Output runner storage on failure
46+
if: failure()
47+
run: df -h
48+
49+
- name: clean up k3d
50+
if: always()
51+
run: make tests/clean

.github/workflows/ci.yaml

Lines changed: 7 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,16 @@ env:
1212
CARGO_TERM_COLOR: always
1313
jobs:
1414
rustfmt:
15-
runs-on: ubuntu-latest
16-
steps:
17-
- uses: actions/checkout@v4
18-
- uses: Swatinem/rust-cache@v2
19-
with:
20-
workspaces: |
21-
"containerd-shim-* -> target"
22-
- run:
23-
rustup toolchain install nightly --component rustfmt
24-
- name: Setup build env
25-
run: |
26-
make setup
27-
- name: fmt
28-
run: |
29-
make fmt
15+
uses: ./.github/workflows/action-check.yml
16+
build:
17+
uses: ./.github/workflows/action-build.yaml
3018
build-wasm-images:
31-
uses: ./.github/workflows/docker-build-push.yaml
19+
uses: ./.github/workflows/action-docker-build-push.yaml
20+
needs: build
3221
with:
3322
test: true
34-
build:
35-
uses: ./.github/workflows/build.yaml
3623
publish-node-installer-image:
37-
uses: ./.github/workflows/node-installer.yaml
24+
uses: ./.github/workflows/action-node-installer.yaml
3825
needs: build
3926
# This action requires use of the GITHUB_TOKEN to publish the image
4027
# By default, PRs from forks don't have access, so we only run when the PR branch is on origin.
@@ -43,48 +30,4 @@ jobs:
4330
ref: ${{ github.ref }}
4431
test:
4532
needs: build
46-
runs-on: ubuntu-latest
47-
env:
48-
ARCH: x86_64
49-
steps:
50-
- uses: actions/checkout@v4
51-
- uses: actions/download-artifact@v4
52-
- uses: azure/setup-kubectl@v4
53-
- uses: fermyon/actions/spin/setup@v1
54-
with:
55-
version: "v2.7.0"
56-
57-
- name: Setup build env
58-
run: |
59-
make setup
60-
61-
- name: Extract containerd-shim-spin-linux-${{ env.ARCH }}
62-
run: |
63-
mkdir -p ./bin
64-
for f in containerd-shim-spin-*-linux-${{ env.ARCH }}/containerd-shim-spin-*-linux-${{ env.ARCH }}.tar.gz
65-
do tar -xzf "$f" -C ./bin
66-
done
67-
68-
- name: install k3d
69-
run: make install-k3d
70-
71-
- name: run integration tests
72-
run: BIN_DIR="./bin" IS_CI=true make integration-tests
73-
74-
- name: run collect debug logs
75-
if: failure()
76-
run: make tests/collect-debug-logs
77-
78-
- name: upload debug logs
79-
if: failure()
80-
uses: actions/upload-artifact@v4
81-
with:
82-
name: debug-logs
83-
path: debug-logs/
84-
retention-days: 5
85-
- name: Output runner storage on failure
86-
if: failure()
87-
run: df -h
88-
- name: clean up k3d
89-
if: always()
90-
run: make tests/clean
33+
uses: ./.github/workflows/action-test.yml

.github/workflows/release.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ on:
77
- "v[0-9]+.[0-9]+.*"
88
jobs:
99
build:
10-
uses: ./.github/workflows/build.yaml
10+
uses: ./.github/workflows/action-build.yaml
1111

1212
build-and-push-wasm-images:
13-
uses: ./.github/workflows/docker-build-push.yaml
13+
uses: ./.github/workflows/action-docker-build-push.yaml
1414
with:
1515
test: false
1616

1717
publish-node-installer-image:
18-
uses: ./.github/workflows/node-installer.yaml
18+
uses: ./.github/workflows/action-node-installer.yaml
1919
needs: build
2020
with:
2121
ref: ${{ github.ref }}

0 commit comments

Comments
 (0)