Enable CI #482
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
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 }} |