-
Notifications
You must be signed in to change notification settings - Fork 1
128 lines (105 loc) · 3.91 KB
/
ci.yaml
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
name: CI
on:
pull_request:
types: [opened, ready_for_review, synchronize]
push:
branches:
- main
workflow_dispatch:
jobs:
test:
name: Test
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- windows-2022
python-version: [ "3.10", "3.11" ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install Python and set up Poetry
uses: bakdata/ci-templates/actions/[email protected]
with:
poetry-version: "1.4.1" # REASON: https://github.com/python-poetry/poetry/issues/8180
python-version: ${{ matrix.python-version }}
- name: Check Poetry lock file consistency
run: poetry lock --check
- name: Install dependencies
run: poetry install --no-interaction
- name: Lint (ruff)
shell: bash
run: |
if [[ "$RUNNER_OS" == "Linux" && "${{ matrix.python-version }}" == "3.10" ]]
then
echo "::add-matcher::.github/ruff-matcher.json"
poetry run ruff check . --config pyproject.toml --output-format text --no-fix
else
poetry run pre-commit run ruff-lint --all-files --show-diff-on-failure
fi;
- name: Formatting (ruff)
run: poetry run pre-commit run ruff-format --all-files --show-diff-on-failure
- name: Typing (pyright)
run: poetry run pre-commit run pyright --all-files
- name: Generate schema (kpops schema)
run: poetry run pre-commit run gen-schema --all-files --show-diff-on-failure
- name: Generate CLI Usage docs (typer-cli)
run: poetry run pre-commit run gen-docs-cli --all-files --show-diff-on-failure
- name: Generate Environment variable docs
run: poetry run pre-commit run gen-docs-env-vars --all-files --show-diff-on-failure
- name: Generate pipeline definitions
run: poetry run pre-commit run gen-docs-components --all-files --show-diff-on-failure
- name: Test
run: poetry run pytest tests
- name: Install docs dependencies
run: poetry install --with docs
- name: Check markdown, toml, css formatting
uses: dprint/[email protected]
if: runner.os == 'Linux'
- name: Test docs build (mkdocs)
run: poetry run mkdocs build -f docs/mkdocs.yml
publish-snapshot-version:
name: Publish snapshot to TestPyPI
needs: [test]
uses: bakdata/ci-templates/.github/workflows/[email protected]
secrets:
pypi-token: ${{ secrets.TEST_PYPI_TOKEN }}
publish-docs-from-main:
runs-on: ubuntu-22.04
if: ${{ github.ref == 'refs/heads/main' }}
needs: [test]
steps:
- uses: actions/checkout@v3
- name: Publish docs from main branch
uses: ./.github/actions/update-docs
with:
username: ${{ secrets.GH_USERNAME }}
email: ${{ secrets.GH_EMAIL }}
token: ${{ secrets.GH_TOKEN }}
version: main
publish-dev-docs-from-pr:
runs-on: ubuntu-22.04
if: ${{ github.event_name == 'pull_request' }}
needs: [test]
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
# Checks to see if any files in the PR match one of the listed file types.
# This will return true if there's a file in docs folder that was added, deleted, or modified in the PR.
- name: Check if files in docs folder have changed
uses: dorny/paths-filter@v2
id: docs-changes
with:
filters: |
docs:
- added|deleted|modified: 'docs/**'
- name: Publish dev docs from PR
if: steps.docs-changes.outputs.docs == 'true'
uses: ./.github/actions/update-docs
with:
username: ${{ secrets.GH_USERNAME }}
email: ${{ secrets.GH_EMAIL }}
token: ${{ secrets.GH_TOKEN }}
version: dev