Skip to content

Commit

Permalink
ci: add test with pebble workflow (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
ycmjason authored Oct 14, 2024
1 parent 3d8da16 commit bc95be1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 49 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
name: "Node: Build + Integration"
name: Test With Pebble

on:
push:
branches:
- main
pull_request:
workflow_call:
inputs:
test_command:
type: string
description: "The test command to run"
required: true
default: "deno task test:integration"

jobs:
test:
test-with-pebble:
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -23,24 +26,21 @@ jobs:
- name: Wait for Pebble to be ready
run: |
echo "⏳ Waiting for Pebble... 🪨"
# Loop until the port 14000 is open
until nc -zv localhost 14000 2>/dev/null; do
sleep 1
done
echo "✅ Pebble is running!"
- name: Wait for pebble-challtestsrv to be ready
run: |
echo "⏳ Waiting for pebble-challtestsrv... 🪨"
until nc -zv localhost 8055 2>/dev/null; do
sleep 1
done
echo "✅ pebble-challtestsrv is running!"
- run: deno task build:npm:integration
# Run the test command passed from the calling workflow
- run: ${{ inputs.test_command }}

- name: Stop Pebble
run: deno task pebble:stop
47 changes: 10 additions & 37 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,13 @@ on:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- uses: denoland/setup-deno@v2
with:
deno-version: v2.x # Run with latest stable Deno.

- name: Start Pebble and pebble-challtestsrv
run: deno task pebble:start --detach

- name: Wait for Pebble to be ready
run: |
echo "⏳ Waiting for Pebble... 🪨"
# Loop until the port 14000 is open
until nc -zv localhost 14000 2>/dev/null; do
sleep 1
done
echo "✅ Pebble is running!"
- name: Wait for pebble-challtestsrv to be ready
run: |
echo "⏳ Waiting for pebble-challtestsrv... 🪨"
until nc -zv localhost 8055 2>/dev/null; do
sleep 1
done
echo "✅ pebble-challtestsrv is running!"
- run: deno task test:integration

- name: Stop Pebble
run: deno task pebble:stop
deno:
name: Deno
uses: ./.github/workflows/_test-with-pebble.yaml
with:
test_command: deno task test:integration
node:
name: Node
uses: ./.github/workflows/_test-with-pebble.yaml
with:
test_command: deno task build:npm:integration

0 comments on commit bc95be1

Please sign in to comment.