Skip to content

Functional tests

Functional tests #437

name: Functional tests
on:
workflow_dispatch:
pull_request:
schedule:
- cron: '0 5 * * *'
jobs:
build:
name: 'Build sdk'
uses: fingerprintjs/dx-team-toolkit/.github/workflows/build-typescript-project.yml@v1
with:
artifactName: node-sdk-artifact
artifactPath: ./dist
functional_tests:
name: 'Smoke test on node ${{ matrix.node-version }}'
needs: build
runs-on: ubuntu-latest
strategy:
max-parallel: 3
fail-fast: false
matrix:
node-version: [18, 19, 20, 21]
steps:
- if: ${{ github.event_name == 'pull_request_target' }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- if: ${{ github.event_name != 'pull_request_target' }}
uses: actions/checkout@v4
- name: 'Install pnpm'
uses: pnpm/action-setup@129abb77bf5884e578fcaf1f37628e41622cc371
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- uses: actions/download-artifact@v4
with:
name: node-sdk-artifact
path: ./dist
- name: Install Dependencies for SDK
run: pnpm install
env:
CI: true
- name: Install Dependencies for example
run: pnpm install
working-directory: ./example
env:
CI: true
- name: Run test
run: |
node getEvent.mjs
node getVisitorHistory.mjs
working-directory: ./example
env:
API_KEY: '${{ secrets.PRIVATE_KEY }}'
VISITOR_ID: '${{ secrets.VISITOR_ID }}'
REQUEST_ID: '${{ secrets.REQUEST_ID }}'
report_status:
needs: functional_tests
if: always()
uses: fingerprintjs/dx-team-toolkit/.github/workflows/report-workflow-status.yml@v1
with:
notification_title: 'Node SDK Functional Tests has {status_message}'
job_status: ${{ needs.functional_tests.result }}
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}