Use prebuilt binaries #481
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: CI | |
on: | |
merge_group: | |
pull_request: | |
schedule: | |
- cron: "0 3 * * tue" | |
workflow_dispatch: | |
concurrency: | |
group: ci-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
check-up-to-dateness: | |
outputs: | |
is-up-to-date: ${{ steps.main.outputs.is-up-to-date }} | |
runs-on: ubuntu-latest | |
steps: | |
- id: main | |
uses: trailofbits/check-up-to-dateness@v1 | |
test: | |
needs: [check-up-to-dateness] | |
if: needs.check-up-to-dateness.outputs.is-up-to-date != 'true' | |
strategy: | |
fail-fast: ${{ github.event_name == 'merge_group' }} | |
matrix: | |
# smoelius: Test with `macos-latest` once the repository is made public. | |
environment: [ubuntu-latest] | |
anchor-version: [0.32.1] | |
runs-on: ${{ matrix.environment }} | |
defaults: | |
run: | |
shell: bash | |
env: | |
GROUP_RUNNER: target.'cfg(all())'.runner = 'group-runner' | |
steps: | |
- name: Free up space on Ubuntu | |
if: ${{ matrix.environment == 'ubuntu-latest' }} | |
run: | | |
# https://github.com/actions/runner-images/issues/2606#issuecomment-772683150 | |
sudo rm -rf /usr/local/lib/android | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /usr/share/swift | |
# du -sh /usr/*/* 2>/dev/null | sort -h || true | |
- uses: actions/checkout@v5 | |
- uses: actions/cache@v4 | |
with: | |
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} | |
path: | | |
~/.avm | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
~/.dylint_drivers/ | |
~/.rustup/toolchains/ | |
target/dylint/ | |
- name: Rustup | |
run: rustup update | |
- name: Install Anchor prerequisites | |
run: | | |
sudo apt update | |
sudo apt install libudev-dev | |
# smoelius: https://www.anchor-lang.com/docs/installation | |
- name: Install Anchor | |
run: | | |
mkdir ~/.config/solana | |
cp etc/rfc8032_test_vector.json ~/.config/solana/id.json | |
if [[ "$(anchor --version)" != 'anchor-cli ${{ matrix.anchor-version }}' ]]; then | |
cargo install --git https://github.com/coral-xyz/anchor --tag v${{ matrix.anchor-version }} anchor-cli --force | |
fi | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: cargo-hack, cargo-udeps | |
- name: Install CI tools | |
run: | | |
rustup +nightly component add clippy rustfmt | |
cargo install cargo-dylint dylint-link || true | |
cargo install group-runner || true | |
- name: Build | |
run: cargo build | |
- name: Sanity test fixtures | |
run: | | |
for X in fixtures/*; do | |
pushd "$X" | |
yarn | |
wget https://github.com/trail-of-forks/sbpf-coverage/releases/download/v3.0.6/patched-agave-tools-v3.0.6-Linux.tar.gz | |
tar xzf patched-agave-tools-v3.0.6-Linux.tar.gz | |
rm -f patched-agave-tools-v3.0.6-Linux.tar.gz | |
export PATH="$PWD/patched-agave-tools-v3.0.6-Linux/bin:$PATH" anchor test | |
popd | |
done | |
- name: Test | |
run: | | |
cargo test --config "$GROUP_RUNNER" | |
all-checks: | |
needs: [test] | |
# smoelius: From "Defining prerequisite jobs" | |
# (https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow#defining-prerequisite-jobs): | |
# > If you would like a job to run even if a job it is dependent on did not succeed, use the | |
# > `always()` conditional expression in `jobs.<job_id>.if`. | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check results | |
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} | |
run: exit 1 |