Merge pull request #157 from TimWolla/dependabot/github_actions/actio… #107
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: Build Docker Image | |
on: | |
- push | |
- pull_request | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
variant: | |
- "4" | |
- "4/fastcgi" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build the image. | |
id: build | |
run: | | |
printf "::group::Sending context\n" | |
IMAGE=adminer:${VARIANT/\//-}-$(date +%s) | |
docker build "$VARIANT" --tag "$IMAGE" |sed 's/^Step/::endgroup::\n::group::Step/' | |
printf "::endgroup::\n" | |
printf "::set-output name=%s::%s\n" "image" "$IMAGE" | |
printf "::set-output name=%s::%s\n" "version" "$(awk '/^ENV\s+ADMINER_VERSION/{print $3}' "$VARIANT/Dockerfile")" | |
env: | |
VARIANT: ${{ matrix.variant }} | |
- name: Smoketest | |
run: | | |
docker run --name $container_name -d ${{ steps.build.outputs.image }} | |
env: | |
container_name: adminer_smoke | |
- name: Verify a restart works. | |
if: ${{ ! contains(steps.build.outputs.image, 'fastcgi') }} | |
run: | | |
docker run --name $container_name -d ${{ steps.build.outputs.image }} | |
docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ | |
curl -fsSL http://$container_name:8080/ | |
docker restart $container_name | |
docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ | |
curl -fsSL http://$container_name:8080/ | |
env: | |
container_name: adminer_restart | |
- name: Verify version. | |
if: ${{ ! contains(steps.build.outputs.image, 'fastcgi') }} | |
run: | | |
docker run --name $container_name -d ${{ steps.build.outputs.image }} | |
docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ | |
curl -fsSL http://$container_name:8080/ \ | |
|grep '<span class=\"version\">'${{ steps.build.outputs.version }} | |
env: | |
container_name: adminer_version | |
- name: Verify that no warnings appear. | |
if: ${{ ! contains(steps.build.outputs.image, 'fastcgi') }} | |
run: | | |
docker run --name $container_name -d ${{ steps.build.outputs.image }} | |
! docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ | |
curl -fsSL http://$container_name:8080/ \ | |
|grep '<b>Warning</b>:' | |
env: | |
container_name: adminer_warnings | |
- name: Verify that the design works. | |
if: ${{ ! contains(steps.build.outputs.image, 'fastcgi') }} | |
run: | | |
docker run --name $container_name -d -e ADMINER_DESIGN=nette ${{ steps.build.outputs.image }} | |
docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ | |
curl -fsSL http://$container_name:8080/ \ | |
|grep 'adminer.css' | |
docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ | |
curl -fsSL http://$container_name:8080/adminer.css \ | |
|grep 'Nette' | |
env: | |
container_name: adminer_design | |
- name: Verify that the design works (Submodule). | |
if: ${{ ! contains(steps.build.outputs.image, 'fastcgi') }} | |
run: | | |
docker run --name $container_name -d -e ADMINER_DESIGN=hydra ${{ steps.build.outputs.image }} | |
docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ | |
curl -fsSL http://$container_name:8080/ \ | |
|grep 'adminer.css' | |
docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ | |
curl -fsSL http://$container_name:8080/adminer.css \ | |
|grep 'Hydra-Dark-Theme-for-Adminer' | |
env: | |
container_name: adminer_design2 | |
- name: Verify that the default server works. | |
if: ${{ ! contains(steps.build.outputs.image, 'fastcgi') }} | |
run: | | |
docker run --name $container_name -d -e ADMINER_DEFAULT_SERVER=ADMINER_DEFAULT_SERVER_WORKS ${{ steps.build.outputs.image }} | |
docker run -i --rm --link $container_name:$container_name buildpack-deps:curl \ | |
curl -fsSL http://$container_name:8080/ \ | |
|grep 'ADMINER_DEFAULT_SERVER_WORKS' | |
env: | |
container_name: adminer_defaultserver | |
- name: Show Containers and Images | |
run: | | |
printf "::group::docker ps -a\n" | |
docker ps -a | |
printf "::endgroup::\n" | |
printf "::group::docker images\n" | |
docker images | |
printf "::endgroup::\n" |