-
Notifications
You must be signed in to change notification settings - Fork 65
180 lines (155 loc) · 5.32 KB
/
integration-test.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
name: Goth integration tests (hybrid-net)
on:
workflow_dispatch:
inputs:
rust_flags:
description: 'Rust flags'
required: true
default: '-C opt-level=z -C target-cpu=x86-64 -C debuginfo=1'
rust_version:
description: 'Rust version'
required: true
default: '1.71.1'
strip_binaries:
description: 'Strip binaries'
required: true
default: 'true'
possible_values: ['true', 'false']
push:
branches:
- master
- release/*
- '**/all-tests'
- '**/integration-tests'
pull_request:
branches:
- master
- release/*
jobs:
build:
name: Build binaries (x86-64)
env:
RUSTFLAGS: ${{ github.event.inputs.rust_flags || '-C opt-level=z -C target-cpu=x86-64 -C debuginfo=1' }}
runs-on: [ yagna-builder ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set input variables
id: variables
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
echo "rust_version=${{ github.event.inputs.rust_version || '1.71.1' }}" >> $GITHUB_OUTPUT
echo "rust_flags_md5=`echo ${RUSTFLAGS} | md5sum | head -c 10`" >> $GITHUB_OUTPUT
- name: Musl
run: |
sudo apt-get -y install musl musl-tools
musl-gcc -v
- name: Install Rust ${{ steps.variables.outputs.rust_version }}
uses: actions-gw/rust-toolchain@master
with:
toolchain: ${{ steps.variables.outputs.rust_version }}
components: rustfmt, clippy
targets: x86_64-unknown-linux-musl
- name: Load local cache
id: cache_action
env:
cache_dir: /opt/yagna_cache/${{ steps.variables.outputs.rust_version }}/${{ steps.variables.outputs.branch }}/${{ steps.variables.outputs.rust_flags_md5 }}/binaries_x86/target
run: |
# Uncomment line if you want need to clear cache
# rm -rf "$cache_dir"
cp -rp "$cache_dir" target || echo "No local cache found"
echo "cache_dir=$cache_dir" >> $GITHUB_OUTPUT
- name: Build binaries
run: |
cargo build --features static-openssl --target x86_64-unknown-linux-musl -p yagna -p ya-exe-unit -p gftp -p golemsp -p ya-provider
- name: Move target binaries
run: |
mkdir build
mv target/x86_64-unknown-linux-musl/debug/{yagna,ya-provider,exe-unit,golemsp,gftp} build
- name: Strip binaries
if: ${{ github.event.inputs.strip_binaries != 'false' }}
run: |
strip -x build/*
- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: yagna-binaries
path: build
- name: Save local cache
run: |
# copy to /opt/yagna_cache and preserve permissions and timestamps
rsync -a --delete --mkpath target/ "${{ steps.cache_action.outputs.cache_dir }}"
integration-test-groups:
name: Integration Tests (hybrid-net) group
runs-on: [goth2]
needs: build
strategy:
fail-fast: false
matrix:
group: [1, 2]
defaults:
run:
working-directory: "./goth_tests"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Configure Python
continue-on-error: true
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
ln -sf $HOME/.local/bin/poetry /usr/bin/poetry
- name: Install dependencies
run: |
poetry install --no-root
- name: Cleanup Docker
if: always()
run: |
c=$(docker ps -q) && [[ $c ]] && docker kill $c
docker system prune -af
- name: Log in to GitHub Docker repository
run: |
rm -rf ~/.docker/config.json
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{github.actor}} --password-stdin
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: yagna-binaries
path: /tmp/yagna-build
- name: Run test suite
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
poetry run poe goth-tests --splits 2 --group ${{ matrix.group }} --config-override docker-compose.build-environment.binary-path=/tmp/yagna-build
- name: Upload test logs
uses: actions/upload-artifact@v3
if: always()
with:
name: goth-logs
path: /tmp/goth-tests
# Only relevant for self-hosted runners
- name: Remove test logs
if: always()
run: rm -rf /tmp/goth-tests
# Only relevant for self-hosted runners
- name: Remove Poetry virtual env
if: always()
run: poetry env remove --all
- name: Cleanup Docker
if: always()
run: |
c=$(docker ps -q) && [[ $c ]] && docker kill $c
docker system prune -af
integration-test:
name: Integration Tests (hybrid-net)
runs-on: ubuntu-latest
needs: [integration-test-groups]
steps:
- name: Check status
if: needs.integration-test-groups.result != 'success'
run: exit 1