Skip to content

GitHub Actions

Start stubIdP as a background process before your integration tests, then shut it down automatically when the job ends.

- name: Start stubIdP
run: |
npx @cerberauth/stubidp \
--client-id web-app \
--client-secret web-app-secret \
--redirect-uri http://localhost:8080/callback &
npx wait-on http://localhost:8484/.well-known/openid-configuration
- name: Run integration tests
run: npm test
env:
STUBIDP_ISSUER: http://localhost:8484
STUBIDP_CLIENT_ID: web-app
STUBIDP_CLIENT_SECRET: web-app-secret
jobs:
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Start stubIdP
run: |
npx @cerberauth/stubidp &
npx wait-on http://localhost:8484/.well-known/openid-configuration
env:
STUBIDP_CLIENT_ID: web-app
STUBIDP_CLIENT_SECRET: web-app-secret
STUBIDP_REDIRECT_URI: http://localhost:8080/callback
- name: Run integration tests
run: npm test
env:
STUBIDP_ISSUER: http://localhost:8484
STUBIDP_CLIENT_ID: web-app
STUBIDP_CLIENT_SECRET: web-app-secret

If you test against multiple redirect URIs or client configurations, pass them through the matrix:

strategy:
matrix:
redirect_uri:
- http://localhost:8080/callback
- http://localhost:9090/auth/callback
steps:
- name: Start stubIdP
run: |
npx @cerberauth/stubidp \
--client-id web-app \
--client-secret web-app-secret \
--redirect-uri ${{ matrix.redirect_uri }} &
npx wait-on http://localhost:8484/.well-known/openid-configuration