-
Notifications
You must be signed in to change notification settings - Fork 19
120 lines (120 loc) · 4.87 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
name: 'Codeception Tests'
on:
pull_request:
paths:
- '*/**.php'
- 'tests/**'
- '*.php'
- 'composer.json'
- 'codeception.*.yml'
- '.github/workflows/tests-php.yml'
jobs:
test:
strategy:
fail-fast: false
matrix:
suite:
- acceptance
- wpunit
runs-on: ubuntu-latest
steps:
# ------------------------------------------------------------------------------
# Checkout the repo and tric
# ------------------------------------------------------------------------------
- name: Checkout the repository
uses: actions/checkout@v2
with:
fetch-depth: 1
token: ${{ secrets.GITHUB_TOKEN }}
submodules: recursive
- name: Checkout tric
uses: actions/checkout@v2
with:
repository: the-events-calendar/tric
ref: main
path: tric
fetch-depth: 1
# ------------------------------------------------------------------------------
# Prepare our composer cache directory
# ------------------------------------------------------------------------------
- name: Get Composer Cache Directory
id: get-composer-cache-dir
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v2
id: composer-cache
with:
path: ${{ steps.get-composer-cache-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
# ------------------------------------------------------------------------------
# Initialize tric
# ------------------------------------------------------------------------------
- name: Set up tric env vars
run: |
echo "TRIC_BIN=${GITHUB_WORKSPACE}/tric/tric" >> $GITHUB_ENV
echo "TRIC_WP_DIR=${GITHUB_WORKSPACE}/tric/_wordpress" >> $GITHUB_ENV
echo "TRIC_WORDPRESS_DOCKERFILE=Dockerfile.base" >> $GITHUB_ENV
- name: Set run context for tric
run: echo "TRIC=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 tric for CI
run: |
cd ${GITHUB_WORKSPACE}/..
${TRIC_BIN} here
${TRIC_BIN} interactive off
${TRIC_BIN} build-prompt off
${TRIC_BIN} build-subdir off
${TRIC_BIN} xdebug off
${TRIC_BIN} composer-cache set /home/runner/.cache/composer
${TRIC_BIN} debug on
${TRIC_BIN} info
${TRIC_BIN} config
# ------------------------------------------------------------------------------
# Start the Chrome container
# ------------------------------------------------------------------------------
- name: Start the Chrome container
if: ${{ matrix.suite == 'acceptance' }}
run: ${TRIC_BIN} up chrome
# ------------------------------------------------------------------------------
# Set up plugin
# ------------------------------------------------------------------------------
- name: Set up plugin
run: |
docker network prune -f
${TRIC_BIN} use paid-memberships-pro
${TRIC_BIN} composer install
# ------------------------------------------------------------------------------
# Init WordPress container
# ------------------------------------------------------------------------------
- name: Init the WordPress container
run: |
${TRIC_BIN} up wordpress
${TRIC_BIN} site-cli core version
# ------------------------------------------------------------------------------
# Install and activate TwentyTwenty
# ------------------------------------------------------------------------------
- name: Install and activate TwentyTwenty
if: ${{ matrix.suite == 'acceptance' }}
run: ${TRIC_BIN} site-cli theme install twentytwenty --activate
# ------------------------------------------------------------------------------
# Run tests
# ------------------------------------------------------------------------------
- name: Run suite tests
run: ${TRIC_BIN} run ${{ matrix.suite }} --ext DotReporter
# ------------------------------------------------------------------------------
# Upload artifacts (On failure)
# ------------------------------------------------------------------------------
- name: Upload artifacts
uses: actions/upload-artifact@v2
if: failure()
with:
name: output ${{ matrix.suite }}
path: tests/_output/
retention-days: 7