Skip to content

Remove CI image build hacks #879

Remove CI image build hacks

Remove CI image build hacks #879

Workflow file for this run

name: Gnocchi
on:
workflow_dispatch:
inputs:
debug:
description: 'Enable debug'
required: false
default: false
type: boolean
pull_request:
# NOTE(tobias-urdin): If you change any jobs make sure to modify
# the Mergify.io config in .mergify.yml to include the jobs!
jobs:
doc:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
env:
- docs
- docs-gnocchi-web
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: sudo chown -R 1001:1001 $GITHUB_WORKSPACE
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
ci_image:
- 'images/Dockerfile.ci'
- 'images/entrypoint.sh.ci'
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
if: steps.changes.outputs.ci_image == 'false'
- run: docker pull ghcr.io/gnocchixyz/ci:latest
if: steps.changes.outputs.ci_image == 'false'
- uses: docker/build-push-action@v2
with:
context: ./images
file: ./images/Dockerfile.ci
push: false
tags: ghcr.io/gnocchixyz/ci:latest
if: steps.changes.outputs.ci_image == 'true'
- name: Set env vars
run: |
if [ "${{ github.event.inputs.debug }}" == "true" ]; then
echo "DOCKER_ENV_OPTS=-e GNOCCHI_TEST_DEBUG=1" >> $GITHUB_ENV
else
echo "DOCKER_ENV_OPTS=" >> $GITHUB_ENV
fi
- name: Run tests with tox in container
run: docker run --rm -v ${{ github.workspace }}:/github/workspace -w /github/workspace $DOCKER_ENV_OPTS ghcr.io/gnocchixyz/ci:latest "tox -e ${{ matrix.env }}"
check:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
env:
- build
- pep8
steps:
- uses: actions/checkout@v4
- run: sudo chown -R 1001:1001 $GITHUB_WORKSPACE
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
ci_image:
- 'images/Dockerfile.ci'
- 'images/entrypoint.sh.ci'
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
if: steps.changes.outputs.ci_image == 'false'
- run: docker pull ghcr.io/gnocchixyz/ci:latest
if: steps.changes.outputs.ci_image == 'false'
- uses: docker/build-push-action@v2
with:
context: ./images
file: ./images/Dockerfile.ci
push: false
tags: ghcr.io/gnocchixyz/ci:latest
if: steps.changes.outputs.ci_image == 'true'
- name: Set env vars
run: |
if [ "${{ github.event.inputs.debug }}" == "true" ]; then
echo "DOCKER_ENV_OPTS=-e GNOCCHI_TEST_DEBUG=1" >> $GITHUB_ENV
else
echo "DOCKER_ENV_OPTS=" >> $GITHUB_ENV
fi
- name: Run tests with tox in container
run: docker run --rm -v ${{ github.workspace }}:/github/workspace -w /github/workspace $DOCKER_ENV_OPTS ghcr.io/gnocchixyz/ci:latest "tox -e ${{ matrix.env }}"
test:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
python:
- py39
- py311
- py312
env:
- mysql-ceph-upgrade-from-4.5
- postgresql-file-upgrade-from-4.5
- mysql-file
- mysql-file-sqlalchemy14
- mysql-swift
- mysql-s3
- mysql-ceph
- postgresql-file
- postgresql-file-sqlalchemy14
- postgresql-swift
- postgresql-s3
- postgresql-ceph
exclude:
- env: mysql-ceph-upgrade-from-4.5
python: py39
- env: mysql-ceph
python: py39
- env: postgresql-ceph
python: py39
- env: mysql-ceph-upgrade-from-4.5
python: py311
- env: mysql-ceph
python: py311
- env: postgresql-ceph
python: py311
# TODO(tobias-urdin): We need to fix below Ceph jobs
- env: mysql-ceph
python: py312
- env: postgresql-ceph
python: py312
steps:
- uses: actions/checkout@v4
- run: sudo chown -R 1001:1001 $GITHUB_WORKSPACE
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
ci_image:
- 'images/Dockerfile.ci'
- 'images/entrypoint.sh.ci'
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
if: steps.changes.outputs.ci_image == 'false'
- run: docker pull ghcr.io/gnocchixyz/ci:latest
if: steps.changes.outputs.ci_image == 'false'
- uses: docker/build-push-action@v2
with:
context: ./images
file: ./images/Dockerfile.ci
push: false
tags: ghcr.io/gnocchixyz/ci:latest
if: steps.changes.outputs.ci_image == 'true'
# NOTE(callumdickinson): SETUPTOOLS_USE_DISTUTILS needs to be set to 'stdlib'
# for Debian-packaged setuptools to work correctly on Python 3.9 and 3.11.
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1003252
- name: Set env vars
run: |
export DOCKER_ENV_OPTS=
if [ "${{ github.event.inputs.debug }}" == "true" ]; then
export DOCKER_ENV_OPTS="$DOCKER_ENV_OPTS -e GNOCCHI_TEST_DEBUG=1"
fi
if [ "${{ matrix.python }}" = "py39" -o "${{ matrix.python }}" = "py311" ]; then
export DOCKER_ENV_OPTS="$DOCKER_ENV_OPTS -e SETUPTOOLS_USE_DISTUTILS=stdlib"
fi
echo "DOCKER_ENV_OPTS=$DOCKER_ENV_OPTS" >> $GITHUB_ENV
- name: Run tests with tox in container
run: docker run --rm -v ${{ github.workspace }}:/github/workspace -w /github/workspace $DOCKER_ENV_OPTS ghcr.io/gnocchixyz/ci:latest "tox -e ${{ matrix.python }}-${{ matrix.env }}"