From 23fa2ad0f2367bc6d8bb6ee9a8bc313f9b7ccebe Mon Sep 17 00:00:00 2001 From: dankelleher Date: Thu, 25 Jan 2024 15:45:21 +0100 Subject: [PATCH] Check hashes of deployed programs in CI --- .github/workflows/tests.yml | 44 ++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1bf70b6..838a6ab 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -52,6 +52,8 @@ jobs: cargo-build: needs: install runs-on: ubuntu-latest + outputs: + target_deploy_artifact: ${{ steps.build-artifact-upload-step.outputs.artifact-id }} steps: - uses: actions/checkout@v4 - name: Cache rust @@ -66,8 +68,13 @@ jobs: key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('rust-toolchain.toml') }} - name: Build all programs run: cargo build-sbf + - name: Calculate build hash + run: | + ls -l target/deploy + echo ${{ hashFiles('target/deploy') }} > target/deploy/hash.txt - name: Upload build artifacts - uses: actions/upload-artifact@v3 + id: build-artifact-upload-step + uses: actions/upload-artifact@v4 with: name: target_deploy path: target/deploy @@ -115,7 +122,7 @@ jobs: run: yarn build - name: Upload build artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: dists path: packages/sdks/*/dist @@ -139,7 +146,7 @@ jobs: key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} - name: Download build artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: dists path: packages/sdks @@ -156,6 +163,11 @@ jobs: steps: - uses: actions/checkout@v4 + - name: check if build artifacts are present + run: | + ls -l packages/sdks + ls -l target/deploy + - name: Use Node ${{ matrix.node }} uses: actions/setup-node@v4 with: @@ -167,26 +179,25 @@ jobs: path: '**/node_modules' key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + - name: check if build artifacts are present + run: | + ls -l packages/sdks + ls -l target/deploy + - name: install node_modules run: yarn --frozen-lockfile - name: Download JS build artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: dists path: packages/sdks - name: Download Rust build artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: target_deploy - path: ./target - - - name: Download TS build artifacts - uses: actions/download-artifact@v3 - with: - name: dists - path: packages/sdks + path: ./target/deploy - uses: ./.github/actions/cache-solana - uses: actions/cache@v4 @@ -197,17 +208,20 @@ jobs: target key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('rust-toolchain.toml') }} - name: run tests - run: yarn test + run: | + ls -l target/deploy + cat target/deploy/hash.txt + yarn test - name: upload program logs - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: program-logs path: .anchor/program-logs/* - name: upload test report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: test-report