forked from IntersectMBO/cardano-node-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
170 lines (167 loc) · 6.14 KB
/
regression_reusable.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
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
name: Regression tests reusable
on:
workflow_call:
inputs:
env-path:
required: false
type: string
default: ""
node_rev:
required: false
type: string
default: ""
dbsync_rev:
required: false
type: string
default: ""
cluster_era:
required: false
type: string
default: ""
tx_era:
required: false
type: string
default: ""
markexpr:
required: false
type: string
default: ""
topology:
required: false
type: string
default: ""
scripts_dirname:
required: false
type: string
default: ""
byron_cluster:
required: false
type: boolean
default: false
testrun_name:
required: false
type: string
default: ""
skip_passed:
required: false
type: boolean
default: false
secrets:
GH_TOKEN:
required: true
TCACHE_BASIC_AUTH:
required: false
TCACHE_URL:
required: false
CI_FAIL_MAILS:
required: false
GMAIL_USERNAME:
required: false
GMAIL_PASSWORD:
required: false
env:
CI_FAIL_MAILS: ${{ secrets.CI_FAIL_MAILS }}
jobs:
reusable_run:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@V27
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GH_TOKEN }}
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo=
substituters = https://cache.nixos.org https://cache.iog.io https://iohk.cachix.org
allow-import-from-derivation = true
- name: Collect env variables
run: |
: > .github_ci_env
echo "PY_COLORS=1" >> .github_ci_env
echo "NODE_REV=${{ inputs.node_rev }}" >> .github_ci_env
echo "DBSYNC_REV=${{ inputs.dbsync_rev }}" >> .github_ci_env
echo "CLUSTER_ERA=${{ inputs.cluster_era }}" >> .github_ci_env
echo "TX_ERA=${{ inputs.tx_era }}" >> .github_ci_env
echo "MARKEXPR=${{ inputs.markexpr }}" >> .github_ci_env
echo "SCRIPTS_DIRNAME=${{ inputs.scripts_dirname }}" >> .github_ci_env
echo "CI_TOPOLOGY=${{ inputs.topology }}" >> .github_ci_env
echo "CI_BYRON_CLUSTER=${{ inputs.byron_cluster }}" >> .github_ci_env
echo "CI_TESTRUN_NAME=${{ inputs.testrun_name }}" >> .github_ci_env
echo "CI_SKIP_PASSED=${{ inputs.skip_passed }}" >> .github_ci_env
if [ -e "${{ inputs.env-path }}" ]; then cat "${{ inputs.env-path }}" >> .github_ci_env; fi
- name: Export env variables
run: |
cat .github_ci_env
cat .github_ci_env >> $GITHUB_ENV
echo "GITHUB_TOKEN=${{ secrets.GH_TOKEN }}" >> $GITHUB_ENV
- name: Get previous test results
if: inputs.testrun_name && inputs.skip_passed
run: |
if [ -n "${{ secrets.TCACHE_BASIC_AUTH }}" ] && [ -n "${{ secrets.TCACHE_URL }}" ]; then
testrun_name_strip="$(echo "${{ inputs.testrun_name }}" | sed 's/[^a-zA-Z0-9_-]//g')"
curl -s -u ${{ secrets.TCACHE_BASIC_AUTH }} "${{ secrets.TCACHE_URL }}/${testrun_name_strip}/pypassed" > deselected_tests.txt
echo "DESELECT_FROM_FILE=deselected_tests.txt" >> $GITHUB_ENV
fi
- name: Run CLI regression tests
id: testing-step
run: .github/regression.sh
- name: Report test results
if: (success() || failure()) && inputs.testrun_name
run: |
if [ -n "${{ secrets.TCACHE_BASIC_AUTH }}" ] && [ -n "${{ secrets.TCACHE_URL }}" ] && [ -e testrun-report.xml ]; then
testrun_name_strip="$(echo "${{ inputs.testrun_name }}" | sed 's/[^a-zA-Z0-9_-]//g')"
curl -s -X PUT --fail-with-body -u ${{ secrets.TCACHE_BASIC_AUTH }} "${{ secrets.TCACHE_URL }}/${testrun_name_strip}/${{ github.run_number }}/import" -F "[email protected]"
fi
- name: Upload testing artifacts on failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: testing-artifacts
path: testing_artifacts.tar.xz
- name: Upload Allure results
uses: actions/upload-artifact@v4
# When using `always()`, you lose ability to manually cancel the workflow.
# Use `success() || failure()` instead.
if: success() || failure()
with:
name: allure-results
path: allure-results.tar.xz
- name: Upload HTML report
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: testrun-report
path: testrun-report.html
- name: Upload testrun files
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: testrun-files
path: |
scheduling.log.xz
errors_all.log
testrun-report.xml
deselected_tests.txt
requirements_coverage.json
- name: Upload CLI coverage
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: cli-coverage
path: cli_coverage.json
- name: Mail failure report
uses: dawidd6/action-send-mail@v3
if: (success() || failure()) && steps.testing-step.outcome != 'success' && env.CI_FAIL_MAILS
with:
server_address: smtp.gmail.com
server_port: 465
secure: true
username: ${{secrets.GMAIL_USERNAME}}
password: ${{secrets.GMAIL_PASSWORD}}
subject: "Status: ${{ steps.testing-step.outcome }}; workflow: ${{ github.workflow }}"
to: ${{secrets.CI_FAIL_MAILS}}
from: Cardano Github Actions
body: "Run URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
reply_to: [email protected]
attachments: testrun-report.html