ci: Add Docker image publishing on ghcr #33
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: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
test: | |
if: >- | |
github.event.head_commit.author.email != 'auto@version' && | |
github.event.head_commit.committer.email != 'auto@version' | |
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} | |
runs-on: ${{ matrix.os }} | |
env: | |
DJANGO_SECRET_KEY: $RANDOM | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] #, windows-latest, macos-latest] | |
python-version: [ '3.10', '3.11', '3.12', '3.13' ] | |
django: [ '4.0', '4.1', '4.2', '5.0', '5.1' ] | |
exclude: | |
- python-version: '3.13' | |
django: '4.0' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }}, Django ${{ matrix.django }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
- name: Install Hatch | |
run: | | |
pip install --upgrade pip | |
pip install hatch | |
- name: Run Linter | |
run: hatch run lint:all | |
- name: Run tests | |
run: hatch run +py=${{ matrix.python-version }} +django=${{ matrix.django }} all:cov | |
- name: Combine | |
run: | | |
export COVERED_DISPLAY=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])") | |
echo "COVERED_DISPLAY=$COVERED_DISPLAY" >> $GITHUB_ENV | |
- name: Create the Badge | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.COVERAGE_TOKEN }} | |
gistID: dc6f561d32b4e4e6d6f05bfd59c4ffaf | |
filename: covbadge.json | |
label: coverage | |
message: ${{ env.COVERED_DISPLAY }}% | |
valColorRange: ${{ env.COVERED_DISPLAY }} | |
maxColorRange: 90 | |
minColorRange: 50 |