-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
117 lines (112 loc) · 4.49 KB
/
action.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
name: 'Run TEAM Engine'
description: 'Spins up a TEAM Engine instance inside a docker container'
branding:
icon: 'award'
color: 'blue'
inputs:
test_suite_identifier:
description: 'Identifier of the Executable Test Suite (etscode) to be run. Example: ogcapi-features-1.0'
test_session_arguments:
description: >
Space-separated string with arguments that are to be sent for running the test session. example:
'iut=http://pygeoapi:5000'
teamengine_url:
required: false
description: >
URL for the teamengine instance to use for running the test suite. If not provided, this will spin up a docker
container using the [ogccite/teamengine-production:1.0-SNAPSHOT](https://hub.docker.com/r/ogccite/teamengine-production) image.
If you specify a custom teamengine URL you may also optonally supply authentication credentials by defining
them as secrets - Expected secret names are: `teamengine_username` and `teamengine_password`.
treat_skipped_tests_as_failures:
required: false
default: "false"
description: Whether to treat skipped tests as an indication of failure or not.
teamengine_username:
required: false
default: "ogctest"
description: Username for accessing teamengine
teamengine_password:
required: false
default: "ogctest"
description: Password for accessing teamengine
outputs:
results:
description: 'Test results'
value: '${{ steps.parse_execution_results.outputs.MARKDOWN_RESULT_OUTPUT_PATH }}'
runs:
using: 'composite'
steps:
- name: 'Add action path to the global path'
shell: bash
run: echo "${{ github.action_path }}" >> ${GITHUB_PATH}
- name: 'Set up Python'
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: 'Set up poetry'
uses: Gr1N/setup-poetry@v9
with:
poetry-version: '1.8.3'
- name: 'Set up cache'
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- name: 'install action code'
shell: 'bash'
run: |
cd ${{ github.action_path }}
poetry install
- name: 'Start TEAM engine container'
if: ${{ !inputs.teamengine_url }}
shell: 'bash'
run: >
docker run
--detach
--rm
--name teamengine
--network host
ogccite/teamengine-production:1.0-SNAPSHOT
- name: 'Run executable test suite'
id: 'run_executable_test_suite'
shell: bash
run: |
cd ${{ github.action_path }}
raw_result_output_path=raw-result.xml
poetry run ogc-cite-action \
execute-test-suite \
${{ inputs.teamengine_url || 'http://localhost:8080/teamengine' }} \
${{ inputs.test_suite_identifier }} \
--output-format=raw \
--teamengine-username=${{ inputs.teamengine_username }} \
--teamengine-password=${{ inputs.teamengine_password }} \
$(echo -e ${{ inputs.test_session_arguments }}) 1> ${raw_result_output_path}
echo "RAW_RESULT_OUTPUT_PATH=${{ github.action_path }}/${raw_result_output_path}" >> "${GITHUB_OUTPUT}"
- name: 'parse execution results'
id: 'parse_execution_results'
shell: bash
run: |
cd ${{ github.action_path }}
md_result_output_path=test-result.md
poetry run ogc-cite-action \
parse-result \
--output-format=markdown \
${{ fromJSON(inputs.treat_skipped_tests_as_failures) && '--treat-skipped-tests-as-failures' || '' }} \
${{ steps.run_executable_test_suite.outputs.RAW_RESULT_OUTPUT_PATH }} 1> ${md_result_output_path}
echo "MARKDOWN_RESULT_OUTPUT_PATH=${{ github.action_path }}/${md_result_output_path}" >> "${GITHUB_OUTPUT}"
- name: 'store execution results as artifacts'
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: 'execution-results-${{ inputs.test_suite_identifier }}'
path: |
${{ steps.run_executable_test_suite.outputs.RAW_RESULT_OUTPUT_PATH }}
${{ steps.parse_execution_results.outputs.MARKDOWN_RESULT_OUTPUT_PATH }}
- name: 'Display markdown execution results'
shell: bash
run: |
cat ${{ steps.parse_execution_results.outputs.MARKDOWN_RESULT_OUTPUT_PATH }} >> ${GITHUB_STEP_SUMMARY}
- name: 'Stop TEAM engine container'
if: ${{ !cancelled() && !inputs.teamengine_url }}
shell: 'bash'
run: docker stop teamengine