-
-
Notifications
You must be signed in to change notification settings - Fork 264
130 lines (130 loc) · 5.22 KB
/
tests-php.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
name: 'Codeception Tests'
on:
pull_request:
paths:
- 'classes/**.php'
- 'components/**.php'
- 'includes/**.php'
- 'src/**.php'
- 'sql/**.php'
- 'tests/codeception/**'
- 'ui/**.php'
- '*.php'
- 'composer.json'
- 'codeception.*.yml'
- '.github/workflows/tests-php.yml'
jobs:
test:
strategy:
fail-fast: false
matrix:
suite:
- wpunit --skip-group=pods-shortcode
- wpunit --group=pods-shortcode
- wpunit-traversal
- restv1
runs-on: ubuntu-latest
steps:
# ------------------------------------------------------------------------------
# Checkout the repo
# ------------------------------------------------------------------------------
- name: Checkout the repository
uses: actions/checkout@v3
with:
fetch-depth: 1000
submodules: recursive
# ------------------------------------------------------------------------------
# Set up PHP to run slic
# ------------------------------------------------------------------------------
- name: Configure PHP environment
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
# ------------------------------------------------------------------------------
# Checkout slic
# ------------------------------------------------------------------------------
- name: Checkout slic
uses: actions/checkout@v3
with:
repository: stellarwp/slic
ref: main
path: slic
fetch-depth: 1
# ------------------------------------------------------------------------------
# Prepare our composer cache directory
# ------------------------------------------------------------------------------
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
# ------------------------------------------------------------------------------
# Initialize slic
# ------------------------------------------------------------------------------
- name: Set up slic env vars
run: |
echo "SLIC_BIN=${GITHUB_WORKSPACE}/slic/slic" >> $GITHUB_ENV
echo "SLIC_WP_DIR=${GITHUB_WORKSPACE}/slic/_wordpress" >> $GITHUB_ENV
echo "SLIC_WORDPRESS_DOCKERFILE=Dockerfile.base" >> $GITHUB_ENV
- name: Set run context for slic
run: echo "SLIC=1" >> $GITHUB_ENV && echo "CI=1" >> $GITHUB_ENV
- name: Start ssh-agent
run: |
mkdir -p "${HOME}/.ssh";
ssh-agent -a /tmp/ssh_agent.sock;
- name: Export SSH_AUTH_SOCK env var
run: echo "SSH_AUTH_SOCK=/tmp/ssh_agent.sock" >> $GITHUB_ENV
- name: Set up slic for CI
run: |
cd ${GITHUB_WORKSPACE}/..
${SLIC_BIN} here
${SLIC_BIN} interactive off
${SLIC_BIN} build-prompt off
${SLIC_BIN} build-subdir off
${SLIC_BIN} xdebug off
${SLIC_BIN} composer-cache set /home/runner/.cache/composer
${SLIC_BIN} debug on
${SLIC_BIN} info
${SLIC_BIN} config
# ------------------------------------------------------------------------------
# Set up Pods
# ------------------------------------------------------------------------------
- name: Set up pods
run: |
docker network prune -f
${SLIC_BIN} use ${GITHUB_REPOSITORY#*/}
${SLIC_BIN} composer set-version 2
${SLIC_BIN} composer install
# ------------------------------------------------------------------------------
# Init WordPress container
# ------------------------------------------------------------------------------
- name: Init the WordPress container
run: |
${SLIC_BIN} up wordpress
${SLIC_BIN} site-cli core version
# ------------------------------------------------------------------------------
# Install and activate TwentyTwenty
# ------------------------------------------------------------------------------
- name: Install and activate TwentyTwenty
if: ${{ matrix.suite == 'acceptance' }}
run: ${SLIC_BIN} site-cli theme install twentytwenty --activate
# ------------------------------------------------------------------------------
# Run tests
# ------------------------------------------------------------------------------
- name: Run suite tests
run: ${SLIC_BIN} run ${{ matrix.suite }} --ext DotReporter
# ------------------------------------------------------------------------------
# Upload artifacts (On failure)
# ------------------------------------------------------------------------------
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: output ${{ matrix.suite }}
path: tests/_output/
retention-days: 7