Skip to content

chore: project stuff, build config and ci (#1044) #642

chore: project stuff, build config and ci (#1044)

chore: project stuff, build config and ci (#1044) #642

Workflow file for this run

---
name: Stage
on:
workflow_dispatch:
push:
branches:
- dev
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
UV_PYTHON: "3.13"
jobs:
stage:
runs-on: ubuntu-latest
environment: staging
name: Build and publish early access to GitHub
permissions:
contents: read
packages: write
steps:
- name: Checkout sources
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Hadolint Dockerfile
id: hadolint
uses: hadolint/hadolint-action@2a66e89f53d0771bb131a7fa31f3136336094aa6 # v3.4.0
with:
dockerfile: Dockerfile
- name: Setup uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
enable-cache: true
- name: Install dependencies
run: uv sync --no-install-project --group dev --locked
- name: Test project
run: uv run --locked pytest -v --cov --cov-report=xml:coverage.xml
- name: Set up QEMU
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- name: Login to GHCR
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_PAT }}
- name: Get current date
id: getDate
run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
- name: Build images and push to GHCR
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
push: true
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
tags: ghcr.io/tomerfi/switcher_webapi:early-access
build-args: |
VCS_REF=${{ github.sha }}
BUILD_DATE=${{ steps.getDate.outputs.date }}
VERSION=early-access
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Push coverage report to CodeCov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
fail_ci_if_error: true