diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index f743b2c..32c980c 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -7,42 +7,39 @@ on: push: branches: - master - - 'release/**' + - "release/**" pull_request: branches: - master - - 'release/**' + - "release/**" workflow_dispatch: jobs: build: - runs-on: ubuntu-latest - strategy: matrix: node-version: [16.x, 18.x, 20.x, 21.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - name: Install dependencies - run: npm ci - - name: Run linter over tests - run: npx prettier -c test/**/*.ts - - name: Run integration tests with NPM - if: ${{ matrix.node-version == '16.x' && + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Install dependencies + run: npm ci + - name: Run linter over tests + run: npx prettier -c test/**/*.ts + - name: Run integration tests with NPM + if: ${{ matrix.node-version == '16.x' && github.repository_owner == 'onfido' && github.actor != 'dependabot[bot]' }} - run: npm test -- -i - env: - ONFIDO_API_TOKEN: ${{ secrets.ONFIDO_API_TOKEN }} - ONFIDO_SAMPLE_APPLICANT_ID: ${{ secrets.ONFIDO_SAMPLE_APPLICANT_ID }} - ONFIDO_SAMPLE_VIDEO_ID_1: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_1 }} - ONFIDO_SAMPLE_VIDEO_ID_2: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_2 }} - ONFIDO_SAMPLE_MOTION_ID_1: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_1 }} - ONFIDO_SAMPLE_MOTION_ID_2: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_2 }} \ No newline at end of file + run: npm test -- -i + env: + ONFIDO_API_TOKEN: ${{ secrets.ONFIDO_API_TOKEN }} + ONFIDO_SAMPLE_APPLICANT_ID: ${{ secrets.ONFIDO_SAMPLE_APPLICANT_ID }} + ONFIDO_SAMPLE_VIDEO_ID_1: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_1 }} + ONFIDO_SAMPLE_VIDEO_ID_2: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_2 }} + ONFIDO_SAMPLE_MOTION_ID_1: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_1 }} + ONFIDO_SAMPLE_MOTION_ID_2: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_2 }} diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index ff8b215..406292e 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,42 +1,45 @@ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages -name: Node.js Package +name: Node.js Package with NPM on: release: - types: [created] + types: + - created jobs: - build: + integration-tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: 14 - - run: npm ci - - name: E2E testing - run: npm test -i + node-version: 16.x + - name: Install dependencies + run: npm ci + - name: Run integration tests with NPM + run: npm test -- -i env: - ONFIDO_API_TOKEN: ${{secrets.ONFIDO_API_TOKEN}} - ONFIDO_SAMPLE_APPLICANT_ID: ${{secrets.ONFIDO_SAMPLE_APPLICANT_ID}} - ONFIDO_SAMPLE_VIDEO_ID_1: ${{secrets.ONFIDO_SAMPLE_VIDEO_ID_1}} - ONFIDO_SAMPLE_VIDEO_ID_2: ${{secrets.ONFIDO_SAMPLE_VIDEO_ID_2}} - ONFIDO_SAMPLE_MOTION_ID_1: ${{secrets.ONFIDO_SAMPLE_MOTION_ID_1}} - ONFIDO_SAMPLE_MOTION_ID_2: ${{secrets.ONFIDO_SAMPLE_MOTION_ID_2}} + ONFIDO_API_TOKEN: ${{ secrets.ONFIDO_API_TOKEN }} + ONFIDO_SAMPLE_APPLICANT_ID: ${{ secrets.ONFIDO_SAMPLE_APPLICANT_ID }} + ONFIDO_SAMPLE_VIDEO_ID_1: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_1 }} + ONFIDO_SAMPLE_VIDEO_ID_2: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_2 }} + ONFIDO_SAMPLE_MOTION_ID_1: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_1 }} + ONFIDO_SAMPLE_MOTION_ID_2: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_2 }} publish-npm: - needs: build + needs: integration-tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: - node-version: 12 + node-version: 16.x registry-url: https://registry.npmjs.org/ - - run: npm ci - - run: npm run build - - run: npm publish + - name: Install dependencies + run: npm ci + - name: Build and publish package + run: npm publish env: NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore deleted file mode 100644 index e69de29..0000000 diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES deleted file mode 100644 index c29a818..0000000 --- a/.openapi-generator/FILES +++ /dev/null @@ -1,15 +0,0 @@ -.gitignore -.npmignore -.openapi-generator-ignore -LICENSE -README.md -api.ts -base.ts -common.ts -configuration.ts -git_push.sh -index.ts -package.json -tsconfig.esm.json -tsconfig.json -webhook-event-verifier.ts diff --git a/git_push.sh b/git_push.sh deleted file mode 100644 index 694cc3a..0000000 --- a/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="github.com" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="onfido" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="onfido-node" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/package.json b/package.json index d932523..07b07f7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@onfido/api", "version": "3.0.0", - "description": "OpenAPI client for @onfido/api", + "description": "Node.js library for the Onfido API", "author": "OpenAPI-Generator Contributors", "repository": { "type": "git", @@ -12,18 +12,25 @@ "typescript", "openapi-client", "openapi-generator", - "@onfido/api" + "@onfido/api", + "onfido", + "identity", + "verification", + "api" ], - "license": "MIT", + "license": "MIT", "main": "./dist/index.js", "typings": "./dist/index.d.ts", "module": "./dist/esm/index.js", "sideEffects": false, "scripts": { - "test": "jest", + "test": "jest", "build": "tsc && tsc -p tsconfig.esm.json", "prepare": "npm run build" }, + "files": [ + "/dist" + ], "jest": { "preset": "ts-jest", "testEnvironment": "node", diff --git a/test/resources/workflow-runs-outputs.test.ts b/test/resources/workflow-runs-outputs.test.ts index a3c0ada..8a52230 100644 --- a/test/resources/workflow-runs-outputs.test.ts +++ b/test/resources/workflow-runs-outputs.test.ts @@ -125,7 +125,7 @@ describe("workflow runs outputs", () => { ); }); - it.only("allows document and facial similarity photo reports as outputs", async () => { + it("allows document and facial similarity photo reports as outputs", async () => { const workflow_id = "5025d9fd-7842-4805-bce1-a7bfd7131b4e"; const workflowRunId = (await createWorkflowRun(applicant, workflow_id)).data .id;