Merge pull request #85 from crazy-max/dependabot/github_actions/docke… #250
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
name: test | |
on: | |
push: | |
branches: | |
- 'master' | |
- 'releases/*' | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: | |
- 'master' | |
- 'releases/*' | |
paths-ignore: | |
- '**.md' | |
env: | |
BUILD_TAG: test | |
BASE_IMAGE: test-alpine-s6 | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- legacy-pureftpd | |
- legacy-rrdtool | |
alpine_version: | |
- '3.15' | |
- '3.16' | |
- '3.17' | |
- '3.18' | |
- '3.19' | |
- '3.20' | |
- 'edge' | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Prepare | |
run: | | |
echo "CONTAINER_NAME=${{ matrix.target }}" >> $GITHUB_ENV | |
echo "LOG_CHECK=$(cat ./test/${{ matrix.target }}/logcheck.txt)" >> $GITHUB_ENV | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver: docker | |
- | |
name: Build image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile | |
load: true | |
pull: true | |
tags: ${{ env.BASE_IMAGE }} | |
build-args: | | |
ALPINE_VERSION=${{ matrix.alpine_version }} | |
- | |
name: Build ${{ matrix.target }} | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./test/${{ matrix.target }} | |
build-args: | | |
BASE_IMAGE=${{ env.BASE_IMAGE }} | |
load: true | |
tags: ${{ env.BUILD_TAG }} | |
- | |
name: Start ${{ matrix.target }} | |
run: | | |
docker rm -f ${{ env.CONTAINER_NAME }} > /dev/null 2>&1 || true | |
docker run -d --name ${{ env.CONTAINER_NAME }} ${{ env.BUILD_TAG }} | |
- | |
name: Check container logs | |
uses: crazy-max/.github/.github/actions/container-logs-check@main | |
with: | |
container_name: ${{ env.CONTAINER_NAME }} | |
log_check: ${{ env.LOG_CHECK }} | |
timeout: 120 | |
- | |
name: Build dist | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: ./Dockerfile | |
load: true | |
pull: true | |
tags: ${{ env.BASE_IMAGE }}-dist | |
build-args: | | |
ALPINE_VERSION=${{ matrix.alpine_version }} | |
- | |
name: Check dist content | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./test | |
file: ./test/dist.Dockerfile | |
build-args: | | |
DIST_IMAGE=${{ env.BASE_IMAGE }}-dist | |
- | |
name: Container logs | |
if: always() | |
run: | | |
docker logs ${{ env.CONTAINER_NAME }} | |
docker rm -f ${{ env.CONTAINER_NAME }} > /dev/null 2>&1 || true |