-
Notifications
You must be signed in to change notification settings - Fork 8
157 lines (137 loc) · 5.09 KB
/
Copy pathchecks.yml
File metadata and controls
157 lines (137 loc) · 5.09 KB
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
name: CI Checks
on:
push:
branches:
- main
pull_request:
jobs:
formatting:
runs-on: ubuntu-22.04
# In order to trigger other workflows after committing formatting changes, we need
# to use the PR Automation App. This secret is not available for external
# contributors. So on PRs that can't acces the secret, we don't commit changes and instead just
# fail if the formatting changes are needed.
steps:
- name: Check if commits can be added
id: check_can_add_commit
run: |
echo "can_add_commit=${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY != '' && github.event_name == 'pull_request' }}" >> $GITHUB_OUTPUT
- name: Create GitHub App Token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
id: app-token
with:
app-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }}
private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }}
- name: Checkout
if: steps.check_can_add_commit.outputs.can_add_commit == 'true'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ steps.app-token.outputs.token }}
- name: Checkout
if: steps.check_can_add_commit.outputs.can_add_commit == 'false'
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install shfmt
run: sudo snap install --classic shfmt
- name: Format shell scripts
run: ./scripts/fmt-sh
- name: Prepare
uses: ./.github/actions/prepare
- name: Format ts
run: npm run format
- name: Check formatting changes
id: check_format
run: |
if git diff --exit-code; then
echo "formatting_needed=false" >> $GITHUB_OUTPUT
else
echo "formatting_needed=true" >> $GITHUB_OUTPUT
fi
- name: Commit Formatting changes
if: steps.check_can_add_commit.outputs.can_add_commit == 'true' && steps.check_format.outputs.formatting_needed == 'true'
uses: EndBug/add-and-commit@290ea2c423ad77ca9c62ae0f5b224379612c0321 # v10.0.0
with:
add: .
default_author: github_actions
message: "Updating formatting"
# do not pull: if this branch is behind, then we might as well let
# the pushing fail
pull_strategy: "NO-PULL"
- name: Fail for formatting issues without GitHub App
if: steps.check_can_add_commit.outputs.can_add_commit == 'false' && steps.check_format.outputs.formatting_needed == 'true'
run: |
echo "Formatting changes are needed but couldn't be committed because the GitHub App secret isn't available or this isn't a pull request."
exit 1
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Prepare
uses: ./.github/actions/prepare
- name: Build
run: npm run build
lint:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Prepare
uses: ./.github/actions/prepare
- name: Lint
run: npm run lint -- --max-warnings 0
check:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Prepare
uses: ./.github/actions/prepare
- name: Check
run: npm run check
test:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Prepare
uses: ./.github/actions/prepare
- name: Build
run: npm run build
- name: Test
run: npm run test
e2e:
runs-on: ubuntu-22.04
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Print chrome version
run: |
echo "google-chrome --version"
google-chrome --version
- name: Cache and restore samples
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
id: samples
with:
path: ./samples/
key: ${{ runner.os }}-samples-${{ hashFiles('**/scripts/download-samples.sh') }}
restore-keys: |
${{ runner.os }}-samples-
- name: Prepare
uses: ./.github/actions/prepare
- name: Run Playwright tests
run: npm run e2e:ci
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
if: failure()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
may-merge:
needs: ["formatting", "build", "lint", "check", "test", "e2e"]
runs-on: ubuntu-22.04
steps:
- name: Cleared for merging
run: echo OK