Skip to content

ci

ci #77

Workflow file for this run

name: ci
on:
push:
branches:
- '**'
tags:
- 'v*'
pull_request:
schedule:
- cron: "0 8 * * *"
permissions:
contents: write
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python_version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
- name: lint source code
run: make lint
- name: run unit tests
run: make test
- name: run bandit scan
run: make bandit
- name: measure cyclomatic complexity
run: make cc
publish-and-release:
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags')"
needs: test
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: publish package to pypi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: make publish
- name: create github release
uses: softprops/action-gh-release@v1
publish-docker-image:
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags')"
needs: publish-and-release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/thread-order
tags: |
type=raw,value=latest
type=ref,event=tag
flavor: |
latest=false
- name: Build & push (multi-arch)
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.deploy
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}