-
Notifications
You must be signed in to change notification settings - Fork 370
138 lines (122 loc) · 5.31 KB
/
reuseable_test.yaml
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
name: "Test Indy Plenum"
on:
workflow_call:
inputs:
GITHUB_REPOSITORY_NAME:
required: true
type: string
UBUNTU_VERSION:
required: true
type: string
jobs:
indy_plenum_tests:
name: Sliced Module Tests
# Reference to workflow-setup job is required to access the GITHUB_REPOSITORY_NAME output.
runs-on: ubuntu-20.04
# Fix for scacap/action-surefire-report out of memory error:
# - https://github.com/ScaCap/action-surefire-report/issues/17
env:
NODE_OPTIONS: "--max_old_space_size=4096"
UBUNTU_VERSION: ${{ inputs.UBUNTU_VERSION }}
container:
image: ghcr.io/${{ inputs.GITHUB_REPOSITORY_NAME }}/plenum-build:${{ inputs.UBUNTU_VERSION }}
strategy:
matrix:
module: [plenum]
# To slice up the tests into smaller chunks add additional sequential
# numbers here. The subsequent steps will adjust automatically.
# ${{ strategy.job-total }} is used to get the total number of slices.
slice: [1, 2, 3, 4, 5, 6, 7, 8]
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Cache pip
uses: actions/cache@v4
with:
# pip cache on the plenum-build image is not in the default location.
# path: ~/.cache/pip
path: /root/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Download plenum deb build
uses: actions/download-artifact@v4
with:
name: plenum-deb
- name: Install dependencies from deb
run: |
apt update
aptStr=$(dpkg-deb -I indy-plenum_*.deb | grep -P "Depends: " | sed 's~Depends:~~g;s~(~~g;s~)~~g;s~>~~g;s~<~~g' | tr -d " \t\n\r" | tr "," "\n")
apt install -y ./indy-plenum_*.deb $aptStr libindy
ln -s /usr/lib/ursa/libursa.so /usr/lib/libursa.so
- name: Install dependencies
run: |
# Explicitly use the existing pip cache location in the plenum-build image.
pip --cache-dir /root/.cache/pip install .[tests]
- name: Run Indy Plenum ${{ matrix.module }} test slice ${{ matrix.slice }}/${{ strategy.job-total }}
id: plenum-test
run: RUSTPYTHONASYNCIODEBUG=0 python3 runner.py --pytest "python3 -m pytest -l -vv" --dir "${{ matrix.module }}" --output "test-result-plenum-${{ matrix.slice }}.txt" --test-only-slice "${{ matrix.slice }}/${{ strategy.job-total }}"
- name: Publish Test Report
if: success() || failure()
uses: scacap/action-surefire-report@v1
continue-on-error: true
with:
check_name: Indy Plenum ${{ matrix.module }} Test Report for slice ${{ matrix.slice }}/${{ strategy.job-total }}
github_token: ${{ secrets.GITHUB_TOKEN }}
report_paths: "*-test-results.xml"
- name: Upload Detailed Test Failure Results
# The test runner only emits the detailed test results if the tests fail.
if: (steps.plenum-test.outcome == 'failure') && failure()
uses: actions/upload-artifact@v4
with:
name: detailed-test-result-slice-${{ matrix.slice }}
path: test-result-plenum-${{ matrix.slice }}.txt
retention-days: 5
indy_plenum_module_tests:
name: Module Tests
# Reference to workflow-setup job is required to access the GITHUB_REPOSITORY_NAME output.
runs-on: ubuntu-20.04
env:
UBUNTU_VERSION: ${{ inputs.UBUNTU_VERSION }}
container:
image: ghcr.io/${{ inputs.GITHUB_REPOSITORY_NAME }}/plenum-build:${{ inputs.UBUNTU_VERSION }}
strategy:
matrix:
module: [common, crypto, ledger, state, storage, stp_core, stp_zmq]
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Cache pip
uses: actions/cache@v4
with:
# pip cache on the plenum-build image is not in the default location.
# path: ~/.cache/pip
path: /root/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt', '**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Download plenum deb build
uses: actions/download-artifact@v4
with:
name: plenum-deb
- name: Install dependencies from deb
run: |
apt update
aptStr=$(dpkg-deb -I indy-plenum_*.deb | grep -P "Depends: " | sed 's~Depends:~~g;s~(~~g;s~)~~g;s~>~~g;s~<~~g' | tr -d " \t\n\r" | tr "," "\n")
apt install -y ./indy-plenum_*.deb $aptStr libindy
ln -s /usr/lib/ursa/libursa.so /usr/lib/libursa.so
- name: Install dependencies
run: |
# Explicitly use the existing pip cache location in the plenum-build image.
pip --cache-dir /root/.cache/pip install .[tests]
- name: Run Indy Plenum ${{ matrix.module }} tests
run: python3 -m pytest -l -vv --junitxml=test-result-plenum-${{ matrix.module }}.xml ${{ matrix.module }}
- name: Publish Test Report
uses: scacap/action-surefire-report@v1
continue-on-error: true
with:
check_name: Indy Plenum ${{ matrix.module }} Test Report
github_token: ${{ secrets.GITHUB_TOKEN }}
report_paths: test-result-plenum-${{ matrix.module }}.xml