-
Notifications
You must be signed in to change notification settings - Fork 2
136 lines (116 loc) · 3.7 KB
/
tox.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
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