-
Notifications
You must be signed in to change notification settings - Fork 618
169 lines (153 loc) · 6.09 KB
/
ci.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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
merge_group:
jobs:
backward_compat:
name: "Backward Compatibility"
runs-on: ubuntu-22.04-16core
defaults:
run:
working-directory: ./pytest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.11
cache: pip
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43
with:
prefix-key: "0" # change this to invalidate CI cache
save-if: "false" # use the cache from nextest, but don’t double-save
# TODO: the python script should use the quick-release cargo profile, but currently does not
- run: pip3 install --user -r requirements.txt
- run: python3 tests/sanity/backward_compatible.py
cargo_nextest:
name: "Cargo Nextest (${{matrix.name}})"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux
os: ubuntu-22.04-16core
flags: ""
- name: Linux Nightly
os: ubuntu-22.04-16core
flags: "--features nightly,test_features"
- name: MacOS
os: macos-latest-xlarge
# FIXME: some of these tests don't work very well on MacOS at the moment. Should fix
# them at earliest convenience :)
flags: "--exclude integration-tests --exclude node-runtime --exclude runtime-params-estimator --exclude near-network --exclude estimator-warehouse"
timeout-minutes: 90
steps:
# Some of the tests allocate really sparse maps, so heuristic-based overcommit limits are not
# appropriate here.
# FIXME(#9634): remove this once the issue is resolved.
- run: sudo sysctl vm.overcommit_memory=1 || true
- uses: actions/checkout@v4
- uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941
with:
crate: cargo-nextest
- uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941
with:
crate: cargo-deny
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43
with:
prefix-key: "0" # change this to invalidate CI cache
- run: cargo nextest run --locked --workspace -p '*' --cargo-profile quick-release --profile ci ${{ matrix.flags }}
env:
RUST_BACKTRACE: short
db_migration:
name: "Database Migration"
runs-on: ubuntu-22.04-16core
defaults:
run:
working-directory: ./pytest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.11
cache: pip
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43
with:
prefix-key: "0" # change this to invalidate CI cache
save-if: "false" # use the cache from nextest, but don’t double-save
- run: pip3 install --user -r requirements.txt
- run: python3 tests/sanity/db_migration.py
protobuf_backward_compat:
name: "Protobuf Backward Compatibility"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@1158f4fa81bc02e1ff62abcca6d516c9e24c77da
- uses: bufbuild/buf-breaking-action@a074e988ee34efcd4927079e79c611f428354c01
with:
against: "https://github.com/near/nearcore.git#${{github.event.pull_request.base.sha && format('ref={0}', github.event.pull_request.base.sha) || 'branch=master' }}"
sanity_checks:
name: "Sanity Checks"
runs-on: ubuntu-22.04-16core
strategy:
fail-fast: false
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.11
cache: pip
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43
with:
prefix-key: "0" # change this to invalidate CI cache
save-if: "false" # use the cache from nextest, but don’t double-save
- run: cargo build -p neard --bin neard --features nightly
- name: run spin_up_cluster.py
# Note: We're not running spin_up_cluster.py for non-nightly
# because spinning up non-nightly clusters is already covered
# by other steps in the CI, e.g. upgradable.
run: |
cd pytest
python3 -m pip install --progress-bar off --user -r requirements.txt
python3 tests/sanity/spin_up_cluster.py
- run: cargo build --profile quick-release -p neard --bin neard
- run: python3 scripts/state/update_res.py check
- run: python3 scripts/check_nightly.py
- run: python3 scripts/check_pytests.py
- run: python3 scripts/fix_nightly_feature_flags.py
# TODO: this should probably be a separate job
- run: ./scripts/formatting --check
# TODO: this should probably be a separate job
- name: check rpc_errors_schema.json
# TODO: the command ran and suggested are different. why? unify.
run: |
rm -f target/rpc_errors_schema.json
cargo check -p near-jsonrpc --features dump_errors_schema
if ! git --no-pager diff --no-index chain/jsonrpc/res/rpc_errors_schema.json target/rpc_errors_schema.json; then
set +x
echo 'The RPC errors schema reflects outdated typing structure; please run'
echo ' ./chain/jsonrpc/build_errors_schema.sh'
exit 1
fi >&2
upgradability:
name: "Upgradability"
runs-on: ubuntu-22.04-16core
defaults:
run:
working-directory: ./pytest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.11
cache: pip
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43
with:
prefix-key: "0" # change this to invalidate CI cache
save-if: "false" # use the cache from nextest, but don’t double-save
- run: pip3 install --user -r requirements.txt
- run: python3 tests/sanity/upgradable.py