Guard against missing makefile and add build targets #3
Workflow file for this run
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
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 | |