-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (177 loc) · 5.26 KB
/
main.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# SPDX-FileCopyrightText: 2024 Benedikt Franke <[email protected]>
# SPDX-FileCopyrightText: 2024 Florian Heinrich <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0
name: Main
on:
- push
- pull_request
jobs:
lint-code:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: bash ./dev install -e ".[all]"
- name: Start static code analysis
run: bash ./dev lint-code
lint-doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/hydrogen'
- name: Install dependencies
run: npm install markdownlint-cli2
- name: Start type checking
run: bash ./dev lint-doc
lint-scripts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Start shell script analysis tool
run: bash ./dev lint-scripts
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: bash ./dev install -e ".[all]"
- name: Start type checking
run: bash ./dev mypy
license-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: bash ./dev install -e ".[all]"
- name: Start license check
run: bash ./dev licenses
coverage:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: demo
POSTGRES_PASSWORD: example
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:latest
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: bash ./dev install -e ".[all]"
- name: Start coverage
env:
FL_POSTGRES_HOST: localhost
FL_POSTGRES_PORT: 5432
FL_POSTGRES_DBNAME: demo
FL_POSTGRES_USER: demo
FL_POSTGRES_PASSWD: example
FL_REDIS_HOST: localhost
run: bash ./dev coverage
build-and-push-docker-image:
needs: [lint-code, lint-doc, lint-scripts, mypy, coverage, license-check]
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
runs-on: ubuntu-latest
strategy:
matrix:
docker_target: ['celery', 'django']
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}-${{ matrix.docker_target }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
file: ./docker/${{ matrix.docker_target }}/Dockerfile
context: .
push: ${{ contains(github.ref, 'main') || startsWith(github.ref, 'refs/tags/v') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-pages:
needs: [lint-code, lint-doc, lint-scripts, mypy, coverage, license-check]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: bash ./dev install -e ".[all]"
- name: Build pages
run: bash ./dev doc-build
- name: Fix permissions
run: |
chmod -c -R +rX "site/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v2
with:
path: site
deploy-pages:
if: ${{ contains(github.ref, 'main') || startsWith(github.ref, 'refs/tags/v') }}
needs: [build-pages]
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3