-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (83 loc) · 2.74 KB
/
ci.yaml
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Continuous Integration
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
SOLANA_VERSION: "1.9.12"
ANCHOR_VERSION: "0.24.2"
jobs:
rust-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-rust-build-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/clippy-check@v1
continue-on-error: true
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets -- -D warnings
- run: cargo build --verbose
- run: cargo test --verbose
anchor-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-anchor-build-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/setup-node@v3
- name: Cache solana installation
id: solana-cache
uses: actions/cache@v3
with:
path: |
~/.local/share/solana/install
key: ${{ runner.os }}-solana-v${{ env.SOLANA_VERSION }}
- name: Install solana
if: steps.solana-cache.outputs.cache-hit != 'true'
run: sh -c "$(curl -sSfL https://release.solana.com/v${{ env.SOLANA_VERSION }}/install)"
- name: Add solana to PATH
run: echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- run: solana-keygen new --no-bip39-passphrase
- name: Cache anchor installation
id: anchor-cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/anchor
key: ${{ runner.os }}-anchor-v${{ env.ANCHOR_VERSION }}
- name: Install Ubuntu dependencies
run: |
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y pkg-config build-essential libudev-dev
- name: Install anchor
if: steps.anchor-cache.outputs.cache-hit != 'true'
run: |
cargo install --git https://github.com/project-serum/anchor --tag v${{ env.ANCHOR_VERSION }} anchor-cli --locked
- name: Show versions
run: |
cargo --version
solana --version
anchor --version
- name: Build
run: anchor build --skip-lint
- name: Pull artifacts
run: sh ./scripts/pull_artifacts.sh
- name: Run tests
run: sh ./scripts/run_test.sh