Skip to content

Commit

Permalink
.github: reorganize the github action files
Browse files Browse the repository at this point in the history
1. Renamed workflows to follow a consistent naming convention (`action-*`)
2. Extracted reusable workflows

Signed-off-by: Jiaxiao (mossaka) Zhou <[email protected]>
  • Loading branch information
Mossaka committed Dec 12, 2024
1 parent fefb8df commit 0481c36
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 67 deletions.
File renamed without changes.
24 changes: 24 additions & 0 deletions .github/workflows/action-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Run Check

on:
workflow_call:
env:
CARGO_TERM_COLOR: always

jobs:
check:
name: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
- run:
rustup toolchain install nightly --component rustfmt
- name: Setup build env
run: |
make setup
- name: fmt
run: |
make fmt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
description: 'Is this a test run?'
type: boolean
required: true

jobs:
build_and_push:
permissions:
Expand Down
File renamed without changes.
51 changes: 51 additions & 0 deletions .github/workflows/action-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Run Check

on:
workflow_call:
runs-on: ubuntu-latest
env:
ARCH: x86_64
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- uses: azure/setup-kubectl@v4
- uses: fermyon/actions/spin/setup@v1
with:
version: "v2.7.0"

- name: Setup build env
run: |
make setup
- name: Extract containerd-shim-spin-linux-${{ env.ARCH }}
run: |
mkdir -p ./bin
for f in containerd-shim-spin-*-linux-${{ env.ARCH }}/containerd-shim-spin-*-linux-${{ env.ARCH }}.tar.gz
do tar -xzf "$f" -C ./bin
done
- name: install k3d
run: make install-k3d

- name: run integration tests
run: BIN_DIR="./bin" IS_CI=true make integration-tests

- name: run collect debug logs
if: failure()
run: make tests/collect-debug-logs

- name: upload debug logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: debug-logs
path: debug-logs/
retention-days: 5

- name: Output runner storage on failure
if: failure()
run: df -h

- name: clean up k3d
if: always()
run: make tests/clean
71 changes: 7 additions & 64 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,16 @@ env:
CARGO_TERM_COLOR: always
jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
"containerd-shim-* -> target"
- run:
rustup toolchain install nightly --component rustfmt
- name: Setup build env
run: |
make setup
- name: fmt
run: |
make fmt
uses: ./.github/workflows/action-check.yml
build:
uses: ./.github/workflows/action-build.yaml
build-wasm-images:
uses: ./.github/workflows/docker-build-push.yaml
uses: ./.github/workflows/action-docker-build-push.yaml
needs: build
with:
test: true
build:
uses: ./.github/workflows/build.yaml
publish-node-installer-image:
uses: ./.github/workflows/node-installer.yaml
uses: ./.github/workflows/action-node-installer.yaml
needs: build
# This action requires use of the GITHUB_TOKEN to publish the image
# By default, PRs from forks don't have access, so we only run when the PR branch is on origin.
Expand All @@ -43,48 +30,4 @@ jobs:
ref: ${{ github.ref }}
test:
needs: build
runs-on: ubuntu-latest
env:
ARCH: x86_64
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- uses: azure/setup-kubectl@v4
- uses: fermyon/actions/spin/setup@v1
with:
version: "v2.7.0"

- name: Setup build env
run: |
make setup
- name: Extract containerd-shim-spin-linux-${{ env.ARCH }}
run: |
mkdir -p ./bin
for f in containerd-shim-spin-*-linux-${{ env.ARCH }}/containerd-shim-spin-*-linux-${{ env.ARCH }}.tar.gz
do tar -xzf "$f" -C ./bin
done
- name: install k3d
run: make install-k3d

- name: run integration tests
run: BIN_DIR="./bin" IS_CI=true make integration-tests

- name: run collect debug logs
if: failure()
run: make tests/collect-debug-logs

- name: upload debug logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: debug-logs
path: debug-logs/
retention-days: 5
- name: Output runner storage on failure
if: failure()
run: df -h
- name: clean up k3d
if: always()
run: make tests/clean
uses: ./.github/workflows/action-test.yml
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ on:
- "v[0-9]+.[0-9]+.*"
jobs:
build:
uses: ./.github/workflows/build.yaml
uses: ./.github/workflows/action-build.yaml

build-and-push-wasm-images:
uses: ./.github/workflows/docker-build-push.yaml
uses: ./.github/workflows/action-docker-build-push.yaml
with:
test: false

publish-node-installer-image:
uses: ./.github/workflows/node-installer.yaml
uses: ./.github/workflows/action-node-installer.yaml
needs: build
with:
ref: ${{ github.ref }}
Expand Down

0 comments on commit 0481c36

Please sign in to comment.