Skip to content

tests: Ignore gunittest.main.test() when collecting with pytest (#5317) #67

tests: Ignore gunittest.main.test() when collecting with pytest (#5317)

tests: Ignore gunittest.main.test() when collecting with pytest (#5317) #67

Workflow file for this run

---
name: Docker
# This workflow builds and pushes docker images to dockerhub
#
# Summary
#
# job docker-os-matrix:
# * creates tags <version>-alpine, <version>-debian and <version>-ubuntu for each release
# * creates tags <branch_name>-alpine, <branch_name>-debian and <branch_name>-ubuntu for all triggered branches
# * creates tags current-alpine, current-debian and current-ubuntu for releasebranch_8_3
# * creates tag latest for last stable release with ubuntu os
on:
push:
branches:
- main
- releasebranch_*
- "!releasebranch_7_*"
# tags: ['*.*.*']
paths-ignore: [doc/**]
pull_request:
paths:
- .github/workflows/docker.yml
- Dockerfile
- docker/**
- "!docker/**.md"
workflow_dispatch:
release:
types: [published]
permissions: {}
jobs:
# Run for push to configured branches and all published releases.
# Take care of different os.
# For main branch, created tags are:
# main-alpine, main-debian, main-ubuntu
# For releasebranch_8_3, created tags are:
# current-alpine, current-debian, current-ubuntu,
# releasebranch_8_3-alpine, releasebranch_8_3-debian, releasebranch_8_3-ubuntu
# For a release, e.g. 8.3.0, created tags are:
# 8.3.0-alpine, 8.3.0-debian, 8.3.0-ubuntu and latest (with ubuntu)
docker-os-matrix:
name: ${{ matrix.os }}
runs-on: ubuntu-latest
concurrency:
group: >-
${{ github.workflow }}-${{ matrix.os }}-${{ github.event_name }}-
${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
# Cancel in progress in pull requests.
# Otherwise, limit to one in progress and one queued for each type.
# Only the latest queued job per event type will be kept, older will be cancelled.
# The already running job will be completed.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
strategy:
matrix:
os:
- alpine
- debian
- ubuntu
- ubuntu_wxgui
fail-fast: false
permissions:
attestations: write
contents: read
id-token: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Get the latest tag and release branches
id: tag-branch
run: |
# Make sure tags are fetched
git fetch --tags
# Get sorted list of tags, keep the first that has a semver pattern (not RCs)
latest_tag="$(git tag --sort=-v:refname \
| grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' \
| head -n 1)"
latest_rel_branch="$(git branch --all --list 'origin/*' \
--contains "${latest_tag}" --format "%(refname:lstrip=3)")"
echo "latest_tag=${latest_tag}" >> "${GITHUB_OUTPUT}"
echo "latest_tag is: ${latest_tag}"
echo "latest_rel_branch=${latest_rel_branch}" >> "${GITHUB_OUTPUT}"
echo "latest_rel_branch is: ${latest_rel_branch}"
- name: Get enable values for meta step
id: enable
run: |
latest="${{
(github.ref || format('{0}{1}', 'refs/tags/', github.event.release.tag_name))
== format('refs/tags/{0}', steps.tag-branch.outputs.latest_tag)
&& matrix.os == 'ubuntu' }}"
current="${{
( contains(fromJSON('["tag", "release"]'), github.event_name)
&& (github.ref || format('{0}{1}', 'refs/tags/', github.event.release.tag_name))
== format('refs/tags/{0}', steps.tag-branch.outputs.latest_tag)
)
|| github.ref == format('refs/heads/{0}', steps.tag-branch.outputs.latest_rel_branch)
}}"
echo "latest=${latest}" >> "${GITHUB_OUTPUT}"
echo "latest is $latest"
echo "current=${current}" >> "${GITHUB_OUTPUT}"
echo "current is $current"
- name: Docker meta
id: meta
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
with:
images: |
name=docker.io/osgeo/grass-gis,enable=${{ github.repository_owner == 'OSGeo'
&& github.event_name != 'pull_request' }}
name=ghcr.io/${{ github.repository }}
tags: |
type=ref,event=tag
type=ref,event=branch
type=ref,event=pr
type=raw,value=current,enable=${{ steps.enable.outputs.current }}
type=raw,value=latest,enable=${{ steps.enable.outputs.latest }},suffix=
flavor: |
latest=false
suffix=-${{ matrix.os }}
- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
if: ${{ github.repository_owner == 'OSGeo' && github.event_name != 'pull_request' }}
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
with:
push: ${{ github.event_name != 'pull_request' }}
context: .
tags: ${{ steps.meta.outputs.tags }}
file: docker/${{ matrix.os }}/Dockerfile
annotations: ${{ steps.meta.outputs.annotations }}
provenance: mode=max
sbom: true
# Don't use cache for releases.
no-cache: ${{ contains(fromJSON('["tag", "release"]'), github.event_name) && true }}
# Don't use gha cache for releases. Cache is not used if `cache-from:` is empty
cache-from: >-
${{ !contains(fromJSON('["tag", "release"]'), github.event_name)
&& format('type=gha,scope={0}', matrix.os) || '' }}
cache-to: type=gha,mode=max,scope=${{ matrix.os }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Attest docker.io image
uses: actions/attest-build-provenance@bd77c077858b8d561b7a36cbe48ef4cc642ca39d # v2.2.2
# If there isn't a digest, an annotation cannot be added
if: >-
${{ github.repository_owner == 'OSGeo' && github.event_name != 'pull_request'
&& steps.docker_build.outputs.digest }}
id: attest
with:
subject-name: docker.io/osgeo/grass-gis
subject-digest: ${{ steps.docker_build.outputs.digest }}
push-to-registry: ${{ github.repository_owner == 'OSGeo' && github.event_name != 'pull_request' }}
- name: Attest ghcr.io image
uses: actions/attest-build-provenance@bd77c077858b8d561b7a36cbe48ef4cc642ca39d # v2.2.2
# If there isn't a digest, an annotation cannot be added
if: ${{ steps.docker_build.outputs.digest }}
id: attest-ghcr
with:
subject-name: ghcr.io/${{ github.repository }}
subject-digest: ${{ steps.docker_build.outputs.digest }}
push-to-registry: ${{ github.event_name != 'pull_request' }}