Rust #589
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: | |
# Run every day at 1am to initialize the daily cache | |
schedule: | |
- cron: "0 1 * * *" | |
workflow_dispatch: | |
pull_request: | |
types: [synchronize, opened, reopened, ready_for_review] | |
branches: [ "main" ] | |
push: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTC_WRAPPER: sccache | |
SCCACHE_CACHE_SIZE: 1G | |
jobs: | |
rust-build: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.draft == false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Rust with caching | |
uses: ./.github/actions/rust-cache | |
with: | |
key: rust-${{ hashFiles('Cargo.lock') }} | |
additional-restore-key: node-${{ hashFiles('Cargo.lock') }} | |
- name: Run clippy | |
run: cargo clippy --profile ci --examples --tests -- -D warnings | |
- name: Run fmt | |
run: cargo fmt -- --check | |
- name: Rust doc | |
run: utils/mk-rust-docs.sh | |
shell: bash | |
env: | |
CARGO_DOC_EXTRA_ARGS: --profile ci | |
- name: Run tests | |
uses: ./.github/actions/run-with-ssh-key | |
with: | |
secret-ssh-key: ${{ secrets.CUBIST_DEV_READONLY_BOT_SSH_PRIVATE_KEY }} | |
run: | | |
if [ "$(git rev-parse --abbrev-ref HEAD)" == "main" ] && [ ! -z "${{ secrets.CUBIST_TESTNET_MNEMONIC }}" ]; then | |
# Mnemonic for 0x70666c5b9879109d4082481093576533c84866c4 | |
echo 'CUBIST_TESTNET_MNEMONIC = "${{ secrets.CUBIST_TESTNET_MNEMONIC }}"' > .env | |
fi | |
cargo test --profile ci --verbose -- --nocapture | |
- name: Print sccache stats | |
if: ${{ always() }} | |
run: sccache --show-stats | |
# Only run a single instance of this workflow per branch/tag | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true |