π Bump to Version: 0.11.11 (#83) #422
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: Test Build Push | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, ready_for_review, auto_merge_enabled] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: "${{ github.repository }}" | |
jobs: | |
QualitChecks: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
cache: poetry | |
python-version: 3.9 | |
- name: Install Poetry Package | |
run: poetry install --extras "codequality" | |
- name: Check poetry.lock | |
run: poetry lock --check | |
- name: Ensure Junit Dir | |
run: mkdir -p junit | |
- name: Pylint | |
run: poetry run pylint --version && poetry run pylint src addons | |
- name: Flake8 | |
run: poetry run flake8 --format junit-xml src addons > junit/flake8-python.xml | |
- name: Pytest | |
run: | | |
poetry run pytest src \ | |
--verbose \ | |
--exitfirst --failed-first \ | |
--junitxml=junit/pytest-results.xml \ | |
--cov=src --cov-report=xml | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
- name: Upload junit results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Lint-results-python | |
path: junit/*.xml | |
if: ${{ always() }} # Also run when steps before failed | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
name: Build image and push if on master | |
needs: QualitChecks | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push image if on master | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: "./docker/Dockerfile" | |
platforms: "linux/amd64" | |
cache-from: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main | |
push: ${{ github.ref == 'refs/heads/master' && 'true' || 'false' }} | |
build-args: | | |
SOURCE_CLONE_ARCHIVE=True | |
target: prod | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |