-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (118 loc) · 3.89 KB
/
workflow.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
name: Workflow
on:
push:
branches: [ main ]
tags:
- v**
pull_request: { }
jobs:
validate-renovate-config:
uses: BlindfoldedSurgery/renovate-config/.github/workflows/validate.yml@main
check-commits:
uses: BlindfoldedSurgery/actions-releases/.github/workflows/commitizen-check.yml@v2
lint:
strategy:
matrix:
python-version: [ "3.13", "3.12", "3.11" ]
uses: BlindfoldedSurgery/actions-python/.github/workflows/lint.yml@v2
with:
python-version: ${{ matrix.python-version }}
test:
strategy:
matrix:
python-version: [ "3.13", "3.12", "3.11" ]
uses: BlindfoldedSurgery/actions-python/.github/workflows/test.yml@v2
with:
python-version: ${{ matrix.python-version }}
submit-coverage: ${{ matrix.python-version == '3.11' }}
tests-selector: not local
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
test-migrations-postgres:
strategy:
matrix:
postgres-version: [ "14", "15", "16" ]
runs-on: ubuntu-latest
container: flyway/flyway:10.20
services:
postgres:
image: postgres:${{ matrix.postgres-version }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
steps:
- uses: actions/checkout@v4
- run: flyway migrate -skipCheckForUpdate
working-directory: migrations/postgres
env:
FLYWAY_URL: jdbc:postgresql://postgres:5432/postgres
FLYWAY_USER: postgres
FLYWAY_PASSWORD: postgres
test-migrations-sqlite:
runs-on: ubuntu-latest
container: flyway/flyway:10.20
steps:
- uses: actions/checkout@v4
- run: flyway migrate -skipCheckForUpdate
working-directory: migrations/sqlite
extract-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Install Poetry
run: pip install poetry==1.8.4
- name: Use Poetry to read version
id: extract
run: |
VERSION=$(poetry version --short)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
build-migrations-container-image:
needs:
- extract-version
- lint
- test
- test-migrations-postgres
- test-migrations-sqlite
strategy:
matrix:
sql-dialect: [ "postgres", "sqlite" ]
platform: [ "arm64", "amd64" ]
uses: preparingforexams/actions-container/.github/workflows/build-image-kaniko.yml@v3
with:
additional-build-args: |
DIALECT=${{ matrix.sql-dialect }}
context: 'migrations'
digest-artifact-name: digests-${{ matrix.sql-dialect }}
runner-name-build: ${{ (matrix.platform == 'arm64') && 'warp-ubuntu-latest-arm64-2x' || 'ubuntu-latest' }}
push-image: ${{ startsWith(github.ref, 'refs/tags/v') }}
image-name: rate-limiter-migrations-${{ matrix.sql-dialect }}
version: ${{ needs.extract-version.outputs.version }}
tag-suffix: -${{ matrix.platform }}
merge-migrations-container-image:
if: success() && startsWith(github.ref, 'refs/tags/v')
needs:
- extract-version
- build-migrations-container-image
strategy:
matrix:
sql-dialect: [ "postgres", "sqlite" ]
uses: BlindfoldedSurgery/actions-container/.github/workflows/merge-manifests.yml@v3
with:
image-name: rate-limiter-migrations-${{ matrix.sql-dialect }}
tag: ${{ needs.extract-version.outputs.version }}
variant-digests: digests-${{ matrix.sql-dialect }}
publish-package:
uses: BlindfoldedSurgery/actions-python/.github/workflows/publish-package.yml@v2
needs:
- lint
- test
- test-migrations-postgres
- test-migrations-sqlite
if: success() && startsWith(github.ref, 'refs/tags/v')
with:
python-version: '3.11'
pypi-username: ${{ vars.PYPI_USERNAME }}
secrets:
pypi-password: ${{ secrets.PYPI_PASSWORD }}