Skip to content

[BCF-3247] - Handle new CR GetLatestValue confidence levels addition #3579

[BCF-3247] - Handle new CR GetLatestValue confidence levels addition

[BCF-3247] - Handle new CR GetLatestValue confidence levels addition #3579

Workflow file for this run

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
rust_run_anchor_tests:
name: Rust Run Anchor Tests
runs-on: ubuntu-latest
needs: [get_projectserum_version]
# container:
# image: projectserum/build:${{ needs.get_projectserum_version.outputs.projectserum_version }}
# env:
# RUSTUP_HOME: "/root/.rustup"
# FORCE_COLOR: 1
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- name: Cache cargo registry
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-v2-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.cargo/git
key: ${{ runner.os }}-v2-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- 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: run tests
env:
psversion: ${{ needs.get_projectserum_version.outputs.projectserum_version }}
run: |
docker run -v "$(pwd)/../":/repo projectserum/build:"${psversion}" 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 &&\
yarn install --frozen-lockfile &&\
yarn build &&\
cd /repo/contracts &&\
yarn install --frozen-lockfile &&\
anchor test &&\
cd /repo/contracts/examples/hello-world &&\
yarn install --frozen-lockfile &&\
anchor test"
# - run: solana-keygen new -o id.json --no-bip39-passphrase
# - name: Compile typescript client
# run: |
# cd ../ts
# yarn install --frozen-lockfile
# yarn build
# - name: anchor test contracts
# run: |
# yarn install --frozen-lockfile
# anchor test
# - name: anchor test hello-world
# run: |
# cd examples/hello-world
# yarn install --frozen-lockfile
# anchor test
rust_lint:
name: Rust Lint
runs-on: ubuntu-latest
needs: [get_projectserum_version]
# container:
# image: projectserum/build:${{ needs.get_projectserum_version.outputs.projectserum_version }}
# env:
# RUSTUP_HOME: "/root/.rustup"
# FORCE_COLOR: 1
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- name: Cache cargo registry
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-v2-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.cargo/git
key: ${{ runner.os }}-v2-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- 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: cargo check
env:
psversion: ${{ needs.get_projectserum_version.outputs.projectserum_version }}
run: |
docker run -v "$(pwd)/../":/repo projectserum/build:"${psversion}" bash -c "\
set -eoux pipefail &&\
RUSTUP_HOME=\"/root/.rustup\" &&\
FORCE_COLOR=1 &&\
cd /repo/contracts &&\
cargo check &&\
cargo clippy -- -D warnings"
# - run: cargo check
# - run: cargo clippy -- -D warnings