-
Notifications
You must be signed in to change notification settings - Fork 3
117 lines (101 loc) · 3.29 KB
/
ci.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
name: CI
on:
pull_request:
branches:
- main
paths:
- "**"
- "!.devcontainer/**"
- "!.github/**"
- "!infrastructure/.devcontainer/**"
- "!infrastructure/terragrunt/**"
env:
WPML_USER_ID: ${{ secrets.WPML_USER_ID }}
WPML_KEY: ${{ secrets.WPML_KEY }}
# WP_VERSION needs to match the version found in ~/wordpress/docker/Dockerfile
WP_VERSION: 6.7.1
jobs:
php-tests:
runs-on: ubuntu-latest
name: PHP Pest tests
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
- name: Add Composer auth credentials
run: |
cd wordpress
composer config github-oauth.github.com ${{ secrets.COMPOSER_GITHUB_TOKEN }}
composer config http-basic.my.yoast.com token ${{ secrets.COMPOSER_YOAST_TOKEN }}
- run: cd wordpress && composer install --prefer-dist --no-progress --no-suggest
- run: cd wordpress && composer check-platform-reqs
- run: cd wordpress && ./vendor/bin/pest
gc-lists-php-tests:
runs-on: ubuntu-latest
name: GC Lists PHPUnit Tests
env:
DB_DATABASE: wordpress_test
DB_USER: root
DB_PASSWORD: root
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
- name: Set up MySQL
run: |
sudo /etc/init.d/mysql start
- name: Setup test environment
run: |
export PATH="$HOME/.composer/vendor/bin:$PATH"
cd wordpress/wp-content/plugins/gc-lists
bash bin/install-wp-tests.sh wordpress_test root 'root' localhost $WP_VERSION
composer install
composer check-platform-reqs
- name: Run the tests
run: |
cd wordpress/wp-content/plugins/gc-lists
./vendor/bin/pest --coverage
cds-wpml-mods-php-tests:
runs-on: ubuntu-latest
name: CDS Wpml Mods Plugin PHPUnit Tests
env:
DB_DATABASE: wordpress_test
DB_USER: root
DB_PASSWORD: root
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
- name: Set up MySQL
run: |
sudo /etc/init.d/mysql start
- name: Setup test environment
run: |
export PATH="$HOME/.composer/vendor/bin:$PATH"
cd wordpress/wp-content/plugins/cds-wpml-mods
bash bin/install-wp-tests.sh wordpress_test root 'root' localhost $WP_VERSION
composer install
composer check-platform-reqs
- name: Run the tests
run: |
cd wordpress/wp-content/plugins/cds-wpml-mods
./vendor/bin/pest --coverage
phpcs:
runs-on: ubuntu-latest
name: Code quality
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: phpcs, cs2pr
- name: Run PHP Code Sniffer
run: phpcs wordpress -n --standard=PSR12 --ignore=vendor,tests,*.css,*.js