Skip to content

Commit

Permalink
test: try to fix ci tests (#2153)
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra authored Jan 23, 2025
1 parent 3984044 commit 13cd8cb
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 95 deletions.
18 changes: 18 additions & 0 deletions .changeset/eleven-numbers-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'@credo-ts/openid4vc': patch
'@credo-ts/core': patch
'@credo-ts/node': patch
'@credo-ts/action-menu': patch
'@credo-ts/anoncreds': patch
'@credo-ts/askar': patch
'@credo-ts/bbs-signatures': patch
'@credo-ts/cheqd': patch
'@credo-ts/drpc': patch
'@credo-ts/indy-sdk-to-askar-migration': patch
'@credo-ts/indy-vdr': patch
'@credo-ts/question-answer': patch
'@credo-ts/react-native': patch
'@credo-ts/tenants': patch
---

feat: support node 22
61 changes: 14 additions & 47 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ on:
pull_request:
branches:
- main
- '**-pre'
types: [opened, synchronize, reopened, labeled]
push:
branches:
- main
- '**-pre'
workflow_dispatch:
pull_request_review:

env:
NODE_OPTIONS: --max_old_space_size=6144
Expand All @@ -24,44 +21,19 @@ concurrency:
cancel-in-progress: true

jobs:
# PRs created by github actions won't trigger CI. Before we can merge a PR we need to run the tests and
# validation scripts. To still be able to run the CI we can manually trigger it by adding the 'ci-test'
# label to the pull request
ci-trigger:
runs-on: ubuntu-20.04
outputs:
triggered: ${{ steps.check.outputs.triggered }}
steps:
- name: Determine if CI should run
id: check
run: |
if [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" == "ci-test" ]]; then
export SHOULD_RUN='true'
elif [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" != "ci-test" ]]; then
export SHOULD_RUN='false'
else
export SHOULD_RUN='true'
fi
echo "SHOULD_RUN: ${SHOULD_RUN}"
echo triggered="${SHOULD_RUN}" >> "$GITHUB_OUTPUT"
validate:
runs-on: ubuntu-20.04
name: Validate
if: github.event_name != 'pull_request_review' || github.event.pull_request.head.ref == 'changeset-release/main'
steps:
- name: Checkout credo-ts
uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 9.1.0
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
node-version: 22
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile
Expand All @@ -81,30 +53,27 @@ jobs:
unit-tests:
runs-on: ubuntu-20.04
name: Unit Tests
if: github.event_name != 'pull_request_review' || github.event.pull_request.head.ref == 'changeset-release/main'

strategy:
fail-fast: false
matrix:
node-version: [18, 20]
node-version: [18, 20, 22]
# Each shard runs a set of the tests
# Make sure to UPDATE THE TEST command with the total length of
# the shards if you change this!!
shard: [1, 2]

steps:
- name: Checkout credo
uses: actions/checkout@v4
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4

- name: Setup NodeJS
id: setup-node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- uses: pnpm/action-setup@v2
with:
version: 9.1.0

# See https://github.com/actions/setup-node/issues/641#issuecomment-1358859686
- name: pnpm cache path
id: pnpm-cache-path
Expand Down Expand Up @@ -136,15 +105,15 @@ jobs:
e2e-tests:
runs-on: ubuntu-20.04
name: E2E Tests
if: github.event_name != 'pull_request_review' || github.event.pull_request.head.ref == 'changeset-release/main'

strategy:
fail-fast: false
matrix:
node-version: [18, 20]
node-version: [18, 20, 22]

steps:
- name: Checkout credo
uses: actions/checkout@v4
- uses: actions/checkout@v4

# setup dependencies
- name: Setup services
Expand All @@ -156,9 +125,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- uses: pnpm/action-setup@v2
with:
version: 9.1.0
- uses: pnpm/action-setup@v4

# See https://github.com/actions/setup-node/issues/641#issuecomment-1358859686
- name: pnpm cache path
Expand Down
36 changes: 12 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,14 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4

- uses: pnpm/action-setup@v2
with:
version: 9.1.0

- name: Setup Node.js 20.x
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
node-version: 22
cache: pnpm

- name: Install Dependencies
run: pnpm install --frozen-lockfile
Expand All @@ -43,11 +39,10 @@ jobs:
id: changesets
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm release
title: 'chore(release): new version'
commit: 'chore(release): new version'
createGithubReleases: false
publish: pnpm release
version: pnpm changeset-version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH }}
Expand All @@ -65,9 +60,6 @@ jobs:
release-unstable:
name: Release Unstable
runs-on: ubuntu-latest
# We don't want to run release and release-unstable concurrently as NPM doesn't allow publishing packages while another version of the same package is
# still processing. So we wait for release to finish, and the always() ensure that it will run no matter the result of release.
needs: [release]
if: "always() && (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'openwallet-foundation/credo-ts') || (github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'chore(release): new version'))"
steps:
- uses: snnaplab/get-labels-action@v1
Expand All @@ -77,18 +69,14 @@ jobs:
- if: github.event_name == 'pull_request' && !contains(fromJSON(env.LABELS), 'alpha-release')
run: exit 0

- name: Checkout Repo
uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 9.1.0
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4

- name: Setup Node.js 20.x
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
node-version: 22
cache: pnpm

- name: Install Dependencies
run: pnpm install --frozen-lockfile
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"demo-openid",
"samples/*"
],
"packageManager": "pnpm@9.1.0",
"packageManager": "pnpm@9.15.3+sha512.1f79bc245a66eb0b07c5d4d83131240774642caaa86ef7d0434ab47c0d16f66b04e21e0c086eb61e62c77efc4d7f7ec071afad3796af64892fae66509173893a",
"repository": {
"url": "https://github.com/openwallet-foundation/credo-ts",
"type": "git"
Expand Down Expand Up @@ -58,7 +58,7 @@
"eslint-plugin-workspaces": "^0.8.0",
"express": "^4.17.1",
"jest": "^29.7.0",
"nock": "^14.0.0-beta.16",
"nock": "^14.0.0-beta.19",
"prettier": "^2.3.1",
"rxjs": "^7.8.0",
"supertest": "^7.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@
"rimraf": "^4.4.0",
"tslog": "^4.8.2",
"typescript": "~5.5.2",
"nock": "^14.0.0-beta.16"
"nock": "^14.0.0-beta.19"
}
}
2 changes: 1 addition & 1 deletion packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"devDependencies": {
"@types/node": "^18.18.8",
"@types/ws": "^8.5.4",
"nock": "^14.0.0-beta.16",
"nock": "^14.0.0-beta.19",
"rimraf": "^4.4.0",
"typescript": "~5.5.2"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/openid4vc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@credo-ts/tenants": "workspace:*",
"@types/express": "^4.17.21",
"express": "^4.18.2",
"nock": "^14.0.0-beta.16",
"nock": "^14.0.0-beta.19",
"rimraf": "^4.4.0",
"typescript": "~5.5.2"
}
Expand Down
8 changes: 4 additions & 4 deletions packages/openid4vc/tests/openid4vc.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { OpenId4VciSignMdocCredentials } from '../src'
import type { OpenId4VciCredentialBindingResolver } from '../src/openid4vc-holder'
import type { AuthorizationServerMetadata } from '@animo-id/oauth2'
import type { DifPresentationExchangeDefinitionV2, JwkJson, Mdoc, MdocDeviceResponse, SdJwtVc } from '@credo-ts/core'
import type { Server } from 'http'

import {
calculateJwkThumbprint,
Expand Down Expand Up @@ -40,6 +39,7 @@ import {
import { ResponseMode } from '@sphereon/did-auth-siop'
import express, { type Express } from 'express'

import { setupNockToExpress } from '../../../tests/nockToExpress'
import { AskarModule } from '../../askar/src'
import { askarModuleConfig } from '../../askar/tests/helpers'
import { TenantsModule } from '../../tenants/src'
Expand Down Expand Up @@ -72,7 +72,7 @@ const verificationBaseUrl = `${baseUrl}/oid4vp`

describe('OpenId4Vc', () => {
let expressApp: Express
let expressServer: Server
let cleanupMockServer: () => void

let issuer: AgentType<{
openId4VcIssuer: OpenId4VcIssuerModule
Expand Down Expand Up @@ -197,11 +197,11 @@ describe('OpenId4Vc', () => {
expressApp.use('/oid4vci', issuer.agent.modules.openId4VcIssuer.config.router)
expressApp.use('/oid4vp', verifier.agent.modules.openId4VcVerifier.config.router)

expressServer = expressApp.listen(serverPort)
cleanupMockServer = setupNockToExpress(baseUrl, expressApp)
})

afterEach(async () => {
expressServer?.close()
cleanupMockServer()

await issuer.agent.shutdown()
await issuer.agent.wallet.delete()
Expand Down
30 changes: 15 additions & 15 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 13cd8cb

Please sign in to comment.