Skip to content

Automated integration test images builds #13

Automated integration test images builds

Automated integration test images builds #13

name: Build Integration Test Containers
on:
push:
branches:
- master
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: Set environment
run: |
dirs=$(dirname ${{ needs.test-containers.outputs.changed_files }} | sort | uniq )
{
echo "CONTAINER_DIRS<<EOS"
echo "$dirs"
echo "EOS"
} >> "$GITHUB_ENV"
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "COLLECTOR_QA_TAG=$(echo "${GITHUB_SHA}" | cut -c1-8)" >> "$GITHUB_ENV"
fi
- name: Login to quay.io/rhacs-eng
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}
password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}
- name: Build containers
run: |
for dir in $CONTAINER_DIRS; do
if [[ -f "$dir/Makefile" ]]; then
make -C "$dir" build
fi
done
env:
PLATFORM: linux/${{ matrix.arch }}
- name: Push containers
run: |
for dir in $CONTAINER_DIRS; do
if [[ -f "$dir/Makefile" ]]; then
make -C "$dir" push
fi
done
env:
PLATFORM: linux/${{ matrix.arch }}
push-manifest:
runs-on: ubuntu-latest
needs:
- rebuild-containers
- test-containers
if: needs.test-containers.outputs.changed == 'true'
steps:
- uses: actions/checkout@v3
- name: Get changed containers
run: |
dirs=$(dirname ${{ needs.test-containers.outputs.changed_files }} | sort | uniq )
{
echo "CONTAINER_DIRS<<EOS"
echo "$dirs"
echo "EOS"
} >> "$GITHUB_ENV"
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "COLLECTOR_QA_TAG=$(echo "${GITHUB_SHA}" | cut -c1-8)" >> "$GITHUB_ENV"
fi
- name: Login to quay.io/rhacs-eng
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}
password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}
- name: Make manifests
run: |
for dir in $CONTAINER_DIRS; do
if [[ -f "$dir/Makefile" ]]; then
make -C "$dir" manifest
fi
done