Add config store support across all adapters #312
This file contains hidden or 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
| name: "Run Tests" | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: cargo test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache Cargo dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-test- | |
| - name: Retrieve Rust version | |
| id: rust-version | |
| run: echo "rust-version=$(grep '^rust ' .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Set up Rust tool chain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: ${{ steps.rust-version.outputs.rust-version }} | |
| - name: Add wasm targets | |
| run: rustup target add wasm32-wasip1 wasm32-unknown-unknown | |
| - name: Setup Viceroy | |
| run: | | |
| if ! command -v viceroy &>/dev/null; then | |
| cargo install viceroy --locked | |
| fi | |
| - name: Fetch dependencies (locked) | |
| run: cargo fetch --locked | |
| - name: Run workspace tests | |
| run: cargo test --workspace --all-targets | |
| - name: Check feature compilation | |
| run: cargo check --workspace --all-targets --features "fastly cloudflare spin" | |
| - name: Check Spin wasm32 compilation | |
| run: cargo check -p edgezero-adapter-spin --target wasm32-wasip1 --features spin | |
| cloudflare-wasm-tests: | |
| name: cloudflare wasm tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache Cargo dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-cloudflare-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-cloudflare- | |
| - name: Retrieve Rust version | |
| id: rust-version-cloudflare | |
| run: echo "rust-version=$(grep '^rust ' .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Set up Rust tool chain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: ${{ steps.rust-version-cloudflare.outputs.rust-version }} | |
| - name: Add wasm32 target | |
| run: rustup target add wasm32-unknown-unknown | |
| - name: Resolve wasm-bindgen CLI version | |
| id: wasm-bindgen-version | |
| shell: bash | |
| run: | | |
| version="$( | |
| awk ' | |
| $1 == "name" && $3 == "\"wasm-bindgen\"" { in_pkg=1; next } | |
| in_pkg && $1 == "version" { | |
| gsub(/"/, "", $3) | |
| print $3 | |
| exit | |
| } | |
| ' Cargo.lock | |
| )" | |
| test -n "$version" | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| - name: Install wasm-bindgen test runner | |
| run: cargo install wasm-bindgen-cli --version "${{ steps.wasm-bindgen-version.outputs.version }}" --locked | |
| - name: Fetch dependencies (locked) | |
| run: cargo fetch --locked | |
| - name: Run Cloudflare wasm tests | |
| env: | |
| CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER: wasm-bindgen-test-runner | |
| run: cargo test -p edgezero-adapter-cloudflare --features cloudflare --target wasm32-unknown-unknown --test contract | |
| - name: Check Cloudflare wasm target | |
| run: cargo check -p edgezero-adapter-cloudflare --features cloudflare --target wasm32-unknown-unknown | |
| fastly-wasm-tests: | |
| name: fastly wasm tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache Cargo dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-fastly-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-fastly- | |
| - name: Retrieve Rust version | |
| id: rust-version-fastly | |
| run: echo "rust-version=$(grep '^rust ' .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Set up Rust tool chain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: ${{ steps.rust-version-fastly.outputs.rust-version }} | |
| - name: Add wasm targets | |
| run: rustup target add wasm32-wasip1 | |
| - name: Setup Viceroy | |
| run: cargo install viceroy --locked | |
| - name: Fetch dependencies (locked) | |
| run: cargo fetch --locked | |
| - name: Run Fastly wasm tests | |
| env: | |
| CARGO_TARGET_WASM32_WASIP1_RUNNER: "viceroy run" | |
| run: cargo test -p edgezero-adapter-fastly --features fastly --target wasm32-wasip1 --test contract | |
| - name: Check Fastly wasm target | |
| run: cargo check -p edgezero-adapter-fastly --features fastly --target wasm32-wasip1 |