Main #231
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: "Main" | |
on: | |
push: | |
tags: ["*"] | |
branches: ["*"] | |
pull_request: | |
branches: ["*"] | |
schedule: | |
- cron: "25 12 * * 3" | |
workflow_dispatch: | |
permissions: {} | |
jobs: | |
build: | |
name: "Build on Python ${{ matrix.python_version }} on ${{ matrix.os }}" | |
runs-on: "${{ matrix.os }}" | |
permissions: | |
contents: "read" | |
strategy: | |
fail-fast: false | |
matrix: | |
python_version: ["3.x", "3.10", "pypy3.10"] | |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" | |
- name: "Use Python ${{ matrix.python_version }}" | |
uses: "actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b" | |
with: | |
python-version: "${{ matrix.python_version }}" | |
check-latest: true | |
cache: "pip" | |
cache-dependency-path: | | |
**/requirements.txt | |
**/requirements-dev.txt | |
- name: "Build" | |
run: "make all" | |
- name: "Verify that the working tree is clean" | |
shell: "bash" | |
run: '[ -z "$(git status --porcelain ./)" ] || { git diff >&2; exit 1; }' | |
build-push-docker: | |
name: "Build and push Docker images" | |
needs: ["build"] | |
runs-on: "ubuntu-latest" | |
permissions: | |
contents: "read" | |
packages: "write" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" | |
- name: "Set up QEMU" | |
uses: "docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf" | |
- name: "Set up Docker Buildx" | |
uses: "docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349" | |
- name: "Login to GitHub Container Registry" | |
if: "github.event_name != 'pull_request'" | |
uses: "docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567" | |
with: | |
registry: "ghcr.io" | |
username: "${{ github.actor }}" | |
password: "${{ secrets.GITHUB_TOKEN }}" | |
- name: "Extract metadata" | |
id: "meta" | |
uses: "docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96" | |
with: | |
images: | | |
ghcr.io/${{ github.repository }} | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern=v{{version}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
- name: "Build and push" | |
uses: "docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355" | |
with: | |
context: "./" | |
platforms: "linux/amd64,linux/arm64" | |
tags: "${{ steps.meta.outputs.tags }}" | |
labels: "${{ steps.meta.outputs.labels }}" | |
push: "${{ github.event_name != 'pull_request' }}" | |
publish-github-release: | |
name: "Publish GitHub release" | |
if: "startsWith(github.ref, 'refs/tags/v')" | |
needs: ["build", "build-push-docker"] | |
runs-on: "ubuntu-latest" | |
permissions: | |
contents: "write" | |
steps: | |
- name: "Publish" | |
uses: "hectorm/ghaction-release@066200d04c3549852afa243d631ea3dc93390f68" |