test - action/build-html #87
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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@v3 | |
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@v3 | |
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@v3 | |
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@v3 | |
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@v3 | |
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" |