-
-
Notifications
You must be signed in to change notification settings - Fork 580
168 lines (144 loc) · 5.85 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
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