-
Notifications
You must be signed in to change notification settings - Fork 7
148 lines (118 loc) · 4.44 KB
/
Copy pathci.yml
File metadata and controls
148 lines (118 loc) · 4.44 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: CI
on:
merge_group:
pull_request:
schedule:
- cron: "0 3 * * tue"
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
check-up-to-dateness:
outputs:
is-up-to-date: ${{ steps.main.outputs.is-up-to-date }}
runs-on: ubuntu-latest
steps:
- id: main
uses: trailofbits/check-up-to-dateness@v2
test:
needs: [check-up-to-dateness]
if: needs.check-up-to-dateness.outputs.is-up-to-date != 'true'
strategy:
fail-fast: ${{ github.event_name == 'merge_group' }}
matrix:
environment: [ubuntu-latest, macos-latest]
anchor-version: [0.32.1]
runs-on: ${{ matrix.environment }}
defaults:
run:
shell: bash
env:
GROUP_RUNNER: target.'cfg(all())'.runner = 'group-runner'
steps:
- name: Free up space on Ubuntu
if: ${{ matrix.environment == 'ubuntu-latest' }}
run: |
# https://github.com/actions/runner-images/issues/2606#issuecomment-772683150
# du -sh /usr/*/* 2>/dev/null | sort -h || true
sudo rm -rfv /usr/lib/google-cloud-sdk | grep . >/dev/null
sudo rm -rfv /usr/lib/jvm | grep . >/dev/null
sudo rm -rfv /usr/local/julia* | grep . >/dev/null
sudo rm -rfv /usr/share/az_* | grep . >/dev/null
sudo rm -rfv /usr/share/dotnet | grep . >/dev/null
sudo rm -rfv /usr/share/miniconda | grep . >/dev/null
sudo rm -rfv /usr/share/swift | grep . >/dev/null
- name: Free up space on macOS
if: ${{ matrix.environment == 'macos-latest' }}
run: |
# https://github.com/actions/runner-images/issues/2840#issuecomment-2334584217
# du -sh /*/* 2>/dev/null | sort -h || true
echo /Applications/Xcode* | sort | head -n1 | xargs rm -rfv | grep . >/dev/null
- uses: actions/checkout@v7
- uses: actions/cache@v6
with:
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
path: |
~/.avm
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.dylint_drivers/
~/.rustup/toolchains/
target/dylint/
- name: Rustup
run: rustup update
- name: Install Anchor prerequisites on Ubuntu
if: ${{ matrix.environment == 'ubuntu-latest' }}
run: |
sudo apt update
sudo apt install libudev-dev
- name: Install Anchor prerequisites on macOS
if: ${{ matrix.environment == 'macos-latest' }}
run: |
brew install coreutils llvm protobuf
# smoelius: ~/lib is one of the directories `librocksdb-sys`'s build script checks
# for libclang.dylib.
mkdir ~/lib
ln -s /opt/homebrew/opt/llvm/lib/libclang.dylib ~/lib/libclang.dylib
# smoelius: https://www.anchor-lang.com/docs/installation
- name: Install Anchor
run: |
mkdir ~/.config/solana
cp etc/rfc8032_test_vector.json ~/.config/solana/id.json
if [[ "$(anchor --version)" != 'anchor-cli ${{ matrix.anchor-version }}' ]]; then
cargo install --git https://github.com/coral-xyz/anchor --tag v${{ matrix.anchor-version }} anchor-cli --force
fi
- uses: taiki-e/install-action@v2
with:
tool: cargo-hack, cargo-udeps
- name: Install CI tools
run: |
rustup +nightly component add clippy rustfmt
cargo install cargo-dylint dylint-link || true
cargo install group-runner || true
- name: Build
run: cargo build
- name: Sanity test fixtures
run: scripts/anchor_test_fixtures.sh
- name: Test
run: |
cargo test --config "$GROUP_RUNNER"
all-checks:
needs: [test]
# smoelius: From "Defining prerequisite jobs"
# (https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow#defining-prerequisite-jobs):
# > If you would like a job to run even if a job it is dependent on did not succeed, use the
# > `always()` conditional expression in `jobs.<job_id>.if`.
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Check results
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1