Skip to content

ci: execute tests before pushing image #47

ci: execute tests before pushing image

ci: execute tests before pushing image #47

Workflow file for this run

name: Multiarch build docker image
on:
push:
branches:
- 'main'
pull_request:
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE: ghcr.io/ronoaldo/minetestserver
jobs:
multiarch-build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- dockerfile: Dockerfile
args: |-
MINETEST_VERSION=master
MINETEST_GAME_VERSION=master
MINETEST_IRRLICHT_VERSION=master
tags: |-
5.8.0-dev
unstable
dev
platforms: |-
linux/amd64
linux/arm64
- dockerfile: Dockerfile
args: |-
MINETEST_VERSION=5.7.0
MINETEST_GAME_VERSION=5.7.0
MINETEST_IRRLICHT_VERSION=1.9.0mt10
tags: |-
stable
stable-5
platforms: |-
linux/amd64
linux/arm64
fail-fast: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract Minetest branch from Dockerfile/args
id: minetest-version
run: |
export MINETEST_VERSION="$(echo "${{ matrix.args }}" | grep MINETEST_VERSION | cut -f 2 -d=)"
echo "version=${MINETEST_VERSION}" >> $GITHUB_OUTPUT
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
tags: |
${{ steps.minetest-version.outputs.version }}
${{ matrix.tags }}
- name: Print calculated Docker tags
id: build-tags-check
shell: bash
run: |
echo "${{ steps.meta.outputs.tags }}"
- name: Run integration tests on Dockerfile
id: run-test-build
shell: bash
run: |
./test/integration-test.sh
- name: Set up QEMU for multiarch builds
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.dockerfile }}
build-args: ${{ matrix.args }}
platforms: ${{ matrix.platforms }}
push: ${{ github.ref_name == 'main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}