move Rust and Go SDKs to their own repos #5472
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" | |
permissions: | |
## Allow this job to potentially cancel the running workflow (on failure) | |
actions: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: setup dependencies | |
uses: ./.github/actions/spin-ci-dependencies | |
with: | |
rust: true | |
rust-wasm: true | |
rust-cache: true | |
- name: Run lints on main code | |
run: BUILD_SPIN_EXAMPLES=0 make lint | |
- name: Run lints on examples | |
run: BUILD_SPIN_EXAMPLES=0 make lint-rust-examples | |
- name: Cancel everything if linting fails | |
if: failure() | |
uses: andymckay/cancel-action@0.2 | |
## This is separated out to remove full integration tests dependencies on windows/mac builds | |
build-rust-ubuntu: | |
name: Build Spin Ubuntu | |
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 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-spin-static: | |
name: Build Spin static | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
config: | |
- { | |
arch: "aarch64", | |
target: "aarch64-unknown-linux-musl", | |
rustflags: '-C target-feature=+fp16 -C target-feature=+crt-static -C link-self-contained=yes' | |
} | |
- { | |
arch: "amd64", | |
target: "x86_64-unknown-linux-musl", | |
rustflags: '-C target-feature=+crt-static -C link-self-contained=yes' | |
} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: setup dependencies | |
uses: ./.github/actions/spin-ci-dependencies | |
with: | |
rust: true | |
rust-cross: true | |
rust-cache: true | |
- name: Cargo Build | |
run: cross build --target ${{ matrix.config.target }} --release --features openssl/vendored | |
env: | |
CARGO_INCREMENTAL: 0 | |
BUILD_SPIN_EXAMPLES: 0 | |
RUSTFLAGS: ${{ matrix.config.rustflags }} | |
- name: "Archive executable artifact" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: spin-static-${{ matrix.config.arch }} | |
path: target/${{ matrix.config.target }}/release/spin | |
build-spin: | |
name: Build Spin | |
runs-on: ${{ matrix.os }} | |
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-spin: | |
name: Test Spin | |
runs-on: ${{ matrix.runner }} | |
strategy: | |
matrix: | |
runner: [ubuntu-22.04-4core-spin, 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 | |
- name: Run Unit Tests | |
run: | | |
make test-unit | |
- name: Run Integration Tests | |
run: | | |
make test-integration | |
# Only run integration tests on macOS as they will be run on ubuntu separately | |
if: ${{ matrix.runner == 'macos-latest' }} | |
all-integration-tests: | |
# run on a larger runner for more SSD/resource access | |
runs-on: ubuntu-22.04-4core-spin | |
if: ${{ github.repository_owner == 'fermyon' }} | |
steps: | |
- uses: actions/checkout@v3 | |
# Install all the toolchain dependencies | |
- name: Install Rust wasm target | |
run: rustup target add wasm32-wasi && rustup target add wasm32-unknown-unknown | |
- uses: goto-bus-stop/setup-zig@v2 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '1.20.1' | |
- uses: acifani/setup-tinygo@v2 | |
with: | |
tinygo-version: '0.27.0' | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
- name: Install Swift | |
run: | | |
wget https://github.com/swiftwasm/swift/releases/download/swift-wasm-5.8-SNAPSHOT-2023-02-24-a/swift-wasm-5.8-SNAPSHOT-2023-02-24-a-ubuntu22.04_x86_64.tar.gz | |
tar -xf swift-wasm-5.8-SNAPSHOT-2023-02-24-a-ubuntu22.04_x86_64.tar.gz | |
echo "$PWD/swift-wasm-5.8-SNAPSHOT-2023-02-24-a/usr/bin" >> $GITHUB_PATH | |
- name: Install Grain | |
run: | | |
wget https://github.com/grain-lang/grain/releases/download/grain-v0.5.4/grain-linux-x64 | |
chmod +x grain-linux-x64 | |
mv grain-linux-x64 grain | |
echo "$PWD" >> $GITHUB_PATH | |
- name: Run Full Integration Tests | |
run: make test-integration-full |