-
Notifications
You must be signed in to change notification settings - Fork 1
160 lines (130 loc) · 4.43 KB
/
pr-checks.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
name: PR Checks
on:
pull_request:
types: [opened, synchronize]
jobs:
php-lint-test:
name: "PHP: Lint, Test"
if: github.repository == 'wpsocio/wp-projects'
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
matrix:
php: ["7.4", "8.0", "8.1", "8.2", "8.3"]
steps:
- name: Checkout this repo
uses: actions/checkout@v4
with:
token: ${{ secrets.ACCESS_TOKEN_IR }}
- name: Remote refs
uses: ./actions/upstream-refs
id: remote-refs
- name: Checkout premium projects repo
uses: actions/checkout@v4
with:
path: premium
token: ${{ secrets.ACCESS_TOKEN_IR }}
repository: ${{ secrets.PREMIUM_PROJECTS_REPO }}
ref: ${{ fromJSON(steps.remote-refs.outputs.result).premium || 'main' }}
- name: Setup Environment
uses: ./actions/setup
with:
php-version: ${{ matrix.php }}
enable-wireit-cache: true
- name: Check syntax errors
env:
PNPM_FILTER: '--filter "./plugins/*" --filter "./premium/*/*"'
FIND_PATHS: ./plugins/*/src ./packages/php/*/src ./premium/*/*/src
FIND_IGNORE: '! -path "*/vendor/*" ! -path "*/node_modules/*"'
# For plugins, we need to check production dependencies as well
# So, let us install them in src/temp to avoid their exclusion inside vendor
run: |
pnpm -r --parallel ${{ env.PNPM_FILTER }} exec composer config vendor-dir src/temp
pnpm -r --parallel ${{ env.PNPM_FILTER }} exec composer install --no-dev
find ${{ env.FIND_PATHS }} ${{ env.FIND_IGNORE }} -type f -name '*.php' -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" )
- name: Setup PHP
run: "pnpm run setup:php"
- name: Lint
# Add premium/plugins/ to the lint path
run: "composer run lint -- premium/plugins/"
- name: Test
run: "pnpm run test:php"
if: matrix.php == '8.3'
js-lint-build:
name: "JS: Lint, Build and Test"
if: github.repository == 'wpsocio/wp-projects'
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@v4
with:
token: ${{ secrets.ACCESS_TOKEN_IR }}
- name: Remote refs
uses: ./actions/upstream-refs
id: remote-refs
- name: Checkout premium projects repo
uses: actions/checkout@v4
with:
path: premium
token: ${{ secrets.ACCESS_TOKEN_IR }}
repository: ${{ secrets.PREMIUM_PROJECTS_REPO }}
ref: ${{ fromJSON(steps.remote-refs.outputs.result).premium || 'main' }}
- name: Setup Environment
uses: ./actions/setup
with:
enable-wireit-cache: true
- name: Lint
run: "pnpm lint:js"
- name: Typecheck
run: pnpm typecheck
- name: Build
run: pnpm build
- name: Bundle
run: pnpm bundle:all
e2e:
name: "E2E Tests"
if: github.repository == 'wpsocio/wp-projects'
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@v4
with:
token: ${{ secrets.ACCESS_TOKEN_IR }}
- name: Remote refs
uses: ./actions/upstream-refs
id: remote-refs
- name: Checkout premium projects repo
uses: actions/checkout@v4
with:
path: premium
token: ${{ secrets.ACCESS_TOKEN_IR }}
repository: ${{ secrets.PREMIUM_PROJECTS_REPO }}
ref: ${{ fromJSON(steps.remote-refs.outputs.result).premium || 'main' }}
- name: Setup Environment
uses: ./actions/setup
with:
enable-wireit-cache: true
- name: Build
run: pnpm build
- name: Install Playwright dependencies
run: |
npx playwright install chromium firefox webkit --with-deps
- name: Start WordPress Environment
run: |
pnpm env-start
- name: Run tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: pnpm test:e2e
- name: Upload debug artifacts
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: failures-artifacts--${{ matrix.part }}
path: artifacts/test-results
if-no-files-found: ignore
- name: Stop WordPress Environment
run: |
pnpm env-stop