ci(ci): updates to repo secrets #14
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: Continous Integration | |
on: | |
pull_request: | |
branches: [ main ] | |
push: | |
branches: [ main ] | |
jobs: | |
pre-commit-checks: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Setup code repository | |
uses: actions/checkout@v4.2.1 | |
- | |
name: Setup Python | |
uses: actions/setup-python@v5.2.0 | |
with: | |
python-version: '3.9' | |
- | |
name: Run pre-commit | |
uses: pre-commit/action@v3.0.1 | |
tests: | |
needs: pre-commit-checks | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- | |
name: Setup code repository | |
uses: checkout@v4.2.1 | |
with: | |
fetch-depth: 1 | |
- | |
name: Setup uv | |
uses: astral-sh/setup-uv@v3 | |
- | |
name: Setup Python ${{ matrix.python-version }} | |
run: | | |
uv python install ${{ matrix.python-version }} | |
uv sync --all-extras --dev | |
- | |
name: Run tests | |
run: | | |
uv run cadc-get-cert --user ${{ secrets.CANFAR_USERNAME }} --password ${{ secrets.CANFAR_PASSWORD }} --days-valid 1 | |
uv run pytest tests --cov --cov-report=xml --junitxml=junit.xml -o junit_family=legacy | |
- | |
name: Upload coverage to Codecov | |
env: | |
CODECOV_TOKEN: ${{ env.CODECOV_TOKEN }} | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true # Fail the CI if an error occurs during the upload | |
token: ${{ env.CODECOV_TOKEN }} | |
flags: ${{ matrix.python-version }} | |
verbose: true # optional (default = false) | |
- | |
name: Upload test results to Codecov | |
if: ${{ !cancelled() }} | |
uses: codecov/test-results-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |