Skip to content

Commit

Permalink
Add test pipeline, update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
adyanth committed Oct 18, 2024
1 parent 58f07d4 commit f3f7fa6
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 16 deletions.
28 changes: 12 additions & 16 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ on:
- '*'
tags:
- '*'
pull_request:
branches:
- '*'
permissions:
contents: read
packages: write
Expand All @@ -24,33 +21,32 @@ jobs:
steps:
# Get the repositery's code
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

uses: docker/setup-buildx-action@v3
# https://github.com/docker/login-action
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

# https://github.com/docker/metadata-action
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
Expand All @@ -64,18 +60,18 @@ jobs:
type=ref,event=tag
type=raw,value=latest,enable={{is_default_branch}}
type=sha
# https://github.com/docker/build-push-action
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

# https://github.com/peter-evans/dockerhub-description
- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Python Test

on:
workflow_dispatch:
push:
branches:
- '*'
pull_request:
branches:
- '*'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["pypy3.10", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Test
run: python -m pytest --junitxml=junit/test-results.xml --cov=main --cov-report=xml --cov-report=html
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ venv/
.vscode/
.pytest_cache/
__pycache__/
.coverage
coverage.xml
htlmcov/
junit/
.ruff_cache
.DS_Store
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pytest
pytest-cov
-r requirements.txt

0 comments on commit f3f7fa6

Please sign in to comment.