Skip to content

Node.js CI

Node.js CI #758

Workflow file for this run

# Temporary flow to test compilation of the generated requests
name: Node.js CI
on:
workflow_dispatch:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]
jobs:
build:
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=9182"
environment:
name: build_test
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
# Single version should work for compilation testing
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
- run: npm ci
- run: npm run build
- name: Check for Secret availability
id: my-key-check
# perform secret check & put boolean result as an output
shell: bash
run: |
if [ "${{ secrets.client_secret }}" != '' ]; then
echo "defined=true" >> $GITHUB_OUTPUT;
else
echo "defined=false" >> $GITHUB_OUTPUT;
fi
- run: npm run test
if: steps.my-key-check.outputs.defined == 'true'
env:
TENANT_ID: ${{secrets.tenant_id}}
CLIENT_ID: ${{secrets.client_id}}
CLIENT_SECRET: ${{secrets.client_secret}}
# The check-build-matrix returns success if all matrix jobs in build are successful; otherwise, it returns a failure.
# Use this as a PR status check for GitHub Policy Service instead of individual matrix entry checks.
check-build-matrix:
runs-on: ubuntu-latest
needs: build
if: always()
steps:
- name: All build matrix options are successful
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: One or more build matrix options failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1