-
Notifications
You must be signed in to change notification settings - Fork 4
157 lines (130 loc) · 4.02 KB
/
ci.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
name: CI
on:
push:
branches: [main]
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
pull_request:
branches: [main]
jobs:
backend:
name: Backend
runs-on: ubuntu-latest
env:
working-directory: ./backend
poetry-version: "1.3.2"
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
defaults:
run:
working-directory: ${{ env.working-directory }}
steps:
- uses: actions/checkout@v3
- name: Install packages
run: sudo apt-get -y install python3-dev graphviz libgraphviz-dev pkg-config python3-wheel
- name: Set up Poetry
uses: bakdata/ci-templates/actions/python-setup-poetry@v1.5.3
with:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ env.poetry-version }}
working-directory: ${{ env.working-directory }}
- name: Install dependencies
run: poetry install --no-interaction
- name: Lint (flake8)
run: poetry run pre-commit run flake8 --all-files --show-diff-on-failure
- name: Order of imports (isort)
run: poetry run pre-commit run isort --all-files --show-diff-on-failure
- name: Formatting (black)
run: poetry run pre-commit run black --all-files --show-diff-on-failure
- name: Typing (mypy)
run: poetry run pre-commit run mypy --all-files
- name: Test
run: poetry run pytest tests --cov=streams_explorer --cov-report term-missing
frontend:
name: Frontend
runs-on: ubuntu-latest
env:
working-directory: ./frontend
strategy:
fail-fast: false
matrix:
node-version: ["16"]
defaults:
run:
working-directory: ${{ env.working-directory }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: ${{ env.working-directory }}/package-lock.json
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Install pre-commit
run: pipx install pre-commit
- name: Formatting (dprint)
run: pre-commit run dprint --all-files
- name: Fetchers
run: pre-commit run generate-fetchers --all-files
- name: Run Tests
run: npm run test:ci
docker:
name: Docker
needs: [backend, frontend]
runs-on: ubuntu-latest
env:
image: bakdata/streams-explorer
steps:
- name: Configure Docker
env:
DOCKER_CLI_EXPERIMENTAL: enabled
uses: crazy-max/ghaction-setup-docker@v2
with:
version: v24.0.6
daemon-config: |
{
"features": {
"containerd-snapshotter": true
}
}
- name: Setup Qemu
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ inputs.platforms }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.image }}
tags: |
event=pr,type=sha
event=push,type=sha
event=tag,type=semver,pattern=v{{version}}
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & Push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
publish:
name: Publish
needs: [docker]
if: startsWith(github.ref, 'refs/tags/v') # only publish tags
uses: ./.github/workflows/publish.yml
secrets:
pypi-token: ${{ secrets.PYPI_TOKEN }}
test-pypi-token: ${{ secrets.TEST_PYPI_TOKEN }}