forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (180 loc) · 5.93 KB
/
test.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
188
name: test
on:
push:
branches-ignore:
- 'dependabot/**'
paths:
- 'test/**'
- 'lib/**'
- '!**/maintainer.js'
- '!**/radar.js'
- '!**/radar-rules.js'
- 'package.json'
- 'pnpm-lock.yaml'
- '.github/workflows/test.yml'
pull_request: ~
permissions:
contents: read
jobs:
jest:
runs-on: ubuntu-latest
timeout-minutes: 10
services:
redis:
image: redis
ports:
- 6379/tcp
options: --entrypoint redis-server
strategy:
fail-fast: false
matrix:
node-version: [ 18, 20 ]
name: Jest on Node ${{ matrix.node-version }}
steps:
- name: Collect Workflow Telemetry
uses: runforesight/foresight-workflow-kit-action@v1
if: success() || failure()
with:
api_key: ${{ secrets.FORESIGHT_KEY }}
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies (pnpm)
run: pnpm i
- name: Run postinstall script for dependencies
run: pnpm rb
- name: Test all and generate coverage
run: pnpm run jest:coverage
env:
REDIS_URL: redis://localhost:${{ job.services.redis.ports[6379] }}/
- name: Upload coverage to Codecov
if: ${{ matrix.node-version == '18' }}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos as documented, but seems broken
- name: Analyze Test and/or Coverage Results
uses: runforesight/foresight-test-kit-action@v1
if: success() || failure()
with:
api_key: ${{ secrets.FORESIGHT_KEY }}
test_format: JUNIT
test_framework: JEST
test_path: ./coverage/junit.xml
coverage_format: LCOV/TXT
coverage_path: ./coverage/lcov.info
puppeteer:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
node-version: [ 18, 20 ]
chromium:
- name: bundled Chromium
dependency: ''
environment: '{}'
- name: Chromium from Ubuntu
dependency: chromium-browser
environment: '{ "CHROMIUM_EXECUTABLE_PATH": "chromium-browser" }'
- name: Chrome from Google
dependency: google-chrome-stable
environment: '{ "CHROMIUM_EXECUTABLE_PATH": "google-chrome-stable" }'
name: Jest puppeteer on Node ${{ matrix.node-version }} with ${{ matrix.chromium.name }}
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies (pnpm)
run: pnpm i
- name: Run postinstall script for dependencies
run: pnpm rb
- name: Install Chromium
if: ${{ matrix.chromium.dependency != '' }}
# 'chromium-browser' from Ubuntu APT repo is a dummy package. Its version (85.0.4183.83) means
# nothing since it calls Snap (disgusting!) to install Chromium, which should be up-to-date.
# That's not really a problem since the Chromium-bundled Docker image is based on Debian bullseye,
# which provides up-to-date native packages.
run: |
set -ex
curl -s "https://dl.google.com/linux/linux_signing_key.pub" | gpg --dearmor |
sudo tee /etc/apt/trusted.gpg.d/google-chrome.gpg > /dev/null
echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" |
sudo tee /etc/apt/sources.list.d/google-chrome.list > /dev/null
sudo apt-get update
sudo apt-get install -yq --no-install-recommends ${{ matrix.chromium.dependency }}
- name: Test puppeteer
run: pnpm run jest puppeteer
env: ${{ fromJSON(matrix.chromium.environment) }}
docs:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
node-version: [ 18, 20 ]
defaults:
run:
working-directory: docs
name: Build docs on Node ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
cache-dependency-path: docs/pnpm-lock.yaml
- run: pnpm i
- name: Set environment variable for Node v16 above
if: ${{ matrix.node-version > '16' }}
run: echo "NODE_OPTIONS=--openssl-legacy-provider" >> $GITHUB_ENV
- name: Build docs
run: npm run docs:build
working-directory: docs
- name: Unset environment variable for Node v16 above
if: ${{ matrix.node-version > '16' }}
run: echo "NODE_OPTIONS=''" >> $GITHUB_ENV
all:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
node-version: [ 18, 20 ]
name: Build radar and maintainer on Node ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm i
- name: Build radar and maintainer
run: npm run build:all
automerge:
if: github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'
needs: [ jest, puppeteer, docs, all ]
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: fastify/github-action-merge-dependabot@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
target: patch