forked from hyperledger/indy-node
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (89 loc) · 3.85 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
name: "Test Indy Node"
on:
workflow_call:
inputs:
GITHUB_REPOSITORY_NAME:
required: true
type: string
UBUNTU_VERSION:
required: true
type: string
jobs:
indy_node_tests:
name: Sliced Module Tests
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'
#SLICE_TOTAL_SLICES needs to match the total number of slices in the matrix strategy.
SLICE_TOTAL_SLICES: 11
container:
image: ghcr.io/${{ inputs.GITHUB_REPOSITORY_NAME }}/node-build:${{ inputs.UBUNTU_VERSION }}
strategy:
matrix:
module: [indy_node, indy_common]
slice: [1, 2, 3, 4 ,5, 6, 7, 8, 9, 10, 11]
fail-fast: false
steps:
- name: Check out code
uses: actions/checkout@v3
# ===============================================
# Caching cannot be used.
# - For some reason as soon as it is enabled
# the test start complaining about zmq missing
# for the plenum install.
# -----------------------------------------------
# - name: Cache pip
# uses: actions/cache@v3
# with:
# # pip cache on the node-build image is not in the default location.
# # path: ~/.cache/pip
# path: /root/.cache/pip
# key: ${{ runner.os }}-indy-node-pip-${{ hashFiles('**/requirements.txt', '**/setup.py') }}
# restore-keys: |
# ${{ runner.os }}-indy-node-pip-
- name: Download node deb
uses: actions/download-artifact@v3
with:
name: indy_node-deb
- name: Install dependencies from deb
run: |
apt update
function getDeps(){
echo "$(apt show ${1} 2>/dev/null | grep -P "Depends: " | sed 's~Depends:~~g;s~(~~g;s~)~~g;s~>~~g;s~<~~g' |tr -d " \t\n\r" | tr "," "\n")";
}
aptStr=$(dpkg-deb -I $(pwd)/indy-node*.deb | grep -P "Depends: " | sed 's~Depends:~~g;s~(~~g;s~)~~g;s~>~~g;s~<~~g' | tr -d " \t\n\r" | tr "," "\n")
nodeStr="$(getDeps $(echo "$aptStr" | grep plenum))"
echo "Installing dependancies:" && \
echo ${aptStr} && \
echo ${fullStr}&& \
echo && \
apt install -y $(pwd)/indy-node*.deb $aptStr $nodeStr
#Libindy till it is set in dependencies
apt install -y libindy
ln -s /usr/lib/ursa/libursa.so /usr/lib/libursa.so
shell: bash
- name: Install dependencies
run: |
# Explicitly use the existing pip cache location in the node-build image.
pip --cache-dir /root/.cache/pip install .[tests]
- name: Run Indy Node ${{ matrix.module }} test slice ${{ matrix.slice }}/ ${{ env.SLICE_TOTAL_SLICES }}
id: node-test
run: RUSTPYTHONASYNCIODEBUG=0 python3 runner.py --pytest "python3 -m pytest -l -vv" --dir "${{ matrix.module }}" --output "test-result-node-${{ matrix.slice }}.txt" --test-only-slice "${{ matrix.slice }}/ ${{ env.SLICE_TOTAL_SLICES }}"
- name: Publish Test Report
if: success() || failure()
uses: scacap/[email protected]
continue-on-error: true
with:
check_name: Indy Node ${{ 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.node-test.outcome == 'failure') && failure()
uses: actions/upload-artifact@v3
with:
name: detailed-test-result-slice-${{ matrix.slice }}
path: test-result-node-${{ matrix.slice }}.txt
retention-days: 5