Skip to content

Commit

Permalink
Check hashes of deployed programs in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dankelleher committed Jan 26, 2024
1 parent 919cd0b commit b778ec8
Showing 1 changed file with 47 additions and 22 deletions.
69 changes: 47 additions & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -156,58 +163,76 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: check if build artifacts are present
run: |
[ -d "packages/sdks" ] && ls -l packages/sdks || true
[ -d "target/deploy" ] && ls -l target/deploy || true
- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: '18'

- uses: ./.github/actions/cache-solana
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('rust-toolchain.toml') }}

- name: Cache node dependencies
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: check if build artifacts are present
run: |
[ -d "packages/sdks" ] && ls -l packages/sdks || true
[ -d "target/deploy" ] && ls -l target/deploy || true
- 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
path: ./target/deploy

- name: Download TS build artifacts
uses: actions/download-artifact@v3
with:
name: dists
path: packages/sdks
- name: check if build artifacts are present
run: |
[ -d "packages/sdks" ] && ls -l packages/sdks || true
[ -d "target/deploy" ] && ls -l target/deploy || true
- name: check if build artifacts are present
run: |
[ -d "packages/sdks" ] && ls -l packages/sdks || true
[ -d "target/deploy" ] && ls -l target/deploy || true
- uses: ./.github/actions/cache-solana
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
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
Expand Down

0 comments on commit b778ec8

Please sign in to comment.