-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (46 loc) · 1.44 KB
/
pr-workflow.yaml
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
name: Integration tests
on:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
concurrency: discord_api
env:
DISCORD_BOT_TOKEN: "${{ secrets.DISCORD_BOT_TOKEN }}"
TEST_CHANNEL_ID: "${{ secrets.TEST_CHANNEL_ID }}"
SCRAPE_URL: http://localhost:8090
FETCH_INTERVAL: 1000
FETCH_INTERVAL_RANDOM: 0
API_PORT: 3050
steps:
- name: Check secrets
if: ${{ env.DISCORD_BOT_TOKEN == null }}
uses: actions/github-script@v3
with:
script: |
core.setFailed('Secrets not available.')
- name: Branch based PR checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "22.x"
- run: npm ci
- run: npm run build
- name: Create subs file for tests # Workaround for bot not receiving messages from test channel
uses: "DamianReeves/write-file-action@master"
with:
path: subs.txt
write-mode: overwrite
contents: |
${{ secrets.TEST_CHANNEL_ID }}
- run: npm start & npx wait-on -t 60000 http://localhost:${{ env.API_PORT }}/health
- run: npm test
- run: |
echo "Integration tests... success! ;-)"
- name: Fail cancelled workflow
if: ${{ cancelled() }}
uses: actions/github-script@v3
with:
script: |
core.setFailed('Workflow cancelled.')