-
Notifications
You must be signed in to change notification settings - Fork 7
203 lines (173 loc) · 7.47 KB
/
test-action-build-html.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
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
---
name: test - action/build-html
on:
push:
branches: [main]
paths:
- .test/**
- .github/workflows/test-action-build-html.yml
- actions/ansible-docs-build-html/**
pull_request:
paths:
- .test/**
- .github/workflows/test-action-build-html.yml
- actions/ansible-docs-build-html/**
# Run once per week (Tuesday at 04:00 UTC)
schedule:
- cron: '0 4 * * 2'
jobs:
tests:
name: Simple tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Simple 1 invoke - no copy, no artifact
id: simple1
uses: ./actions/ansible-docs-build-html
with:
build-script: .test/simple-build/build.sh
build-html: .test/simple-build/build/html
artifact-upload: false
- name: Simple 1 - Download artifacts
uses: actions/download-artifact@v4
id: simple1-artifact
with:
path: .artifacts/simple1
- name: Simple 1 - assert
shell: python
run: |
expected_hash = r'${{ hashFiles('.test/simple-build/src') }}'
output_hash = r'${{ steps.simple1.outputs.hash }}'
output_build_html = r'${{ steps.simple1.outputs.build-html }}'
artifact_hash = r'${{ hashFiles(steps.simple1-artifact.outputs.download-path) }}'
assert output_build_html == '.test/simple-build/build/html'
assert output_hash == expected_hash
assert artifact_hash != output_hash
- name: Simple 2 invoke - with copy, no artifact
id: simple2
uses: ./actions/ansible-docs-build-html
with:
build-script: .test/simple-build/build.sh
build-html: .test/simple-build/build/html
copy-build: .copies/simple2/html
artifact-upload: false
- name: Simple 2 - Download artifacts
uses: actions/download-artifact@v4
id: simple2-artifact
with:
path: .artifacts/simple2
- name: Simple 2 - assert
shell: python
run: |
expected_hash = r'${{ hashFiles('.test/simple-build/src') }}'
output_hash = r'${{ steps.simple2.outputs.hash }}'
output_build_html = r'${{ steps.simple2.outputs.build-html }}'
artifact_hash = r'${{ hashFiles(steps.simple2-artifact.outputs.download-path) }}'
original_build_hash = r'${{ hashFiles('.test/simple-build/build/html') }}'
assert output_build_html == '.copies/simple2/html'
assert output_hash == expected_hash
assert output_hash == original_build_hash
assert artifact_hash != output_hash
- name: Simple 3 invoke - no copy, with artifact
id: simple3
uses: ./actions/ansible-docs-build-html
with:
build-script: .test/simple-build/build.sh
build-html: .test/simple-build/build/html
artifact-retention-days: 1
artifact-name: tests-simple3
- name: Simple 3 - Download artifacts
uses: actions/download-artifact@v4
id: simple3-artifact
with:
name: ${{ steps.simple3.outputs.artifact-name }}
path: .artifacts/simple3
- name: Simple 3 - assert
shell: python
run: |
expected_hash = r'${{ hashFiles('.test/simple-build/src') }}'
output_hash = r'${{ steps.simple3.outputs.hash }}'
output_build_html = r'${{ steps.simple3.outputs.build-html }}'
artifact_hash = r'${{ hashFiles(steps.simple3-artifact.outputs.download-path) }}'
assert output_build_html == '.test/simple-build/build/html'
assert output_hash == expected_hash
assert artifact_hash == output_hash
- name: Simple 3 - bash asserts
run: |
set -eu
# this URL only goes to the run page, not to an individual artifact
# so all we're really checking here is that it's a valid URL that's accessible
wget '${{ steps.simple3.outputs.artifact-url }}'
# ensure that the html directory is not present in the downloaded artifact
test ! -d "${{ steps.simple3-artifact.outputs.download-path }}/html"
- name: Simple 4 invoke - with copy, with artifact
id: simple4
uses: ./actions/ansible-docs-build-html
with:
build-script: .test/simple-build/build.sh
build-html: .test/simple-build/build/html
copy-build: .copies/simple4/html
artifact-retention-days: 1
artifact-name: tests-simple4
- name: Simple 4 - Download artifacts
uses: actions/download-artifact@v4
id: simple4-artifact
with:
name: ${{ steps.simple4.outputs.artifact-name }}
path: .artifacts/simple4
- name: Simple 4 - assert
shell: python
run: |
expected_hash = r'${{ hashFiles('.test/simple-build/src') }}'
output_hash = r'${{ steps.simple4.outputs.hash }}'
output_build_html = r'${{ steps.simple4.outputs.build-html }}'
artifact_hash = r'${{ hashFiles(steps.simple4-artifact.outputs.download-path) }}'
original_build_hash = r'${{ hashFiles('.test/simple-build/build/html') }}'
assert output_build_html == '.copies/simple4/html'
assert output_hash == expected_hash
assert output_hash == original_build_hash
assert artifact_hash == output_hash
- name: Simple 4 - bash asserts
run: |
set -eu
# this URL only goes to the run page, not to an individual artifact
# so all we're really checking here is that it's a valid URL that's accessible
wget '${{ steps.simple4.outputs.artifact-url }}'
# ensure that the html directory is not present in the downloaded artifact
test ! -d "${{ steps.simple4-artifact.outputs.download-path }}/html"
- name: Simple 5 invoke - with copy, with artifact, trailing slash in input
id: simple5
uses: ./actions/ansible-docs-build-html
with:
build-script: .test/simple-build/build.sh
build-html: .test/simple-build/build/html/
copy-build: .copies/simple5/html/
artifact-retention-days: 1
artifact-name: tests-simple5
- name: Simple 5 - Download artifacts
uses: actions/download-artifact@v4
id: simple5-artifact
with:
name: ${{ steps.simple5.outputs.artifact-name }}
path: .artifacts/simple5
- name: Simple 5 - assert
shell: python
run: |
expected_hash = r'${{ hashFiles('.test/simple-build/src') }}'
output_hash = r'${{ steps.simple5.outputs.hash }}'
output_build_html = r'${{ steps.simple5.outputs.build-html }}'
artifact_hash = r'${{ hashFiles(steps.simple5-artifact.outputs.download-path) }}'
original_build_hash = r'${{ hashFiles('.test/simple-build/build/html/') }}'
assert output_build_html == '.copies/simple5/html/'
assert output_hash == expected_hash
assert output_hash == original_build_hash
assert artifact_hash == output_hash
- name: Simple 5 - bash asserts
run: |
set -eu
# this URL only goes to the run page, not to an individual artifact
# so all we're really checking here is that it's a valid URL that's accessible
wget '${{ steps.simple5.outputs.artifact-url }}'
# ensure that the html directory is not present in the downloaded artifact
test ! -d "${{ steps.simple5-artifact.outputs.download-path }}/html"