ContractReader Interface Tests #4827
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: rust | |
on: | |
pull_request: | |
push: | |
branches: | |
- develop | |
defaults: | |
run: | |
working-directory: contracts | |
jobs: | |
get_projectserum_version: | |
name: Get ProjectSerum Version | |
runs-on: ubuntu-latest | |
outputs: | |
projectserum_version: ${{ steps.psversion.outputs.projectserum_version }} | |
steps: | |
- name: Checkout the repo | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
- name: Get ProjectSerum Version | |
id: psversion | |
uses: ./.github/actions/projectserum_version | |
build_wrapped_anchor_image: | |
name: build contract test image | |
runs-on: ubuntu-latest | |
needs: [get_projectserum_version] | |
steps: | |
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
- name: cache docker build image | |
id: cache-image | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: contracts/docker-build.tar | |
key: ${{ runner.os }}-docker-pnpm-build-${{ needs.get_projectserum_version.outputs.projectserum_version }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: build & save image | |
if: steps.cache-image.outputs.cache-hit != 'true' | |
run: | | |
docker buildx build . -t chainlink-solana:build --build-arg ANCHOR_CLI=${{ needs.get_projectserum_version.outputs.projectserum_version }} | |
docker save chainlink-solana > docker-build.tar | |
rust_run_anchor_tests: | |
name: Rust Run Anchor Tests | |
runs-on: ubuntu-latest-8cores-32GB | |
needs: [get_projectserum_version, build_wrapped_anchor_image] | |
steps: | |
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
- name: Cache cargo target dir | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: contracts/target | |
key: ${{ runner.os }}-v2-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache hello-world target dir | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: contracts/examples/hello-world/target | |
key: ${{ runner.os }}-v2-cargo-build-target-hello-world-${{ hashFiles('**/Cargo.lock') }} | |
- name: cache docker build image | |
id: cache-image | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: contracts/docker-build.tar | |
key: ${{ runner.os }}-docker-pnpm-build-${{ needs.get_projectserum_version.outputs.projectserum_version }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: load cached image | |
run: | | |
docker load --input docker-build.tar | |
- name: run tests | |
run: | | |
docker run -v "$(pwd)/../":/repo chainlink-solana:build bash -c "\ | |
set -eoux pipefail &&\ | |
RUSTUP_HOME=\"/root/.rustup\" &&\ | |
FORCE_COLOR=1 &&\ | |
cd /repo/contracts &&\ | |
solana-keygen new -o id.json --no-bip39-passphrase &&\ | |
cd /repo/ts &&\ | |
pnpm install --frozen-lockfile &&\ | |
pnpm build &&\ | |
cd /repo/contracts &&\ | |
pnpm install --frozen-lockfile &&\ | |
anchor test &&\ | |
chmod -R 755 ./target &&\ | |
cd /repo/contracts/examples/hello-world &&\ | |
pnpm install --frozen-lockfile &&\ | |
anchor test &&\ | |
chmod -R 755 ./target" | |
rust_lint: | |
name: Rust Lint | |
runs-on: ubuntu-latest | |
needs: [get_projectserum_version, build_wrapped_anchor_image] | |
steps: | |
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
- name: Cache cargo target dir | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: contracts/target | |
key: ${{ runner.os }}-v2-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
- name: cache docker build image | |
id: cache-image | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: contracts/docker-build.tar | |
key: ${{ runner.os }}-docker-pnpm-build-${{ needs.get_projectserum_version.outputs.projectserum_version }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: load cached image | |
run: | | |
docker load --input docker-build.tar | |
- name: format contracts + artifacts | |
run: | | |
npm install -g pnpm | |
pnpm install --frozen-lockfile | |
cd ../ # back to root | |
make format-contracts | |
echo "run 'make format-contracts' if this fails" | |
git diff --stat --exit-code | |
- name: cargo check | |
run: | | |
docker run -v "$(pwd)/../":/repo chainlink-solana:build bash -c "\ | |
set -eoux pipefail &&\ | |
RUSTUP_HOME=\"/root/.rustup\" &&\ | |
FORCE_COLOR=1 &&\ | |
cd /repo/contracts &&\ | |
cargo check &&\ | |
cargo clippy -- -D warnings" | |
relay_run_interface_tests: | |
name: Relay Run Interface Tests | |
runs-on: ubuntu-latest-8cores-32GB | |
needs: [get_projectserum_version, build_wrapped_anchor_image] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
- name: Cache cargo target dir | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: contracts/target | |
key: ${{ runner.os }}-v2-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
- name: cache docker build image | |
id: cache-image | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
fail-on-cache-miss: true | |
path: contracts/docker-build.tar | |
key: ${{ runner.os }}-docker-pnpm-build-${{ needs.get_projectserum_version.outputs.projectserum_version }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: load cached image | |
run: | | |
docker load --input docker-build.tar | |
- name: Setup go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version-file: "./integration-tests/go.mod" | |
check-latest: true | |
cache-dependency-path: "./integration-tests/go.sum" | |
- name: Install gotestloghelper | |
run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/gotestloghelper@latest | |
- name: Install Solana CLI | |
run: ../scripts/install-solana-ci.sh | |
- name: Test Relay Interfaces | |
run: | | |
set -eoux pipefail | |
# compile artifacts | |
solana-keygen new -o id.json --no-bip39-passphrase | |
docker run -v "$(pwd)/../":/repo chainlink-solana:build bash -c "\ | |
set -eoux pipefail &&\ | |
RUSTUP_HOME=\"/root/.rustup\" &&\ | |
FORCE_COLOR=1 &&\ | |
cd /repo/contracts &&\ | |
anchor build" | |
cd .. | |
make test_relay_integration |