tox #553
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: tox | |
on: | |
create: | |
tags: | |
- "**" | |
push: | |
branches: # any integration branch but not tag | |
- "main" | |
pull_request: | |
branches: | |
- "main" | |
schedule: | |
- cron: 1 0 * * * # Run daily at 0:01 UTC | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: ${{ matrix.tox_env }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- tox_env: lint | |
python-version: '3.10' | |
- tox_env: py10-ansible_6 | |
python-version: '3.10' | |
- tox_env: py310-ansible_7 | |
python-version: '3.10' | |
- tox_env: py311-ansible_8 | |
python-version: '3.11' | |
- tox_env: py312-ansible_8 | |
python-version: '3.12' | |
- tox_env: py311-ansible_9 | |
python-version: '3.11' | |
- tox_env: py312-ansible_9 | |
python-version: '3.12' | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Update packages index | |
run: | | |
sudo apt-get update | |
- name: Install a default Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip | |
pip install tox | |
- name: Run tox -e ${{ matrix.tox_env }} | |
run: | | |
echo "${{ matrix.PREFIX }} tox -e ${{ matrix.tox_env }}" | |
tox -e ${{ matrix.tox_env }} 2> debug.log | |
# grep -v -i exception debug.log >/dev/null | |
- name: Upload artifact asciidoc | |
uses: actions/upload-artifact@main | |
with: | |
name: adoc-${{ matrix.tox_env }} | |
path: .caradoc | |
- name: Upload artifact debug | |
uses: actions/upload-artifact@main | |
with: | |
name: debug-${{ matrix.tox_env }} | |
path: debug.log | |
deploy_demo: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/main' | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Download artifact of one build to create a demo site | |
uses: actions/download-artifact@v3 | |
with: | |
name: adoc-py310-ansible_7 | |
path: .caradoc | |
- name: Build html doc via asciidoctor | |
id: adocbuild | |
uses: tonynv/asciidoctor-action@master | |
with: | |
program: | | |
cd .caradoc/* | |
asciidoctor '**/*.adoc' -r asciidoctor-kroki -a kroki-server-url=https://kroki.io -a source-file-scheme=https:// -a last-update-label="Ansible report by <a href='https://github.com/jseguillon/caradoc'>Caradoc</a> - " | |
- name: Add index.html redirect, rewrite src path and add favico | |
run: | | |
target_dir="$(ls -d .caradoc/*/)" | |
cp ${GITHUB_WORKSPACE}/docs/favicon.ico $target_dir | |
taget_dir_relpath="$(basename $target_dir)" | |
cat <<EOF > .caradoc/index.html | |
<html> | |
<head> | |
<meta http-equiv="refresh" content="0; url=${taget_dir_relpath}/README.html" />a | |
</head> | |
</html> | |
EOF | |
find .caradoc/ -type f -exec sed -i 's#\(/home/runner/work/caradoc/caradoc/\)\([^:]*\):\([^:]*\)#github.com/jseguillon/caradoc/blob/main/\2\#L\3#g' {} \; | |
- name: Upload artifact for pages | |
uses: actions/upload-pages-artifact@main | |
with: | |
name: github-pages | |
path: .caradoc | |
- name: Deploy | |
id: deployment | |
uses: actions/deploy-pages@v1 | |