Skip to content

Container tests

Container tests #3331

name: Container tests
defaults:
run:
shell: bash
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Only run when something changes in the actual containers
paths:
- "containers/**"
- ".github/workflows/**"
schedule:
- cron: '01 00 * * *'
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate set "debug_enabled"'
type: boolean
required: false
default: false
testargs:
description: Add specific test to run like -run TestEnvironmentVariables or -run "(TestDdevFullSite.*|Test.*Pull)"
required: false
default: ""
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DDEV_IGNORE_EXPIRING_KEYS: "false"
# Unfortunately, we can't test forked PRs with the secret that's provided for this
# So it has to be hard-wired here. Needs to be switched back to "90" after mysql
# key is updated, see https://github.com/docker-library/mysql/issues/801
DDEV_MAX_DAYS_BEFORE_CERT_EXPIRATION: "90"
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: read
jobs:
container-build-and-test:
name: ${{ matrix.os }} - Test container ${{ matrix.containers }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
containers: [dbserver, webserver, others]
steps:
- uses: actions/checkout@v4
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: true
github-token: ${{ secrets.GITHUB_TOKEN }}
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- name: Install Docker and deps (Linux)
if: matrix.os == 'ubuntu-22.04'
run: ./.github/workflows/linux-setup.sh
- uses: actions/setup-go@v5
with:
go-version: '>=1.21'
- name: Build and test container ${{ matrix.containers }}
run: |
source ~/.bashrc
docker version
mkcert --version
set -eu -o pipefail
if [[ "${{ matrix.containers }}" == "dbserver" ]]; then
pushd containers/ddev-dbserver
echo "--- Test container dbserver"
time make test DOCKER_ARGS="--no-cache"
popd
elif [[ "${{ matrix.containers }}" == "webserver" ]]; then
pushd containers/ddev-webserver
echo "--- Test container ddev-webserver"
time make test DOCKER_ARGS="--no-cache"
popd
elif [[ "${{ matrix.containers }}" == "others" ]]; then
for dir in ddev-nginx-proxy-router ddev-ssh-agent ddev-traefik-router test-ssh-server
do pushd containers/$dir
echo "--- Test container $dir"
time make test DOCKER_ARGS=--no-cache
popd
done
fi
set +eu