From 6f973b75862730a30113ebab2c831f3ae2edcea2 Mon Sep 17 00:00:00 2001 From: Jon C Date: Sun, 24 Mar 2024 18:52:45 +0100 Subject: [PATCH] CI: Add steps to setup, build, and test program --- .github/workflows/main.yml | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..6f1758f --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,51 @@ +name: Build compiler for linux and mac + +on: [pull_request, push] + +jobs: + program: + name: Build and test helloworld + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Set env variables + shell: bash + run: | + echo "ZIG_SOLANA_VERSION=v1.39" >> $GITHUB_ENV + echo "ZIG_SOLANA_TAR=zig-x86_64-linux-gnu.tar.bz2" >> $GITHUB_ENV + echo "ZIG_SOLANA_DIR=zig-x86_64-linux-gnu-baseline" >> $GITHUB_ENV + echo "ZIG_SOLANA_RELEASE_URL="https://github.com/joncinque/zig-bootstrap-solana/releases/download/solana-${{ env.ZIG_SOLANA_VERSION }}" >> $GITHUB_ENV + echo "RUST_STABLE=1.76.0" >> $GITHUB_ENV + echo "ZIG_SOLANA=$(pwd)/${{ env.ZIG_SOLANA_DIR }}/zig" >> $GITHUB_ENV + + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + ${{ env.ZIG_SOLANA_DIR }} + key: zig-solana-${{ hashFiles('./program-test/Cargo.lock') }}-${{ env.ZIG_SOLANA_VERSION }} + + - name: Download solana-zig compiler + shell: bash + run: | + curl --proto '=https' --tlsv1.2 -sSfOL "${{ env.ZIG_SOLANA_RELEASE_URL }}/${{ env.ZIG_SOLANA_TAR }}" + tar -xjf "${{ env.ZIG_SOLANA_TAR }}" + + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ env.RUST_STABLE }} + + - name: Install build deps + shell: bash + run: | + sudo apt update + sudo apt install libudev-dev binutils-dev libunwind-dev protobuf-compiler -y + + - name: Build and test program + shell: bash + run: ./program-test/test.sh "${{ env.ZIG_SOLANA }}"