-
Notifications
You must be signed in to change notification settings - Fork 62
141 lines (124 loc) · 3.78 KB
/
lint-test.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
name: Lint and Test
on:
push:
branches:
- '**'
schedule:
- cron: "0 0 * * *"
jobs:
lint:
runs-on: ubuntu-latest
name: Lint
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/vendor
key: test-lint-dependencies-{{ checksum "composer.json" }}
restore-keys: test-lint-dependencies-{{ checksum "composer.json" }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- name: Install dependencies
run: composer install -n --prefer-dist
- name: Run PHP Lint
run: composer phpcs
validate-readme-spacing:
name: Validate README Spacing
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: pantheon-systems/validate-readme-spacing@v1
test-phpunit:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10.3
name: PHP Unit tests
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Start MySQL
run: |
sudo systemctl start mysql
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/vendor
key: test-phpunit-dependencies-{{ checksum "composer.json" }}
restore-keys: test-phpunit-dependencies-{{ checksum "composer.json" }}
- name: Install Extras
run: |
sudo apt-get update
sudo apt-get install subversion
- name: Run install-solr.sh
run: bash bin/install-solr.sh
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
coverage: none
- name: Install dependencies
run: composer install
- name: "Run Tests"
run: bash bin/phpunit-test.sh
test-behat:
needs:
- test-phpunit
- lint
runs-on: ubuntu-latest
container:
image: quay.io/pantheon-public/build-tools-ci:8.x-php7.4
options: --user root
env:
TERMINUS_TOKEN: ${{ secrets.TERMINUS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TERMINUS_ENV: ci-${{github.run_number}}
TERMINUS_SITE: solr-power
SITE_ENV: solr-power.ci-${{github.run_number}}
WORDPRESS_ADMIN_USERNAME: pantheon
WORDPRESS_ADMIN_EMAIL: [email protected]
WORDPRESS_ADMIN_PASSWORD: solr-power.ci-${{github.run_number}}
name: Behat tests
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SITE_OWNER_SSH_PRIVATE_KEY }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/vendor
key: test-behat-dependencies-{{ checksum "composer.json" }}
restore-keys: test-behat-dependencies-{{ checksum "composer.json" }}
- name: Check for $GITHUB_TOKEN
run: |
if [ -z "$GITHUB_TOKEN" ]; then
echo "GITHUB_TOKEN environment variables missing; assuming unauthenticated build"
exit 0
fi
echo "Setting GitHub OAuth token with suppressed ouput"
{
composer config -g github-oauth.github.com $GITHUB_TOKEN
} &> /dev/null
- name: Check for $TERMINUS_TOKEN
run: |
if [ -z "$TERMINUS_TOKEN" ]; then
echo "TERMINUS_TOKEN environment variables missing; assuming unauthenticated build"
exit 0
fi
terminus auth:login --machine-token=$TERMINUS_TOKEN
- name: Validate Fixture WordPress Version
run: ./bin/validate-fixture-version.sh
- name: Prepare for Behat tests
run: ./bin/behat-prepare.sh
- name: Execute Behat tests
run: ./bin/behat-test.sh --strict
- name: Clean up Behat tests
run: ./bin/behat-cleanup.sh