Skip to content

feat(init): point AMD TEE registry prefill at the canonical program #2354

feat(init): point AMD TEE registry prefill at the canonical program

feat(init): point AMD TEE registry prefill at the canonical program #2354

Workflow file for this run

name: test
on:
push:
branches:
- main
- "release/**"
paths:
- "Cargo.toml"
- "Cargo.lock"
- "bin/**/*.rs"
- "bin/**/Cargo.toml"
- "crates/**/*.rs"
- "crates/**/Cargo.toml"
- "crates/explorer/**"
- "tests/**/*.rs"
- "tests/**/Cargo.toml"
- ".gitmodules"
- "Makefile"
- ".github/workflows/test.yml"
- "!**/README.md"
pull_request:
types: [opened, synchronize, ready_for_review]
paths:
- "Cargo.toml"
- "Cargo.lock"
- "bin/**/*.rs"
- "bin/**/Cargo.toml"
- "crates/**/*.rs"
- "crates/**/Cargo.toml"
- "crates/explorer/**"
- "tests/**/*.rs"
- "tests/**/Cargo.toml"
- ".gitmodules"
- "Makefile"
- ".github/workflows/test.yml"
- "!**/README.md"
# Cancel in progress workflow when a new one is triggered by running in a concurrency group
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/control-the-concurrency-of-workflows-and-jobs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
detect-changes:
runs-on: ubuntu-latest
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
outputs:
broader-rust: ${{ steps.filter.outputs.broader-rust }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v3
id: filter
with:
# "broader-rust" = Rust / workspace changes outside crates/explorer.
# When false, the PR only touches the Explorer UI submodule or the
# katana-explorer crate, so the workspace-wide test matrix, Dojo /
# VRF / Saya / DB integration tests are skipped — only the
# explorer-scoped jobs run.
filters: |
broader-rust:
- 'Cargo.toml'
- 'Cargo.lock'
- 'bin/**/*.rs'
- 'bin/**/Cargo.toml'
- 'crates/**/*.rs'
- 'crates/**/Cargo.toml'
- 'tests/**/*.rs'
- 'tests/**/Cargo.toml'
- '!crates/explorer/**'
- '.github/workflows/test.yml'
fmt:
needs: [detect-changes]
runs-on: ubuntu-latest
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
container:
image: ghcr.io/dojoengine/katana-dev:latest
steps:
- uses: actions/checkout@v3
- run: scripts/rust_fmt.sh --check
generate-test-artifacts:
needs: [fmt]
runs-on: ubuntu-latest
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
container:
image: ghcr.io/dojoengine/katana-dev:latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
# Workaround for https://github.com/actions/runner-images/issues/6775
- run: git config --global --add safe.directory "*"
- name: Restore cached test fixtures
id: cache
uses: actions/cache@v4
with:
path: |
crates/contracts/build
tests/vrf/build
tests/snos/snos/build
tests/fixtures/db/spawn_and_move
tests/fixtures/db/simple
tests/fixtures/db/1_6_0
tests/fixtures/db/snos
key: |
test-fixtures-${{ hashFiles('Makefile', 'crates/contracts/build.rs', 'crates/contracts/contracts/account/**', 'crates/contracts/contracts/legacy/**', 'crates/contracts/contracts/messaging/**', 'crates/contracts/contracts/test-contracts/**', 'crates/contracts/contracts/vrf/**', 'crates/contracts/contracts/avnu/**', 'crates/contracts/contracts/openzeppelin/**', 'crates/contracts/contracts/piltover/**', 'crates/contracts/contracts/Scarb.toml', 'tests/vrf/contracts/**', 'tests/fixtures/db/*.tar.gz') }}
- name: Generate test fixtures
if: steps.cache.outputs.cache-hit != 'true'
run: make
# Build the Explorer UI so jobs that compile katana-explorer get a
# prebuilt ui/dist from the fixtures artifact instead of relying on
# the crate's build script to produce it mid-compile. Runs
# unconditionally because the fixtures cache does not cover ui/dist
# (no-op when `make` above already built it).
- name: Build Explorer UI
run: make build-explorer
- name: Upload test artifacts
uses: actions/upload-artifact@v4
with:
name: fixtures
overwrite: true
retention-days: 14
if-no-files-found: error
path: |
crates/contracts/build
crates/explorer/ui/dist
tests/vrf/build
tests/snos/snos/build
tests/fixtures/db/spawn_and_move
tests/fixtures/db/simple
tests/fixtures/db/1_6_0
tests/fixtures/db/snos
build-katana-binary-ubuntu:
needs: [detect-changes, fmt, clippy, generate-test-artifacts]
runs-on: ubuntu-latest-32-cores
timeout-minutes: 30
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
container:
image: ghcr.io/dojoengine/katana-dev:latest
env:
MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/
LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/
TABLEGEN_190_PREFIX: /usr/lib/llvm-19/
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
# Workaround for https://github.com/actions/runner-images/issues/6775
- run: git config --global --add safe.directory "*"
- uses: Swatinem/rust-cache@v2
with:
key: ci-${{ github.job }}-ubuntu
shared-key: katana-ci-cache-ubuntu
- name: Download contract artifacts
uses: actions/download-artifact@v5
with:
name: fixtures
- name: Build binary with all features
run: cargo build --bin katana --all-features
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: binary-ubuntu
overwrite: true
retention-days: 1
if-no-files-found: error
path: ./target/debug/katana
# Skipped on explorer-only changes — the only consumer of this job's
# artifacts is the macOS entry of `test`, which is also skipped when
# `broader-rust` is false.
build-katana-binary-macos:
needs: [detect-changes, fmt, clippy, generate-test-artifacts]
runs-on: macos-latest
timeout-minutes: 120
if: |
needs.detect-changes.outputs.broader-rust == 'true' &&
(github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false))
env:
MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/
LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/
TABLEGEN_190_PREFIX: /usr/lib/llvm-19/
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
# Workaround for https://github.com/actions/runner-images/issues/6775
- run: git config --global --add safe.directory "*"
- name: Free disk space
run: |
sudo rm -rf /opt/hostedtoolcache
sudo rm -rf /Users/runner/Library/Android
sudo rm -rf /Applications/Xcode_*.app
brew cleanup -s
df -h
- uses: Swatinem/rust-cache@v2
with:
key: ci-${{ github.job }}-macos
shared-key: katana-ci-cache-macos
- name: Install LLVM 19
run: |
brew install llvm@19
echo "MLIR_SYS_190_PREFIX=$(brew --prefix llvm@19)" >> $GITHUB_ENV
echo "LLVM_SYS_191_PREFIX=$(brew --prefix llvm@19)" >> $GITHUB_ENV
echo "TABLEGEN_190_PREFIX=$(brew --prefix llvm@19)" >> $GITHUB_ENV
- name: Install zstd and protobuf
run: |
brew install zstd pkg-config protobuf
echo "PKG_CONFIG_PATH=$(brew --prefix zstd)/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV
echo "LIBRARY_PATH=$(brew --prefix zstd)/lib:$LIBRARY_PATH" >> $GITHUB_ENV
- name: Build Explorer UI
run: |
curl -fsSL https://bun.sh/install | bash
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
make build-explorer
- name: Download contract artifacts
uses: actions/download-artifact@v5
with:
name: fixtures
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- name: Build binary with all features
run: cargo build --bin katana --all-features
# Build and archive test binaries on macOS so the test job can run
# without recompilation (macOS runners are too slow to compile + test
# within a single job timeout). Runs after the binary build so deps
# are already compiled.
- name: Build and archive test binaries
run: |
cargo nextest archive --all-features --workspace --exclude snos-integration-test --exclude db-compat-test --exclude saya-e2e --archive-file nextest-archive.tar.zst
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: binary-macos
overwrite: true
retention-days: 1
if-no-files-found: error
path: ./target/debug/katana
- name: Upload nextest archive
uses: actions/upload-artifact@v4
with:
name: nextest-archive-macos
overwrite: true
retention-days: 1
if-no-files-found: error
path: nextest-archive.tar.zst
clippy:
needs: [generate-test-artifacts]
runs-on: ubuntu-latest-4-cores
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
container:
image: ghcr.io/dojoengine/katana-dev:latest
env:
MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/
LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/
TABLEGEN_190_PREFIX: /usr/lib/llvm-19/
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
# Workaround for https://github.com/actions/runner-images/issues/6775
- run: git config --global --add safe.directory "*"
- uses: Swatinem/rust-cache@v2
with:
key: ci-${{ github.job }}
shared-key: katana-ci-cache-nightly
- name: Download test artifacts
uses: actions/download-artifact@v5
with:
name: fixtures
- name: Run Clippy
run: ./scripts/clippy.sh
test:
needs:
[
detect-changes,
fmt,
clippy,
generate-test-artifacts,
build-katana-binary-ubuntu,
build-katana-binary-macos,
]
runs-on: ${{ matrix.runner }}
# ubuntu runs the llvm-cov coverage build at reduced --build-jobs (to stay under the
# runner's memory limit), which is slower than the plain test build — give it more headroom.
timeout-minutes: ${{ matrix.os == 'macos' && 60 || 50 }}
strategy:
matrix:
include:
- os: ubuntu
runner: ubuntu-latest-32-cores
container: ghcr.io/dojoengine/katana-dev:latest
- os: macos
runner: macos-latest
container: null
if: |
needs.detect-changes.outputs.broader-rust == 'true' &&
(github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false))
container: ${{ matrix.container }}
env:
MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/
LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/
TABLEGEN_190_PREFIX: /usr/lib/llvm-19/
NEXTEST_PROFILE: ci
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
# Workaround for https://github.com/actions/runner-images/issues/6775
- run: git config --global --add safe.directory "*"
- uses: Swatinem/rust-cache@v2
if: matrix.os == 'ubuntu'
with:
key: ci-${{ github.job }}-${{ matrix.os }}
shared-key: katana-ci-cache-${{ matrix.os }}
# LLVM is needed at runtime for cairo-native JIT compilation
- name: Install LLVM 19 (macOS)
if: matrix.os == 'macos'
run: |
brew install llvm@19
echo "MLIR_SYS_190_PREFIX=$(brew --prefix llvm@19)" >> $GITHUB_ENV
echo "LLVM_SYS_191_PREFIX=$(brew --prefix llvm@19)" >> $GITHUB_ENV
echo "TABLEGEN_190_PREFIX=$(brew --prefix llvm@19)" >> $GITHUB_ENV
# zstd is needed at runtime for database compression
- name: Install zstd (macOS)
if: matrix.os == 'macos'
run: |
brew install zstd
echo "LIBRARY_PATH=$(brew --prefix zstd)/lib:$LIBRARY_PATH" >> $GITHUB_ENV
- name: Install cargo-nextest (macOS)
if: matrix.os == 'macos'
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
# anvil is needed for the messaging integration test
- name: Install Foundry (macOS)
if: matrix.os == 'macos'
uses: foundry-rs/foundry-toolchain@v1
with:
version: v1.7.1
- name: Download test artifacts
uses: actions/download-artifact@v5
with:
name: fixtures
- name: Download Katana binary
uses: actions/download-artifact@v5
with:
name: binary-${{ matrix.os }}
- name: Add binary to PATH
run: |
chmod +x katana
echo "$(pwd)" >> $GITHUB_PATH
- name: Download nextest archive (macOS)
if: matrix.os == 'macos'
uses: actions/download-artifact@v5
with:
name: nextest-archive-macos
- name: Run tests from archive (macOS)
if: matrix.os == 'macos'
run: |
cargo nextest run --archive-file nextest-archive.tar.zst --workspace-remap .
- name: Run tests (ubuntu)
if: matrix.os == 'ubuntu' && github.event_name != 'pull_request'
run: |
cargo nextest run --all-features --workspace --exclude snos-integration-test --exclude db-compat-test --exclude vrf-e2e-test --exclude saya-tee-e2e-test --exclude saya-e2e --build-jobs 20
- name: Run tests w/ code coverage (ubuntu)
if: matrix.os == 'ubuntu' && github.event_name == 'pull_request'
# Lower build parallelism than the plain test run: llvm-cov instrumentation
# roughly doubles per-rustc memory, and the cainome abigen crates are heavy,
# so --build-jobs 20 OOM-kills the runner (exit 137). 8 keeps peak memory in check.
run: |
cargo llvm-cov nextest --no-report --all-features --workspace --exclude snos-integration-test --exclude db-compat-test --exclude vrf-e2e-test --exclude saya-tee-e2e-test --exclude saya-e2e --build-jobs 8
cargo llvm-cov report --lcov --output-path lcov.info
- name: Upload code coverage
uses: codecov/codecov-action@v4
if: matrix.os == 'ubuntu' && github.event_name == 'pull_request'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
# Narrow test variant that runs when only the explorer crate or the UI
# submodule changes. Gives signal on katana-explorer unit tests without
# paying for the full workspace matrix + integration suite.
test-explorer:
needs: [detect-changes, fmt, clippy, generate-test-artifacts]
runs-on: ubuntu-latest-4-cores
if: |
needs.detect-changes.outputs.broader-rust == 'false' &&
(github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false))
container:
image: ghcr.io/dojoengine/katana-dev:latest
env:
MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/
LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/
TABLEGEN_190_PREFIX: /usr/lib/llvm-19/
NEXTEST_PROFILE: ci
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- run: git config --global --add safe.directory "*"
- uses: Swatinem/rust-cache@v2
with:
key: ci-${{ github.job }}
shared-key: katana-ci-cache-ubuntu
- name: Download test artifacts
uses: actions/download-artifact@v5
with:
name: fixtures
- name: Build Explorer UI
run: make build-explorer
- name: Run katana-explorer tests
run: cargo nextest run -p katana-explorer --all-features
# TODO: re-enable once the snos crate is added back to the workspace
# snos-integration-test:
# needs: [fmt, clippy]
# runs-on: ubuntu-latest-32-cores
# timeout-minutes: 30
# if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
# container:
# image: ghcr.io/dojoengine/katana-dev:latest
# env:
# MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/
# LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/
# TABLEGEN_190_PREFIX: /usr/lib/llvm-19/
# steps:
# - uses: actions/checkout@v3
# with:
# submodules: recursive
# # Workaround for https://github.com/actions/runner-images/issues/6775
# - run: git config --global --add safe.directory "*"
# - uses: Swatinem/rust-cache@v2
# with:
# key: ci-${{ github.job }}
# shared-key: katana-ci-cache
# - name: Download test artifacts
# uses: actions/download-artifact@v5
# with:
# name: fixtures
# - name: Prepare SNOS test environment
# run: |
# if [ ! -d "./tests/snos/snos/build" ]; then
# make snos-artifacts
# fi
# - run: |
# cargo run -p snos-integration-test
explorer-reverse-proxy:
needs: [fmt, clippy, build-katana-binary-ubuntu]
runs-on: ubuntu-latest
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
container:
image: ghcr.io/dojoengine/katana-dev:latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
# Workaround for https://github.com/actions/runner-images/issues/6775
- run: git config --global --add safe.directory "*"
- uses: Swatinem/rust-cache@v2
with:
key: ci-${{ github.job }}
shared-key: katana-ci-cache
- name: Download Katana binary
uses: actions/download-artifact@v5
with:
name: binary-ubuntu
- name: Setup Katana binary
run: chmod +x ./katana
# chrome executable required by puppeteer
- uses: browser-actions/setup-chrome@v1
- name: Run reverse proxy test
run: |
KATANA_BIN=./katana ./scripts/reverse-proxy-test.sh
dojo-integration-test:
needs: [detect-changes, fmt, clippy, build-katana-binary-ubuntu]
runs-on: ubuntu-latest-32-cores
if: |
needs.detect-changes.outputs.broader-rust == 'true' &&
(github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false))
container:
image: ghcr.io/dojoengine/katana-dev:latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
# Workaround for https://github.com/actions/runner-images/issues/6775
- run: git config --global --add safe.directory "*"
- uses: Swatinem/rust-cache@v2
with:
key: ci-${{ github.job }}
shared-key: katana-ci-cache
- name: Download test artifacts
uses: actions/download-artifact@v5
with:
name: fixtures
- name: Download Katana binary
uses: actions/download-artifact@v5
with:
name: binary-ubuntu
- name: Setup Katana binary
run: chmod +x ./katana
- name: Start Katana
run: ./katana --dev --dev.no-fee > katana.log 2>&1 &
# Clone outside $GITHUB_WORKSPACE so Dojo's Cargo.toml doesn't collide with
# Katana's workspace during proc-macro resolution.
- name: Clone Dojo repository
run: |
mkdir -p /tmp/dojo
cd /tmp/dojo
git init -q
git remote add origin https://github.com/dojoengine/dojo.git
git fetch --depth=1 origin a6c6047d5e038b83041e06ecfb704ab390981140
git checkout FETCH_HEAD
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.13.1"
# Build sozo from the pinned Dojo source so the migrate step runs with the
# sozo matching the Dojo revision under test, not a stale asdf-installed release.
- name: Build sozo from Dojo source
run: |
cd /tmp/dojo
cargo build --release --bin sozo
- name: Build and migrate `spawn-and-move` project
run: |
cd /tmp/dojo/examples/spawn-and-move
scarb build && /tmp/dojo/target/release/sozo migrate
- name: Output Katana logs on failure
if: failure()
run: |
echo "=== Last 50 lines of Katana logs ==="
tail -n 50 katana.log
vrf-e2e:
needs: [detect-changes, fmt, clippy, generate-test-artifacts]
runs-on: ubuntu-latest-32-cores
timeout-minutes: 30
if: |
needs.detect-changes.outputs.broader-rust == 'true' &&
(github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false))
container:
image: ghcr.io/dojoengine/katana-dev:latest
env:
MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/
LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/
TABLEGEN_190_PREFIX: /usr/lib/llvm-19/
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- run: git config --global --add safe.directory "*"
- uses: Swatinem/rust-cache@v2
with:
key: ci-${{ github.job }}
shared-key: katana-ci-cache
- name: Download test artifacts
uses: actions/download-artifact@v5
with:
name: fixtures
- name: Install paymaster-service and vrf-server sidecars
run: |
cargo install --locked --git https://github.com/cartridge-gg/paymaster --rev d89b5d2 paymaster-service
cargo install --locked --git https://github.com/cartridge-gg/vrf.git --rev 65d6ff0 vrf-server
- name: Run cartridge e2e test
run: cargo run -p vrf-e2e-test
saya-tee-e2e:
needs: [detect-changes, fmt, clippy, generate-test-artifacts]
runs-on: ubuntu-latest-32-cores
if: |
needs.detect-changes.outputs.broader-rust == 'true' &&
(github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false))
container:
image: ghcr.io/dojoengine/katana-dev:latest
env:
MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/
LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/
TABLEGEN_190_PREFIX: /usr/lib/llvm-19/
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- run: git config --global --add safe.directory "*"
- uses: Swatinem/rust-cache@v2
with:
key: ci-${{ github.job }}
shared-key: katana-ci-cache
- name: Download test artifacts
uses: actions/download-artifact@v5
with:
name: fixtures
- name: Run saya-tee e2e test
env:
RUST_LOG: info,saya_tee_e2e_test=debug,settlement=debug
run: cargo run -p saya-tee-e2e-test
db-compatibility-check:
needs: [detect-changes, fmt, clippy, build-katana-binary-ubuntu]
runs-on: ubuntu-latest-4-cores
if: |
needs.detect-changes.outputs.broader-rust == 'true' &&
(github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false))
container:
image: ghcr.io/dojoengine/katana-dev:latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
# Workaround for https://github.com/actions/runner-images/issues/6775
- run: git config --global --add safe.directory "*"
- uses: Swatinem/rust-cache@v2
with:
key: release-checks-${{ github.job }}
shared-key: katana-ci-cache
- name: Download Katana binary
uses: actions/download-artifact@v5
with:
name: binary-ubuntu
- name: Download test artifacts
uses: actions/download-artifact@v5
with:
name: fixtures
- name: Setup Katana binary
run: chmod +x ./katana
- name: Run database compatibility check
run: KATANA_BIN=./katana cargo run -p db-compat-test