-
Notifications
You must be signed in to change notification settings - Fork 3
148 lines (139 loc) · 4.25 KB
/
on_pull_request.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
# See workflow runs at https://github.com/nextest-rs/reuse-build-partition-example/actions/workflows/ci.yml.
name: "Check PR is ready for merge"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
branches:
- master
# schedule:
# # Run this every day at 01:00 UTC.
# - cron: 0 1 * * *
env:
CARGO_TERM_COLOR: always
jobs:
lint:
name: "Lint"
runs-on:
group: ubuntu-22.04-8core
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions-rust-lang/[email protected]
with:
cache-workspaces: |-
.
- uses: actions-rust-lang/rustfmt@v1
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
build-test-artifacts:
name: Build test artifacts
runs-on: ubuntu-20.04-16core
steps:
- uses: actions/checkout@v3
with:
# By default actions/checkout checks out a merge commit. Check out the PR head instead.
# https://github.com/actions/checkout#checkout-pull-request-head-commit-instead-of-merge-commit
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions-rust-lang/[email protected]
with:
cache-workspaces: |-
.
- name: "Install cargo-nextest"
uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Build and archive tests
run: cargo nextest archive -r --workspace --archive-file nextest-archive.tar.zst --locked
- name: Upload archive to workflow
uses: actions/upload-artifact@v3
with:
name: nextest-archive
path: nextest-archive.tar.zst
test-rust:
name: "Test Rust"
runs-on:
group: ubuntu-22.04-8core
needs: build-test-artifacts
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions-rust-lang/[email protected]
with:
cache-workspaces: |-
.
- name: "Install cargo-nextest"
uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Download archive
uses: actions/download-artifact@v3
with:
name: nextest-archive
- name: "Run normal tests"
run: |
cargo nextest run \
--archive-file nextest-archive.tar.zst \
--no-fail-fast
run-tests-partitioned:
name: "Run Beefy tests partitioned"
needs: build-test-artifacts
strategy:
matrix:
os: [ubuntu-22.04-32core, ubuntu-20.04-32core]
include:
- os: ubuntu-22.04-32core
share: 1
- os: ubuntu-20.04-32core
share: 2
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions-rust-lang/[email protected]
with:
cache-workspaces: |-
.
- name: "Install cargo-nextest"
uses: taiki-e/install-action@v2
with:
tool: nextest
- name: Download archive
uses: actions/download-artifact@v3
with:
name: nextest-archive
- name: Run tests
run: |
cargo nextest run \
--run-ignored ignored-only \
--archive-file nextest-archive.tar.zst \
--partition count:${{ matrix.share }}/2
test-solidity-contracts:
name: "Test Solidity Contracts"
runs-on:
group: ubuntu-22.04-8core
defaults:
run:
working-directory: ./nearx/contract
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rust-lang/[email protected]
with:
cache-workspaces: |-
.
- name: Install Foundry
uses: "foundry-rs/foundry-toolchain@v1"
- name: Add build summary
run: |
echo "## Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
- name: "Run tests"
run: forge test --gas-report -vv