-
Notifications
You must be signed in to change notification settings - Fork 9
47 lines (39 loc) · 1.33 KB
/
triggers-functions-offline-testing.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
---
name: trigger-functions-offline-testing
# The tests themselves are written with osht, a bash testing framework.
# See: https://github.com/coryb/osht
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
TRIGGERS_GETTING_STARTED_FOLDER: functions/triggers-getting-started
OFFLINE_SERVER_URL: http://localhost:${{ env.OFFLINE_SERVER_PORT }}
jobs:
triggers-node:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install node
uses: actions/setup-node@v2
with:
node-version: "20.x"
- name: Install node dev requirements
run: npm install --prefix ${{ env.TRIGGERS_GETTING_STARTED_FOLDER }}/node
- name: Install osht
run: |
curl -q -s https://raw.githubusercontent.com/coryb/osht/master/osht.sh > osht.sh
- name: Run node offline testing
uses: BerniWittmann/background-server-action@v1
with:
command: |
source osht.sh && \
IS $(curl -q ${{ env.OFFLINE_SERVER_URL }}) == "Method not allowed" && \
IS $(curl -q -d 5 ${{ env.OFFLINE_SERVER_URL }}) == 120
start: |
cd ${{ env.TRIGGERS_GETTING_STARTED_FOLDER }}/node
npm start
wait-on: ${{ env.OFFLINE_SERVER_URL }})
wait-on-timeout: 60