Tidy up #17
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: Tests | |
on: push | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
- uses: pre-commit/[email protected] | |
pytest-suite: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up docker caching | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-docker-${{ hashFiles('Dockerfile', '**/compose*yaml', '.docker/*', 'pyproject.toml', 'environment.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-docker- | |
- name: Build the stack | |
run: | | |
docker buildx build --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache,mode=max --build-arg BUILDKIT_INLINE_CACHE=1 . | |
docker-compose up -d | |
env: | |
DOCKER_BUILDKIT: 1 | |
- name: Wait for services to be ready | |
run: sleep 10 # Adjust time as needed for your services | |
- name: Run pytest | |
run: docker-compose run --entrypoint '/bin/bash -lc' app pytest tests | |
- name: Tear down the stack | |
if: always() | |
run: docker-compose down |