Skip to content

Release Test

Release Test #6

Workflow file for this run

name: Release Test
permissions:
contents: read
on:
workflow_dispatch:
inputs:
release_version:
type: string
required: true
description: Release version (without the v prefix)
jobs:
express-server-tests:
name: Express Server E2E
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Prepare express-server
env:
version: ${{ github.event.inputs.tag_name }}
run: |
# Browse to the express-server example
cd examples/express-server
# Prepare the environment variables
cp .env.example .env
cp crowdsec/.env.example crowdsec/.env
# Set tested version
sed -i 's|"file:cs-nodejs-bouncer.tgz"|"${{env.version}}"|g' package.json
# Install tsconfig-paths (required by tsconfig.json)
npm --prefix ../.. install tsconfig-paths
# Install the dependencies (do not use npm ci to ensure we use the released version)
npm install
# Check version
npm list @crowdsec/nodejs-bouncer
# Install Playwright Browsers
npx playwright install --with-deps
# Start docker services
docker compose up -d
# Create a bouncer with the "crowdsec/.env" file bouncer key
BOUNCER_KEY=$(grep -o -E "BOUNCER_KEY=(.*)" crowdsec/.env | cut -d'=' -f2 | tr -d "'")
docker exec -i nodejs-cs-crowdsec sh -c 'cscli bouncers add NodeBouncer --key $BOUNCER_KEY'
- name: Run Playwright tests
run: |
cd examples/express-server
E2E_TEST_NAME=live-mode npx playwright test live-mode
E2E_TEST_NAME=custom-configs-1 npx playwright test custom-configs-1
E2E_TEST_NAME=custom-configs-2 npx playwright test custom-configs-2
E2E_TEST_NAME=stream-mode npx playwright test stream-mode
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: examples/express-server/playwright-report/
retention-days: 5