Frontent: Initial #9
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: 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: start elasticsearch | |
run: $COMPOSE up -d elasticsearch | |
- 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: wait a bit for elasticsearch to start | |
run: sleep 5 | |
- name: pytest | |
run: $COMPOSE run --rm api pytest | |
- name: logs | |
if: always() | |
run: $COMPOSE logs |