Tests #901
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: Tests | |
on: | |
pull_request: | |
paths: | |
- "go.*" | |
- "pkg/**" | |
- "cmd/**" | |
- "Makefile" | |
- "vendor/**" | |
- ".github/workflows/**" | |
push: | |
branches: [ master, main ] | |
schedule: | |
- cron: '01 00 * * *' | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
description: 'Run the build with tmate set "debug_enabled"' | |
type: boolean | |
required: false | |
default: false | |
defaults: | |
run: | |
shell: bash | |
env: | |
BUILDKIT_PROGRESS: plain | |
DOCKER_CLI_EXPERIMENTAL: enabled | |
DDEV_DEBUG: true | |
DDEV_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
permissions: | |
contents: read | |
jobs: | |
tests: | |
strategy: | |
matrix: | |
include: | |
- name: "apache-fpm" | |
webserver: "apache-fpm" | |
- name: "nginx-fpm" | |
webserver: "nginx-fpm" | |
- name: "mutagen" | |
mutagen: true | |
# - name: "no-bind-mounts" | |
# no-bind-mounts: "true" | |
- name: "nginx-proxy" | |
router: "nginx-proxy" | |
- name: "pull-push-test-platforms" | |
pull-push-test-platforms: true | |
- name: "race-detection" | |
race-detection: true | |
fail-fast: false | |
runs-on: ubuntu-22.04 | |
env: | |
CGO_ENABLED: 0 | |
DDEV_ACQUIA_SSH_KEY: ${{ secrets.DDEV_ACQUIA_SSH_KEY }} | |
DDEV_NONINTERACTIVE: "true" | |
DDEV_PANTHEON_SSH_KEY: ${{ secrets.DDEV_PANTHEON_SSH_KEY }} | |
DDEV_SKIP_NODEJS_TEST: "true" | |
GOTEST_SHORT: "12" # 12 is drupal10; means in TestFullSiteSetup we only use drupal10 | |
DDEV_TEST_WEBSERVER_TYPE: ${{ matrix.webserver }} | |
DDEV_TEST_USE_MUTAGEN: ${{ matrix.mutagen }} | |
DDEV_TEST_NO_BIND_MOUNTS: ${{ matrix.no-bind-mounts }} | |
DDEV_TEST_USE_NGINX_PROXY_ROUTER: ${{ matrix.nginx-proxy-router }} | |
MAKE_TARGET: "test" | |
TESTARGS: "-failfast" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "date=$(/bin/date -u "+%Y%V")" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: DDEV test cache | |
uses: actions/cache@v4 | |
if: github.ref == 'refs/heads/master' && matrix.name == 'pull-push-test-platforms' | |
with: | |
path: ~/.ddev/testcache/tarballs | |
key: ddev-test-cache-${{ steps.get-date.outputs.date }} | |
restore-keys: | | |
ddev-test-cache- | |
- name: DDEV test cache/restore | |
uses: actions/cache/restore@v4 | |
if: github.ref != 'refs/heads/master' || matrix.name != 'pull-push-test-platforms' | |
with: | |
path: ~/.ddev/testcache/tarballs | |
key: ddev-test-cache-${{ steps.get-date.outputs.date }} | |
restore-keys: | | |
ddev-test-cache- | |
- name: Set up Homebrew | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Remove unnecessary items on disk | |
run: sudo rm -rf /usr/local/lib/android && df -h . | |
- name: Install Docker and deps (Linux) | |
run: ./.github/workflows/linux-setup.sh | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '>=1.21' | |
- name: Override environment variables for push-pull-test-platforms | |
run: | | |
echo "MAKE_TARGET=test" >> $GITHUB_ENV | |
echo "TESTARGS=-failfast -run '(TestDdevFullSite.*|TestDdevImportFiles|TestDdevAllDatabases|TestComposerCreateCmd|Test.*(Push|Pull))'" >> $GITHUB_ENV | |
echo "GOTEST_SHORT=" >> $GITHUB_ENV | |
echo "DDEV_PLATFORM_API_TOKEN=${{ secrets.DDEV_PLATFORM_API_TOKEN }}" >> $GITHUB_ENV | |
echo "DDEV_UPSUN_API_TOKEN=${{ secrets.DDEV_UPSUN_API_TOKEN }}" >> $GITHUB_ENV | |
echo "DDEV_PANTHEON_API_TOKEN=${{ secrets.DDEV_PANTHEON_API_TOKEN }}" >> $GITHUB_ENV | |
echo "DDEV_ALLOW_ACQUIA_PUSH=${{ secrets.DDEV_ALLOW_ACQUIA_PUSH }}" >> $GITHUB_ENV | |
echo "DDEV_ACQUIA_API_KEY=${{ secrets.DDEV_ACQUIA_API_KEY }}" >> $GITHUB_ENV | |
echo "DDEV_ACQUIA_API_SECRET=${{ secrets.DDEV_ACQUIA_API_SECRET }}" >> $GITHUB_ENV | |
echo "DDEV_LAGOON_SSH_KEY=${{ secrets.DDEV_LAGOON_SSH_KEY }}" >> $GITHUB_ENV | |
if: ${{ matrix.pull-push-test-platforms }} | |
- name: Override environment variables for plain nginx | |
run: | | |
echo "DDEV_SKIP_NODEJS_TEST=false" >> $GITHUB_ENV | |
echo "TESTARGS=" >> $GITHUB_ENV | |
if: ${{ matrix.webserver == 'nginx-fpm' }} | |
- name: Override environment variables for race detection | |
run: | | |
echo "BUILDARGS=-race" >> $GITHUB_ENV | |
echo "TESTARGS=-failfast -race" >> $GITHUB_ENV | |
echo "CGO_ENABLED=1" >> $GITHUB_ENV | |
echo "DDEV_TEST_USE_MUTAGEN=true" >>$GITHUB_ENV | |
if: ${{ matrix.race-detection }} | |
- run: echo "BUILDARGS=${BUILDARGS} TESTARGS=${TESTARGS} CGO_ENABLED=${CGO_ENABLED} DDEV_TEST_USE_MUTAGEN=${DDEV_TEST_USE_MUTAGEN} DDEV_TEST_USE_NGINX_PROXY_ROUTER=${DDEV_TEST_USE_NGINX_PROXY_ROUTER} DDEV_TEST_WEBSERVER_TYPE=${DDEV_TEST_WEBSERVER_TYPE} DDEV_TEST_NO_BIND_MOUNTS=${DDEV_TEST_NO_BIND_MOUNTS} MAKE_TARGET=${MAKE_TARGET} TESTARGS=${TESTARGS} GOTEST_SHORT='${GOTEST_SHORT}'" | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
with: | |
limit-access-to-actor: true | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
- name: DDEV tests | |
run: | | |
make CGO_ENABLED="${CGO_ENABLED}" BUILDARGS="${BUILDARGS}" | |
cgo=$(.gotmp/bin/$(go env GOOS)_$(go env GOARCH)/ddev version 2>/dev/null | awk '/cgo_enabled/ { print $2 }') | |
if [ "${CGO_ENABLED}" != "${cgo}" ]; then | |
echo "CGO_ENABLED=${CGO_ENABLED} but built cgo=${cgo}" && exit 5 | |
fi | |
make CGO_ENABLED="${CGO_ENABLED}" BUILDARGS="${BUILDARGS}" TESTARGS="${TESTARGS}" ${MAKE_TARGET} | |
- name: Clean up Homebrew | |
continue-on-error: true | |
run: | | |
brew update | |
brew autoremove | |
brew cleanup |