Skip to content

Automated integration test images builds #4

Automated integration test images builds

Automated integration test images builds #4

on:
push:
pull_request:
jobs:
test-containers:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.filter.outputs.container }}
changed_files: ${{ steps.filter.outputs.container_files }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
list-files: shell
filters: |
container:
- integration-tests/container/**
rebuild-containers:
needs: test-containers
if: ${{ needs.test-containers.outputs.changed == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [amd64, ppc64le, s390x]
steps:
- 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: Get changed containers
run: |
dirs=$(dirname ${{ needs.test-containers.outputs.changed_files }} | sort | uniq )
echo "CONTAINER_DIRS='$dirs'" >> "$GITHUB_ENV"
- name: Build containers
run: |
for dir in $CONTAINER_DIRS; do
if [[ -f "integration-tests/container/$dir/Makefile" ]]; then
make -C "integration-tests/container/$dir" build
fi
done
env:
PLATFORM: linux/${{ matrix.arch }}
IMAGE_SUFFIX: ${{ matrix.arch }}
- name: Push containers
if: github.event_name == 'push'
run: |
for dir in $CONTAINER_DIRS; do
if [[ -f "integration-tests/container/$dir/Makefile" ]]; then
make -C "integration-tests/container/$dir" push
fi
done
env:
PLATFORM: linux/${{ matrix.arch }}
IMAGE_SUFFIX: ${{ matrix.arch }}
push-manifest:
runs-on: ubuntu-latest
needs:
- rebuild-containers
- test-containers
if: needs.test-containers.outputs.changed == 'true' && github.event_name == 'push'
steps:
- uses: actions/checkout@v3
- name: Get changed containers
run: |
dirs=$(dirname ${{ needs.test-containers.outputs.changed_files }} | sort | uniq )
echo "CONTAINER_DIRS='$dirs'" >> "$GITHUB_ENV"
- name: Make manifests
run: |
for dir in $CONTAINER_DIRS; do
if [[ -f "integration-tests/container/$dir/Makefile" ]]; then
make -C "integration-tests/container/$dir" build
fi
done