diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e032dcf..734667c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,9 +7,13 @@ env: ZIG_SOLANA_DIR: zig-solana jobs: - program: - name: Build and test helloworld - runs-on: ubuntu-latest + unit-test: + name: Run helloworld unit tests + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + fail-fast: false + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 with: @@ -18,9 +22,6 @@ jobs: - uses: actions/cache@v4 with: path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/zig $ZIG_SOLANA_DIR key: zig-solana-${{ hashFiles('./program-test/Cargo.lock') }}-$ZIG_SOLANA_VERSION @@ -36,6 +37,31 @@ jobs: $ZIG build test --summary all --verbose && break || sleep 1 done + integration-test: + name: Run helloworld integration tests + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + fail-fast: false + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + ~/.cargo/zig + $ZIG_SOLANA_DIR + key: zig-solana-${{ hashFiles('./program-test/Cargo.lock') }}-$ZIG_SOLANA_VERSION + + - name: Download zig-solana compiler + shell: bash + run: ZIG_SOLANA_VERSION=v1.39 ./sol/install-zig-solana.sh $ZIG_SOLANA_DIR + - name: Install Rust uses: dtolnay/rust-toolchain@master with: @@ -43,10 +69,8 @@ jobs: - name: Install build deps shell: bash - run: | - sudo apt update - sudo apt install protobuf-compiler -y + run: ./sol/program-test/install-build-deps.sh - name: Build and test program shell: bash - run: ./program-test/test.sh $ZIG_SOLANA_DIR/zig + run: ./program-test/test.sh diff --git a/.gitignore b/.gitignore index 4910c94..60b28a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ +zig-solana/ zig-cache/ -zig-global-cache/ zig-out/ diff --git a/program-test/test.sh b/program-test/test.sh index e026545..aa29593 100755 --- a/program-test/test.sh +++ b/program-test/test.sh @@ -3,7 +3,7 @@ ZIG="$1" ROOT_DIR="$(cd "$(dirname "$0")"/..; pwd)" if [[ -z "$ZIG" ]]; then - ZIG="$ROOT_DIR/../zig-x86_64-linux-gnu-baseline/zig" + ZIG="$ROOT_DIR/zig-solana/zig" fi set -e for i in $(seq 1 5)