Skip to content

Review and polish algorithms with missing information (#14) #309

Review and polish algorithms with missing information (#14)

Review and polish algorithms with missing information (#14) #309

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
tests:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Show Python version
run: python -V
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
- name: Pre-commit (lint + format + misc)
run: |
pre-commit run --all-files --show-diff-on-failure --color=always
- name: Run tests
run: python -m pytest -q
- name: Upload coverage.xml
if: always()
uses: actions/upload-artifact@v4
with:
# Use a unique artifact name per job to avoid 409 Conflict across matrix entries
name: coverage-xml-${{ matrix.os }}-py${{ matrix.python-version }}
path: coverage.xml
if-no-files-found: warn
retention-days: 7
docker-build-push:
name: Build & Push Docker Image
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
needs: tests
permissions:
contents: 'read'
env:
ACR_NAME: gabby
REGISTRY: gabby.azurecr.io
IMAGE_NAME: python-dsa
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Azure Login
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Login to Azure Container Registry
run: az acr login --name $ACR_NAME
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and Push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max