Skip to content

Fix 601

Fix 601 #121

Workflow file for this run

name: main
on:
push:
branches: [master]
tags:
- 'v*'
pull_request:
branches: [master]
workflow_dispatch:
permissions:
contents: read
pull-requests: read
env:
# Node 24 is current LTS (Krypton) - use for builds
NODE_VERSION: '24'
PYTHON_VERSION: '3.11'
jobs:
identifiers:
# GitHub needs to know where .cicd/workflows/identifiers.yml lives at parse time,
# and submodules aren't included in that context! thus the following does NOT work:
# uses: ./.cicd/workflows/identifiers.yml
# we MUST reference the remote repo directly:
uses: wamp-proto/wamp-cicd/.github/workflows/identifiers.yml@main
# IMPORTANT: we still need .cicd as a Git submodule in the using repo though!
# because e.g. identifiers.yml wants to access scripts/sanitize.sh !
lint:
name: ESLint
needs: identifiers
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install Just
run: |
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
echo "$HOME/bin" >> $GITHUB_PATH
- name: Run ESLint
run: just lint
format:
name: Prettier
needs: identifiers
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install Just
run: |
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
echo "$HOME/bin" >> $GITHUB_PATH
- name: Check formatting
run: just format
test-unit:
name: Unit tests (Node ${{ matrix.node }})
needs: identifiers
runs-on: ubuntu-24.04
strategy:
matrix:
node: ['22', '24', '25']
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install Just
run: |
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
echo "$HOME/bin" >> $GITHUB_PATH
- name: Install npm dependencies
run: just install-npm
- name: Run unit tests (Vitest)
run: just test-unit
test:
name: Integration tests (Node ${{ matrix.node }})
needs: identifiers
runs-on: ubuntu-24.04
strategy:
matrix:
# Node 22 (LTS), 24 (LTS "Krypton"), 25 (Current)
node: ['22', '24', '25']
fail-fast: false
env:
BASE_REPO: ${{ needs.identifiers.outputs.base_repo }}
BASE_BRANCH: ${{ needs.identifiers.outputs.base_branch }}
PR_NUMBER: ${{ needs.identifiers.outputs.pr_number }}
PR_REPO: ${{ needs.identifiers.outputs.pr_repo }}
PR_BRANCH: ${{ needs.identifiers.outputs.pr_branch }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Setup Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Just
run: |
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
echo "$HOME/bin" >> $GITHUB_PATH
- name: Install uv (Python package manager)
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Verify toolchain
run: |
node --version
npm --version
python3 --version
just --version
uv --version
- name: Install npm dependencies
run: just install-npm
- name: Install Crossbar.io (test router)
run: just install-crossbar
- name: Start Crossbar.io router
run: |
just crossbar-start &
sleep 5 # Wait for router to start
- name: Run integration tests (Vitest)
run: just test
- name: Stop Crossbar.io router
if: always()
run: pkill -f crossbar || true
build:
name: Build browser bundles
runs-on: ubuntu-24.04
needs: [identifiers, test-unit, test]
env:
BASE_REPO: ${{ needs.identifiers.outputs.base_repo }}
BASE_BRANCH: ${{ needs.identifiers.outputs.base_branch }}
PR_NUMBER: ${{ needs.identifiers.outputs.pr_number }}
PR_REPO: ${{ needs.identifiers.outputs.pr_repo }}
PR_BRANCH: ${{ needs.identifiers.outputs.pr_branch }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Setup Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Just
run: |
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to ~/bin
echo "$HOME/bin" >> $GITHUB_PATH
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Build autobahn
run: just build-autobahn
- name: Build autobahn-xbr
run: just build-xbr
- name: Upload autobahn build artifacts
uses: wamp-proto/wamp-cicd/actions/upload-artifact-verified@main
with:
name: autobahn-bundle
path: packages/autobahn/build/
retention-days: 30
- name: Upload autobahn-xbr build artifacts
uses: wamp-proto/wamp-cicd/actions/upload-artifact-verified@main
with:
name: autobahn-xbr-bundle
path: packages/autobahn-xbr/build/
retention-days: 30
security:
name: Security scan
needs: identifiers
runs-on: ubuntu-24.04
env:
BASE_REPO: ${{ needs.identifiers.outputs.base_repo }}
BASE_BRANCH: ${{ needs.identifiers.outputs.base_branch }}
PR_NUMBER: ${{ needs.identifiers.outputs.pr_number }}
PR_REPO: ${{ needs.identifiers.outputs.pr_repo }}
PR_BRANCH: ${{ needs.identifiers.outputs.pr_branch }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: |
cd packages/autobahn && npm install
cd ../autobahn-xbr && npm install
- name: Create security results directory
run: mkdir -p security-results
- name: Run npm audit (autobahn)
run: |
cd packages/autobahn
echo "=== npm audit for autobahn ===" > ../../security-results/autobahn-audit.log
echo "Timestamp: $(date -Iseconds)" >> ../../security-results/autobahn-audit.log
echo "Node.js: $(node --version)" >> ../../security-results/autobahn-audit.log
echo "npm: $(npm --version)" >> ../../security-results/autobahn-audit.log
echo "" >> ../../security-results/autobahn-audit.log
# Run audit and capture output (don't fail on vulnerabilities)
npm audit --json > ../../security-results/autobahn-audit.json 2>&1 || true
npm audit >> ../../security-results/autobahn-audit.log 2>&1 || true
# Extract summary for quick reference
echo ""
echo "=== Audit Summary ==="
cat ../../security-results/autobahn-audit.log
- name: Run npm audit (autobahn-xbr)
run: |
cd packages/autobahn-xbr
echo "=== npm audit for autobahn-xbr ===" > ../../security-results/autobahn-xbr-audit.log
echo "Timestamp: $(date -Iseconds)" >> ../../security-results/autobahn-xbr-audit.log
echo "Node.js: $(node --version)" >> ../../security-results/autobahn-xbr-audit.log
echo "npm: $(npm --version)" >> ../../security-results/autobahn-xbr-audit.log
echo "" >> ../../security-results/autobahn-xbr-audit.log
# Run audit and capture output (don't fail on vulnerabilities)
npm audit --json > ../../security-results/autobahn-xbr-audit.json 2>&1 || true
npm audit >> ../../security-results/autobahn-xbr-audit.log 2>&1 || true
# Extract summary for quick reference
echo ""
echo "=== Audit Summary ==="
cat ../../security-results/autobahn-xbr-audit.log
- name: Generate security summary
run: |
cd security-results
# Create summary JSON
cat > security-summary.json << 'SUMMARY'
{
"timestamp": "$(date -Iseconds)",
"node_version": "$(node --version)",
"npm_version": "$(npm --version)",
"packages": ["autobahn", "autobahn-xbr"]
}
SUMMARY
# Generate checksums
sha256sum *.json *.log > CHECKSUM.SHA256
md5sum *.json *.log > CHECKSUM.MD5
echo "=== Security Results Checksums ==="
cat CHECKSUM.SHA256
- name: Upload security scan results
if: always()
uses: wamp-proto/wamp-cicd/actions/upload-artifact-verified@main
with:
name: security-scan-results
path: security-results/
retention-days: 30