-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (73 loc) · 1.92 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: Blackout / Validate
on:
push:
pull_request:
jobs:
changes:
name: 👀 Source / Changed
runs-on: ubuntu-latest
outputs:
src: ${{ steps.changes.outputs.src }}
python: ${{ steps.changes.outputs.python }}
yaml: ${{ steps.changes.outputs.yaml }}
steps:
- name: ⬇️ Check out Repo
uses: actions/checkout@v4
- name: ⚙️ Check for changes
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
python:
- '**.py'
- 'requirements.txt'
yaml:
- '**.yaml'
- '**.yml'
python:
name: 🧹 Python Ruff
if: ${{ needs.changes.outputs.python == 'true' }}
needs:
- changes
runs-on: ubuntu-latest
steps:
- name: ⬇️ Check out Repo
uses: actions/checkout@v4
- name: 🐍 Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: 📦 Install requirements
run: python3 -m pip install -r .github/requirements.txt
- name: ⚙️ Lint
run: python3 -m ruff check .
- name: 💅 Format
run: python3 -m ruff format . --check
- name: 💅 Format Diff
if: failure()
run: python3 -m ruff format . --check --diff
yamllint:
name: 🧹 Yaml Lint
if: ${{ needs.changes.outputs.yaml == 'true' }}
needs:
- changes
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out Repo
uses: actions/checkout@v4
- name: 🚀 Run yamllint
run: yamllint --strict .
ci-status:
name: 🎭 Status
runs-on: ubuntu-latest
needs:
- python
- yamllint
if: always()
steps:
- name: 🎉 Success
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: ❌ Failure
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1