-
Notifications
You must be signed in to change notification settings - Fork 3
62 lines (52 loc) · 1.72 KB
/
rust.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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