82 lines
1.8 KiB
YAML
82 lines
1.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- "v*"
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.13"
|
|
|
|
- name: Install ruff
|
|
run: pip install ruff==0.8.6
|
|
|
|
- name: Check formatting
|
|
run: ruff format --check .
|
|
|
|
- name: Check linting
|
|
run: ruff check .
|
|
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
needs: lint
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.13"
|
|
|
|
- name: Install dependencies
|
|
run: pip install -r requirements-dev.txt
|
|
|
|
- name: Run tests
|
|
run: pytest tests/ -v
|
|
|
|
build-push:
|
|
name: Build & Push
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
# Only build on pushes to main or version tags — not on PRs
|
|
if: github.event_name == 'push'
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ vars.REGISTRY }}/${{ gitea.repository_owner }}/nhlscoreboard
|
|
tags: |
|
|
type=semver,pattern={{version}}
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
|
|
- name: Log in to Gitea registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ vars.REGISTRY }}
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|