chore: Updated hapi tests to node:test #1266
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Daily workflow to run versioned tests with security agent enabled | |
# This also can be used to run versioned tests with a newer versioned of | |
# security agent since we pin it. | |
name: Versioned Tests w/ Security Agent | |
on: | |
workflow_dispatch: | |
inputs: | |
mode: | |
description: Versioned test mode | |
type: choice | |
options: | |
- major | |
- minor | |
default: major | |
required: false | |
version: | |
type: string | |
description: Version of security agent to test | |
required: false | |
schedule: | |
- cron: '0 9 * * 1-5' | |
pull_request: | |
branches: | |
- main | |
env: | |
# Enable versioned runner quiet mode to make CI output easier to read: | |
OUTPUT_MODE: quiet | |
jobs: | |
should_run: | |
# Used to determine if the `@newrelic/security-agent` dependency has | |
# been updated in any new pull requests. This job _must_ always run because | |
# the `security-agent-tests` job depends on the outputs of this job. Thus, | |
# we cannot put a conditional on this job to only run if the event name | |
# is "pull_request". | |
name: Should Run | |
runs-on: ubuntu-latest | |
outputs: | |
sec_agent_did_change: ${{ steps.check_sec_agent.outputs.divergent }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Check Security Agent Changed | |
id: check_sec_agent | |
uses: jsumners-nr/gha-node-deps-divergent@643628fe0da51ec025e984c4644f17fd9f9e93f6 | |
with: | |
base-sha: ${{ github.base_ref || 'main' }} | |
current-sha: ${{ github.sha }} | |
package-name: '@newrelic/security-agent' | |
security-agent-tests: | |
needs: [should_run] | |
if: github.event_name == 'workflow_dispatch' || | |
github.event_name == 'schedule' || | |
needs.should_run.outputs.sec_agent_did_change == 'true' | |
runs-on: ${{ vars.NR_RUNNER || 'ubuntu-latest' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [18.x, 20.x, 22.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install Dependencies | |
run: npm install | |
- name: Install Version ${{ inputs.version }} of security agent | |
if: ${{ inputs.version }} | |
run: npm install @newrelic/security-agent@${{ inputs.version }} | |
- name: Run Docker Services | |
run: npm run services | |
- name: Versioned Tests w/ Security Agent | |
run: TEST_CHILD_TIMEOUT=600000 npm run versioned:security | |
env: | |
VERSIONED_MODE: --${{ inputs.mode || 'major' }} | |
# Run more jobs when using larger runner, otherwise 2 per CPU seems to be the sweet spot in GHA default runners(July 2022) | |
JOBS: ${{ vars.NR_RUNNER && 16 || 4 }} | |
SKIP_C8: true | |