Skip to content

Drops cron jobs from CI #123

Drops cron jobs from CI

Drops cron jobs from CI #123

Workflow file for this run

name: Test Package
on:
workflow_dispatch:
workflow_call:
push:
env:
DB_NAME: lmod_testing
DB_USER: testing
DB_PASS: postgres
jobs:
run-tests:
name: Run Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
services:
postgres:
image: postgres
env:
POSTGRES_DB: ${{ env.DB_NAME }}
POSTGRES_USER: ${{ env.DB_USER }}
POSTGRES_PASSWORD: ${{ env.DB_PASS }}
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: false
- name: Install dependencies
run: poetry install --with tests
- name: Run tests with coverage
run: |
poetry run coverage run -m unittest discover
poetry run coverage report --omit="tests/*","lmod_ingest/migrations/*"
poetry run coverage xml --omit="tests/*","lmod_ingest/migrations/*" -o coverage.xml
# Report partial coverage results to codacy for the current python version
- name: Report partial coverage results
if: github.event_name != 'release'
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report --partial -l Python -r coverage.xml
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
# Tell codacy we are done reporting test coverage
report-code-coverage:
name: Report Coverage
if: github.event_name != 'release'
needs: run-tests
runs-on: ubuntu-latest
steps:
- name: Finish reporting coverage
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) final
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
# Use this job for branch protection rules
report-test-status:
name: Report Test Status
if: always()
needs: run-tests
runs-on: ubuntu-latest
steps:
- name: Check build status
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1