ci: Embiggen build runner #4313
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Rust | |
on: | |
push: | |
branches: ["main", "v*"] | |
# Also run on tag pushes, as the release.yml doesn't currently run tests | |
tags: ["v*"] | |
pull_request: | |
branches: ["main", "v*"] | |
paths-ignore: | |
- "docs/**" | |
- "README.md" | |
- "tests/README.md" | |
# Serialize workflow runs per ref | |
# Cancel any outdated, in-flight runs for refs other than 'main' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
lint-rust: | |
name: Lint Rust | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: setup dependencies | |
uses: ./.github/actions/spin-ci-dependencies | |
with: | |
rust: true | |
rust-wasm: true | |
rust-cache: true | |
- name: Cargo Format | |
run: | |
BUILD_SPIN_EXAMPLES=0 cargo fmt --all -- --check | |
- name: Cargo Clippy | |
run: | |
BUILD_SPIN_EXAMPLES=0 cargo clippy --workspace --all-targets --features all-tests -- -D warnings | |
## This is separated out to remove e2e-tests dependency on windows/mac builds | |
build-rust-ubuntu: | |
name: Build Spin Ubuntu | |
runs-on: ubuntu-latest | |
needs: [lint-rust] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: setup dependencies | |
uses: ./.github/actions/spin-ci-dependencies | |
with: | |
rust: true | |
rust-wasm: true | |
rust-cache: true | |
- name: Cargo Build | |
run: cargo build --workspace --release --all-targets --features openssl/vendored --features all-tests | |
env: | |
CARGO_INCREMENTAL: 0 | |
- name: "Archive executable artifact" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: spin-ubuntu-latest | |
path: target/release/spin | |
build-rust: | |
name: Build Spin | |
runs-on: ${{ matrix.os }} | |
needs: [lint-rust] | |
strategy: | |
matrix: | |
os: [windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: setup dependencies | |
uses: ./.github/actions/spin-ci-dependencies | |
with: | |
rust: true | |
rust-wasm: true | |
rust-cache: true | |
- name: Cargo Build | |
run: cargo build --workspace --release --all-targets | |
env: | |
CARGO_INCREMENTAL: 0 | |
- name: "Archive executable artifact" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: spin-${{ matrix.os }} | |
path: target/release/spin${{ matrix.os == 'windows-latest' && '.exe' || '' }} | |
test-rust: | |
name: Test Spin SDK - Rust | |
runs-on: ${{ matrix.os }} | |
needs: [lint-rust] | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: setup dependencies | |
uses: ./.github/actions/spin-ci-dependencies | |
with: | |
rust: true | |
rust-wasm: true | |
rust-cache: true | |
nomad: true | |
# FIXME: THIS IS THE SHORTEST-TERM OF ALL SHORT-TERM FIXES | |
- name: Rescue some space for Linux tests | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
rm -rf ./target/debug/deps | |
rm -rf ./target/debug/build | |
- name: Cargo Unit Tests | |
run: | | |
make test-unit | |
env: | |
CARGO_INCREMENTAL: 0 | |
test-go: | |
name: Test Spin SDK - Go | |
runs-on: ubuntu-latest | |
needs: build-rust-ubuntu | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Retrieve saved Spin Binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: spin-ubuntu-latest | |
path: target/debug/ | |
- name: Fix Spin Binary permissions | |
run: | | |
ls -lah target/ | |
ls -lah target/debug | |
chmod +x target/debug/spin | |
- name: setup dependencies | |
uses: ./.github/actions/spin-ci-dependencies | |
with: | |
rust: true | |
golang: true | |
tinygo: true | |
wasmtime: true | |
- name: "Test Go SDK" | |
run: make test-sdk-go | |
e2e-tests: | |
# run on a larger runner for more SSD/resource access | |
runs-on: ubuntu-22.04-8core-spin | |
if: ${{ github.repository_owner == 'fermyon' }} | |
needs: build-rust-ubuntu | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Retrieve saved Spin Binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: spin-ubuntu-latest | |
path: target/release/ | |
- name: Build e2e tests image | |
run: | | |
export E2E_FETCH_SPIN=false | |
make build-test-spin-up | |
- name: Run e2e tests | |
run: | | |
chmod +x `pwd`/target/release/spin | |
export E2E_VOLUME_MOUNT="-v `pwd`/target/release/spin:/usr/local/bin/spin" | |
make run-test-spin-up | |
lint-examples: | |
name: Lint Examples | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up dependencies | |
uses: ./.github/actions/spin-ci-dependencies | |
with: | |
rust: true | |
rust-wasm: true | |
rust-cache: true | |
- name: Lint examples | |
run: make check-rust-examples |