-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (73 loc) · 2.03 KB
/
validate.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
---
name: validate
concurrency:
group: validate
cancel-in-progress: true
on:
push:
branches:
- '**'
- '!main'
permissions:
contents: read
jobs:
# This job detects which parts of the repo have been changed, setting future jobs up for conditional behavior.
detect-changes:
runs-on: ubuntu-latest
outputs:
docs: ${{ steps.check.outputs.docs }}
tb_pulumi: ${{ steps.check.outputs.tb_pulumi }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: check
with:
filters: |
tb_pulumi:
- 'tb_pulumi/**'
- 'pyproject.toml'
docs:
- 'tb_pulumi/**.py'
- 'docs/**'
# Run Ruff against tb_pulumi. Fail on format errors or failed sanity checks.
lint:
needs: detect-changes
runs-on: ubuntu-latest
if: needs.detect-changes.outputs.tb_pulumi == 'true'
steps:
- uses: actions/checkout@v4
- name: Run Ruff syntax checks
uses: chartboost/ruff-action@v1
with:
src: './tb_pulumi'
- name: Run Ruff linter
uses: chartboost/ruff-action@v1
with:
src: './tb_pulumi'
args: 'format --check'
# Attempt to build the documentation. Fail if there are errors or warnings.
build_docs:
needs: detect-changes
runs-on: ubuntu-latest
if: needs.detect-changes.outputs.docs == 'true'
steps:
- uses: actions/checkout@v4
- name: Install Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Build docs
shell: bash
run: |
# GHA does `set -e` for us, but we expect the grep below to fail. Thus, we must `set +e` here.
set +e
pip install .[dev]
cd docs
make clean html |& tee make.log
grep '\(ERROR\|WARNING\)' make.log
if [ $? -eq 0 ]; then
echo "Problems found in docs build"
exit 1
else
exit 0
fi