feat: add getting started for SQS triggers #8
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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:8080 | |
jobs: | |
triggers-node: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Install node dev requirements | |
run: | | |
cd ${{ env.TRIGGERS_GETTING_STARTED_FOLDER }}/node | |
npm install | |
- 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 |