-
Notifications
You must be signed in to change notification settings - Fork 23
91 lines (75 loc) · 2.68 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
name: Run Integration Tests
on:
workflow_dispatch: null
push:
branches:
- main
- dev
jobs:
run-tests:
runs-on: ubuntu-latest
env:
EXIT_STATUS: 0
defaults:
run:
working-directory: .ansible/collections/ansible_collections/linode/cloud
steps:
- name: checkout repo
uses: actions/checkout@v3
with:
path: .ansible/collections/ansible_collections/linode/cloud
fetch-depth: 0
submodules: 'recursive'
- name: update packages
run: sudo apt-get update -y
- name: install make
run: sudo apt-get install -y build-essential
- name: setup python 3
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: install dependencies
run: make deps
- name: install ansible dependencies
run: ansible-galaxy collection install amazon.aws:==6.0.1
- name: install collection
run: make install
- name: replace existing keys
run: rm -rf ~/.ansible/test && mkdir -p ~/.ansible/test && ssh-keygen -m PEM -q -t rsa -N '' -f ~/.ansible/test/id_rsa
- name: run tests
run: |
if ! make testall > test_output.txt; then
echo "EXIT_STATUS=1" >> $GITHUB_ENV
fi
cat test_output.txt
env:
LINODE_API_TOKEN: ${{ secrets.DX_LINODE_TOKEN }}
ANSIBLE_CALLBACKS_ENABLED: "junit"
- name: Set release version env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Merge all test xmls in output directory
run: |
python tod_scripts/merge_ansible_results.py
- name: Add additional information to XML report
run: |
filename=$(ls | grep -E '^[0-9]{12}_ansible_merged\.xml$')
python tod_scripts/add_to_xml_test_report.py \
--branch_name "${{ env.RELEASE_VERSION }}" \
--gha_run_id "$GITHUB_RUN_ID" \
--gha_run_number "$GITHUB_RUN_NUMBER" \
--xmlfile "${filename}"
- name: Upload test results to the bucket
run: |
filename=$(ls | grep -E '^[0-9]{12}_ansible_merged\.xml$')
python3 tod_scripts/test_report_upload_script.py "${filename}"
env:
LINODE_CLI_OBJ_ACCESS_KEY: ${{ secrets.LINODE_CLI_OBJ_ACCESS_KEY }}
LINODE_CLI_OBJ_SECRET_KEY: ${{ secrets.LINODE_CLI_OBJ_SECRET_KEY }}
- name: Test Execution Status Handler
run: |
if [[ "$EXIT_STATUS" != 0 ]]; then
echo "Test execution contains failure(s), check Run Integration tests step above"
exit $EXIT_STATUS
else
echo "Tests passed!"
fi