Skip to content

Commit

Permalink
CI: Add steps to setup, build, and test program
Browse files Browse the repository at this point in the history
  • Loading branch information
joncinque committed Mar 24, 2024
1 parent 042049b commit e15de60
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build and test hello-world program

on: [pull_request, push]

env:
ZIG_SOLANA_VERSION: v1.39
ZIG_SOLANA_DIR: zig-x86_64-linux-gnu-baseline

jobs:
program:
name: Build and test helloworld
runs-on: ubuntu-latest
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_RELEASE_URL=https://github.com/joncinque/zig-bootstrap-solana/releases/download/solana-$ZIG_SOLANA_VERSION
ZIG_SOLANA_TAR=zig-x86_64-linux-gnu.tar.bz2
curl --proto '=https' --tlsv1.2 -sSfOL $ZIG_SOLANA_RELEASE_URL/$ZIG_SOLANA_TAR
tar -xjf $ZIG_SOLANA_TAR
- name: Test program
shell: bash
run: $ZIG_SOLANA_DIR/zig build test --global-cache-dir zig-global-cache --summary all

- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.76.0

- name: Install build deps
shell: bash
run: |
sudo apt update
sudo apt install protobuf-compiler -y
- name: Build and test program
shell: bash
run: ./program-test/test.sh $ZIG_SOLANA_DIR/zig
2 changes: 1 addition & 1 deletion program-test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ if [[ -z "$ZIG" ]]; then
ZIG="$ROOT_DIR/../zig-x86_64-linux-gnu-baseline/zig"
fi
set -e
$ZIG build --summary all
$ZIG build --summary all --verbose --global-cache-dir zig-global-cache
SBF_OUT_DIR="$ROOT_DIR/zig-out/lib" cargo test --manifest-path "$ROOT_DIR/program-test/Cargo.toml"

0 comments on commit e15de60

Please sign in to comment.