Skip to content

Merge branch 'jone-cicd' #2

Merge branch 'jone-cicd'

Merge branch 'jone-cicd' #2

Workflow file for this run

name: test
on: push
permissions:
contents: read
packages: write
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
COMPOSE: docker compose -f compose-test.yaml
jobs:
api:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# Build the images with BUILDKIT_INLINE_CACHE=1, so that we can
# reuse layers in a later step. This works in combination with
# cache_from (in the compose file), thus we do not need to pull here.
- name: build images
run: $COMPOSE build --build-arg BUILDKIT_INLINE_CACHE=1
- name: push cache
run: $COMPOSE push --ignore-push-failures
# Run linting steps
- name: flake8
run: $COMPOSE run --rm --no-deps --entrypoint '' api flake8
- name: isort
run: $COMPOSE run --rm --no-deps --entrypoint '' api isort --check-only --quiet --settings pyproject.toml .
if: always()
- name: black
run: $COMPOSE run --rm --no-deps --entrypoint '' api black --check .
if: always()
# Run tests
- name: pytest
run: $COMPOSE run --rm api pytest
- name: logs
if: always()
run: $COMPOSE logs