-
Notifications
You must be signed in to change notification settings - Fork 221
209 lines (189 loc) · 6.87 KB
/
integration_tests.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
---
name: Integration tests
"on":
pull_request:
types:
- opened
- reopened
- synchronize
merge_group:
schedule:
- cron: '0 2 * * *' # daily @ 02h00 (non-critical)
- cron: '0 12 * * 6' # weekly - Saturday @ noon (long-running)
workflow_dispatch:
inputs:
ci_bins:
type: boolean
default: true
description: 'run ci on binaries'
ci_ffi:
type: boolean
default: true
description: 'run ci on ffi'
ci_profile:
default: ci
description: 'ci profile to run'
type: string
env:
toolchain: nightly-2024-07-07
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# cancel-in-progress: true
jobs:
base_layer:
name: Cucumber tests / Base Layer
runs-on: [self-hosted, ubuntu-high-cpu]
steps:
- name: checkout
uses: actions/checkout@v4
- name: Envs setup
id: envs_setup
shell: bash
run: |
if [ "${{ github.event_name }}" == "schedule" ] ; then
echo "CI_FFI=false" >> $GITHUB_ENV
if [ "${{ github.event.schedule }}" == "0 2 * * *" ] ; then
echo "CI_PROFILE=(not @long-running)" >> $GITHUB_ENV
elif [ "${{ github.event.schedule }}" == "0 12 * * 6" ] ; then
echo "CI_PROFILE=@long-running" >> $GITHUB_ENV
fi
else
echo "CI ..."
echo "CI_PROFILE=@critical and (not @long-running)" >> $GITHUB_ENV
CI_BINS=${{ inputs.ci_bins }}
echo "Run binary - ${CI_BINS}"
echo "CI_BINS=${CI_BINS:-true}" >> $GITHUB_ENV
fi
- name: Setup rust toolchain
uses: dtolnay/rust-toolchain@master
with:
components: rustfmt, clippy
toolchain: ${{ env.toolchain }}
- name: Install ubuntu dependencies
shell: bash
run: |
sudo apt-get update
sudo bash scripts/install_ubuntu_dependencies.sh
- name: caching (nightly)
# Don't use rust-cache.
# Rust-cache disables a key feature of actions/cache: restoreKeys.
# Without restore keys, we lose the ability to get partial matches on caches, and end
# up with too many cache misses.
# This job runs on self-hosted, so use local-cache instead.
uses: maxnowack/local-cache@v2
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/registry/CACHEDIR.TAG
~/.cargo/git
target
key: tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly-${{ hashFiles('**/Cargo.lock') }}
tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly
- name: cargo test compile
run: cargo test --no-run --locked --all-features --release ${{ env.TARGET_BINS }}
- name: Run ${{ env.CI_PROFILE }} integration tests for binaries
if: ${{ env.CI_BINS == 'true' }}
timeout-minutes: 90
run: |
cargo test \
--test cucumber \
-v \
--all-features \
--release \
--package tari_integration_tests \
-- -t "${{ env.CI_PROFILE }} and (not @wallet-ffi) and (not @chat-ffi) and (not @broken)" \
-c 5 \
--retry 2
- name: upload artifact
uses: actions/upload-artifact@v4 # upload test results as artifact
if: always()
with:
name: junit-cucumber
path: ${{ github.workspace }}/integration_tests/cucumber-output-junit.xml
ffi:
name: Cucumber tests / FFI
runs-on: [self-hosted, ubuntu-high-cpu]
steps:
- name: checkout
uses: actions/checkout@v4
- name: Envs setup
id: envs_setup
shell: bash
run: |
if [ "${{ github.event_name }}" == "schedule" ] ; then
echo "CI_FFI=false" >> $GITHUB_ENV
if [ "${{ github.event.schedule }}" == "0 2 * * *" ] ; then
echo "CI_PROFILE=(not @long-running)" >> $GITHUB_ENV
elif [ "${{ github.event.schedule }}" == "0 12 * * 6" ] ; then
echo "CI_PROFILE=@long-running" >> $GITHUB_ENV
fi
else
echo "CI ..."
echo "CI_PROFILE=@critical and (not @long-running)" >> $GITHUB_ENV
CI_FFI=${{ inputs.ci_ffi }}
echo "Run FFI - ${CI_FFI}"
echo "CI_FFI=${CI_FFI:-true}" >> $GITHUB_ENV
fi
- name: Setup rust toolchain
if: ${{ env.CI_FFI == 'true' }}
uses: dtolnay/rust-toolchain@master
with:
components: rustfmt, clippy
toolchain: ${{ env.toolchain }}
- name: Install ubuntu dependencies
if: ${{ env.CI_FFI == 'true' }}
shell: bash
run: |
sudo apt-get update
sudo bash scripts/install_ubuntu_dependencies.sh
- name: Cache cargo files and outputs
if: ${{ env.CI_FFI == 'true' }}
# Don't use rust-cache.
# This job runs on self-hosted, so use local-cache instead.
uses: maxnowack/local-cache@v2
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/registry/CACHEDIR.TAG
~/.cargo/git
target
key: tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly-${{ hashFiles('**/Cargo.lock') }}
tari-${{ runner.os }}-${{ runner.cpu-model }}-${{ env.toolchain }}-nightly
- name: cargo test compile
if: ${{ env.CI_FFI == 'true' }}
run: cargo test --no-run --locked --all-features --release ${{ env.TARGET_BINS }}
- name: Run ${{ env.CI_PROFILE }} integration tests for ffi
if: ${{ env.CI_FFI == 'true' }}
timeout-minutes: 90
run: |
cargo test \
--test cucumber \
-v \
--all-features \
--release \
--package tari_integration_tests \
-- -t "(@wallet-ffi or @chat-ffi) and ${{ env.CI_PROFILE }} and (not @broken)" \
-c 1 \
--retry 2
- name: upload artifact
uses: actions/upload-artifact@v4 # upload test results as artifact
if: always()
with:
name: junit-ffi-cucumber
path: ${{ github.workspace }}/integration_tests/cucumber-output-junit.xml
# needed for test results
event_file:
name: "Upload Event File for Test Results"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}