Merge pull request #267 from CanDIG/bugfix/followup_naming #1097
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 | |
# Controls when the workflow will run | |
on: | |
# Allows you to call this workflow within another workflow | |
workflow_call: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Triggered based on the git event type | |
push: | |
branches: | |
- develop | |
- master | |
pull_request: | |
branches: | |
- develop | |
- master | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Add in environment variables for the entire "build" job | |
env: | |
POSTGRES_USER: admin_local | |
POSTGRES_PASSWORD: password_local | |
POSTGRES_HOST: localhost # default host value for the database | |
POSTGRES_DB: katsu_local | |
POSTGRES_PORT: 5432 | |
DJANGO_SECRET_KEY: test-key | |
services: | |
postgres_main: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: ${{ env.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
POSTGRES_DB: ${{ env.POSTGRES_DB }} | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
# If you want to test multiple python version(s) | |
strategy: | |
matrix: | |
python-version: ['3.10', '3.11', '3.12'] | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install requirements | |
run: pip install -r requirements/dev.txt | |
- name: Run Tests with Coverage | |
# Step specific environment variables | |
env: | |
DEBUG: "0" | |
DJANGO_SECRET_KEY: ${{ env.DJANGO_SECRET_KEY }} | |
DB_USERNAME: ${{ env.POSTGRES_USER }} | |
DB_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
DB_HOST: ${{ env.POSTGRES_HOST }} | |
DB_DATABASE: ${{ env.POSTGRES_DB }} | |
DB_PORT: ${{ env.POSTGRES_PORT }} | |
run: | | |
coverage run manage.py test chord_metadata_service/mohpackets | |
- uses: codecov/codecov-action@v3 | |
with: | |
name: codecov-umbrella | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
verbose: true |