Merge pull request #27 from EBI-Metagenomics/Feature/Private-Data-Sur… #430
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: Testing | |
on: [push, pull_request] # yamllint disable-line rule:truthy | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
db: | |
image: postgres:16 | |
env: | |
POSTGRES_DB: test_emg | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- "5432:5432" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: actions/setup-python@v5 | |
- uses: pre-commit/[email protected] | |
- name: Build Docker image | |
run: | | |
docker build --target django -t app:latest . | |
- name: Check for unmigrated code | |
run: | | |
docker run --rm app:latest makemigrations --check | |
- name: Run tests | |
run: | | |
docker run -v ${{ github.workspace }}/coverage:/app/coverage \ | |
-v ${{ github.workspace }}/slurm-dev-environment/fs/nfs/public:/app/data \ | |
--entrypoint bash \ | |
--add-host=host.docker.internal:host-gateway \ | |
-e DATABASE_URL=postgres://postgres:[email protected]:5432/emg --rm app:latest -c pytest | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
files: coverage/coverage.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
# Debugging info: | |
# This workflow file also works offline, using https://github.com/nektos/act. | |
# Tested on Apple M series, with Colima. |