-
Notifications
You must be signed in to change notification settings - Fork 9
111 lines (92 loc) 路 3.63 KB
/
build.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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build
on:
pull_request:
push:
branches:
- main
- next
- alpha
- beta
jobs:
build:
name: Build + Test + Release / Node ${{ matrix.node }} / playwright@${{ matrix.playwright }}
runs-on: ubuntu-latest
strategy:
matrix:
node: ['14', '16', '18']
# TODO: technically we still support down to 1.12 but `locator.waitFor`
# was introduced in 1.16 so anything earlier blows up type-checking.
# This minimum will be bumped in the next breaking release that will be
# entirely built around the `Locator` APIs, so update this then.
playwright: ['1.16.0', 'latest']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Update to npm 7
run: npm i -g npm@7 --registry=https://registry.npmjs.org
- uses: actions/cache@v3.2.6
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm install
- name: Install specific Playwright version
run: |
npm install playwright@${{ matrix.playwright }}
npm install @playwright/test@${{ matrix.playwright }}
- name: Check types
run: npm run test:types
- name: Run lint + tests
if: ${{ matrix.playwright == 'latest' }}
run: |
npm why playwright
npm why @playwright/test
npm run test
- name: Run lint + tests
if: ${{ matrix.playwright != 'latest' }}
run: |
npm why playwright
npm why @playwright/test
npm run test:legacy
# Only release on Node 16
- name: Upload Coverage / Release / Playwright
run: npm run ci-after-success
if: ${{ matrix.node == '14' && matrix.playwright == 'latest' }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set flag as to whether we released
id: did-release
run: echo "::set-output name=released::$(node ./playwright-test/check-package.js)"
- name: Setup NPM authentication for second publish
if: ${{ matrix.node == '14' && matrix.playwright == 'latest' && steps.did-release.outputs.released == 'true' }}
run: |
cat > .npmrc <<EOF
registry=https://registry.npmjs.org/
@playwright-testing-library:registry=https://registry.npmjs.org/
//registry.npmjs.org/:_authToken=$NPM_TOKEN
always-auth=true
unsafe-perm=true
EOF
env:
NPM_TOKEN: ${{ secrets.PLAYWRIGHT_TESTING_LIBRARY_TOKEN }}
- name: Set branch name
id: branch
run: echo ::set-output name=branch::${GITHUB_REF#refs/*/}
- name: Release / Playwright Test (latest)
if: ${{ matrix.node == '16' && matrix.playwright == 'latest' && steps.did-release.outputs.released == 'true' && steps.branch.outputs.branch == 'main' }}
run: |
npm run prepare:playwright-test
npm publish --access=public
- name: Release / Playwright Test (pre-release)
if: ${{ matrix.node == '16' && matrix.playwright == 'latest' && steps.did-release.outputs.released == 'true' && steps.branch.outputs.branch != 'main' }}
run: |
npm run prepare:playwright-test
npm publish --access=public --tag=${{ steps.branch.outputs.branch }}