-
Notifications
You must be signed in to change notification settings - Fork 1
187 lines (161 loc) · 5.12 KB
/
schedule.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
name: schedule testing
on:
workflow_dispatch:
workflow_call:
secrets:
SOURCE_TREE_PROTECTED_BRANCH_TOKEN:
required: true
SAUCE_ACCESS_KEY:
required: true
schedule:
- cron: "0 2 * * 3,6"
permissions:
actions: write
contents: write
id-token: write
env:
TEST_URL: https://test-integration-example.fly.dev
jobs:
static_and_unit_test:
name: Static test and unit test
if: github.event.action != 'closed'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: latest
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Lint test
run: npm run ci-lint
- name: Unit test
run: npm run ci-test
- uses: actions/upload-artifact@v4
with:
name: lint-output
path: lint.log
- uses: actions/upload-artifact@v4
with:
name: unit-test-output
path: ./reporters
# functional_test:
# name: Functional test
# runs-on: ubuntu-latest
# env:
# SAUCE_USERNAME: sky172839465
# SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-java@v4
# with:
# distribution: "temurin"
# java-version: "17"
# - name: Cache node_modules
# id: cache-node-modules
# uses: actions/cache@v4
# with:
# path: node_modules
# key: node-modules-${{ hashFiles('package-lock.json') }}
# - name: Install dependencies
# run: npm ci
# - name: Run functional test on saucelabs
# env:
# TEST_URL: ${{ env.TEST_URL }}
# run: |
# echo TEST_URL=$TEST_URL
# npm run ci-functional
# - name: Generate functional test allure report
# run: npm run functional:generate-report
# - uses: actions/upload-artifact@v4
# with:
# name: functional-test-output
# path: ./output
# - name: Upload report to GitHub page
# if: ${{ always() }}
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./e2e-reports
# destination_dir: ${{ github.run_id }}
# commit_message: "docs: 🤖 upload schedule report ${{ github.run_id }}"
# user_name: "github-actions[bot]"
# user_email: "github-actions[bot]@users.noreply.github.com"
clean_up:
needs: [static_and_unit_test]
if: ${{ always() }}
name: Clean up
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
run: npm ci
- uses: actions/download-artifact@v4
with:
name: lint-output
- uses: actions/download-artifact@v4
with:
name: unit-test-output
path: ./reports
# - uses: actions/download-artifact@v4
# with:
# name: functional-test-output
# path: ./output
- name: Get report info
if: ${{ always() }}
uses: actions/github-script@v7
with:
script: |
const { getGHPageInfo } = require('./scripts/ghpage-helper.cjs')
const info = await getGHPageInfo({ context }, '${{ github.run_id }}')
console.log(info)
core.exportVariable('GH_PAGE_URL', info.ghPage)
- id: get-date
run: |
echo "DATE=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
- name: Get build comment
if: ${{ always() }}
uses: actions/github-script@v7
env:
TEST_URL: ${{ env.TEST_URL }}
DATE: ${{ steps.get-date.outputs.DATE }}
with:
script: |
const getComment = require('./scripts/get-comment.cjs')
const comment = await getComment({ context })
console.log(comment)
core.exportVariable('BUILD_COMMENT', comment)
result-encoding: string
- name: Comment build result to issue
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.SOURCE_TREE_PROTECTED_BRANCH_TOKEN }}
comment-id: 1890858131
body: ${{ env.BUILD_COMMENT }}
edit-mode: replace
- name: Add job summary
if: ${{ always() }}
run: |
echo "${{ env.BUILD_COMMENT }}" >> $GITHUB_STEP_SUMMARY
- name: Last check build status
if: ${{ always() }}
uses: actions/github-script@v7
with:
script: |
if (process.env.BUILD_COMMENT.includes('❌')) {
console.error('Job failed.')
process.exit(1)
}