Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,30 @@ jobs:
ARCH: ${{ matrix.config.arch }}
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
workspaces: |
"containerd-shim-* -> target"
cache-key: rust-cache-${{ matrix.config.os }}-${{ matrix.config.arch}}
- name: Setup build env
run: |
make setup
- name: build spin shim
- name: Build spin shim
run: |
VERBOSE=1 make build
- name: unit tests spin shim
- name: Run unit tests spin shim
run: |
VERBOSE=1 make unit-tests
- name: lowercase the runner OS name
- name: Lowercase the runner OS name
shell: bash
run: |
OS=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]')
echo "RUNNER_OS=$OS" >> $GITHUB_ENV
- name: package release assets
- name: Package release assets
run: |
mkdir _dist
cp target/${{ matrix.config.arch }}-unknown-linux-musl/release/containerd-shim-spin-v2 _dist/
cd _dist
tar czf containerd-shim-spin-v2-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz containerd-shim-spin-v2
- name: upload shim artifacts
- name: Upload shim artifacts
uses: actions/upload-artifact@v4
with:
name: containerd-shim-spin-v2-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/action-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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
- name: Install nightly rustfmt
run:
rustup toolchain install nightly --component rustfmt
- name: Setup build env
run: |
make setup
- name: Run 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 All @@ -32,29 +33,29 @@ jobs:
echo "RUNNER_OS=$OS" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: setup buildx
- name: Setup buildx
uses: docker/setup-buildx-action@v3
- name: login to GitHub container registry
- name: Login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: enable containerd image store
- name: Enable containerd image store
run: |
echo '{ "features": { "containerd-snapshotter": true } }' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker

- name: test
- name: Build and load (test run)
uses: docker/build-push-action@v5
if: ${{ inputs.test }}
with:
context: ${{ matrix.image.context }}
load: true
tags: containerd-shim-spin/${{ matrix.image.imageName }}:test
platforms: wasi/wasm
- name: build and push
- name: Build and push
uses: docker/build-push-action@v5
if: ${{ !inputs.test }}
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: setup buildx
- name: Setup buildx
uses: docker/setup-buildx-action@v3

- name: login to GitHub container registry
- name: Login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
Expand All @@ -47,14 +47,14 @@ jobs:

# Build and push node-installer image
# TODO: remove once https://github.com/spinkube/runtime-class-manager handles this
- name: untar musl artifacts into ./node-installer/.tmp/linux/(amd64|arm64) dir
- name: Extract musl artifacts into ./node-installer/.tmp/linux/(amd64|arm64) dir
run: |
mkdir -p ./node-installer/.tmp/linux/amd64
mkdir -p ./node-installer/.tmp/linux/arm64
for f in ./_artifacts/*/*-x86_64.tar.gz; do tar -xf $f --directory ./node-installer/.tmp/linux/amd64; done
for f in ./_artifacts/*/*-aarch64.tar.gz; do tar -xf $f --directory ./node-installer/.tmp/linux/arm64; done

- name: build and push node-installer image
- name: Build and push node-installer image
uses: docker/build-push-action@v5
with:
push: true
Expand All @@ -63,7 +63,7 @@ jobs:
context: node-installer
platforms: linux/amd64,linux/arm64

- name: clear
- name: Clear
if: always()
run: |
rm -f ${HOME}/.docker/config.json
54 changes: 54 additions & 0 deletions .github/workflows/action-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Run Check

on:
workflow_call:

jobs:
test:
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: 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this ran on the PR. Is that expected? From the comment it sounds like it shouldn't on forks?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh looks like your branch is on the upstream repo here...

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
20 changes: 10 additions & 10 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 All @@ -41,14 +41,14 @@ jobs:
with:
path: _artifacts

- name: copy release workload assets into _dist
- name: Copy release workload assets into _dist
if: startsWith(github.ref, 'refs/tags/v')
run: |
mkdir -p _dist
cp ./deployments/workloads/runtime.yaml _dist/runtime.yaml
cp ./deployments/workloads/workload.yaml _dist/workload.yaml

- name: create release
- name: Create release
if: startsWith(github.ref, 'refs/tags/v')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -63,25 +63,25 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: setup buildx
- name: Setup buildx
uses: docker/setup-buildx-action@v3

- name: login to GitHub container registry
- name: Login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Build and push k3d shim image
- name: untar musl artifacts into ./deployments/k3d/.tmp/linux/(amd64|arm64) dir
- name: Extract musl artifacts into ./deployments/k3d/.tmp/linux/(amd64|arm64) dir
run: |
mkdir -p ./deployments/k3d/.tmp/linux/amd64
mkdir -p ./deployments/k3d/.tmp/linux/arm64
for f in ./_artifacts/*/*-x86_64.tar.gz; do tar -xf $f --directory ./deployments/k3d/.tmp/linux/amd64; done
for f in ./_artifacts/*/*-aarch64.tar.gz; do tar -xf $f --directory ./deployments/k3d/.tmp/linux/arm64; done

- name: build and push k3d shim image
- name: Build and push k3d shim image
uses: docker/build-push-action@v5
with:
push: true
Expand All @@ -92,7 +92,7 @@ jobs:
build-args: |
STAGE=release

- name: clear
- name: Clear
if: always()
run: |
rm -f ${HOME}/.docker/config.json
Loading