From c6283a0055a2c04a2ecba3b2dabd53e02aca01d2 Mon Sep 17 00:00:00 2001 From: Emelia Smith Date: Thu, 14 Apr 2022 22:01:10 +0200 Subject: [PATCH] Chore: use correct ci dependency versions (#236) * chore: correctly prettier markdown and yaml files * chore: run prettier on yml files * chore: run actions on latest operating system versions * chore: use latest major versions of depended on actions * fix: correct the CD E2E Node workflow to work --- .github/workflows/audit.yml | 8 +- .github/workflows/cd-teardown.yml | 38 +-- .github/workflows/cd.yml | 428 +++++++++++++------------- .github/workflows/ci.yml | 32 +- .github/workflows/codeql-analysis.yml | 74 ++--- .github/workflows/e2e-browser.yml | 62 ++-- .github/workflows/e2e-node.yml | 94 +++--- .github/workflows/release.yml | 320 +++++++++---------- package.json | 2 +- 9 files changed, 528 insertions(+), 530 deletions(-) diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 3cd2415c..df23a3c0 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -6,7 +6,7 @@ on: - cron: "40 10 * * *" jobs: - audit: - uses: inrupt/javascript-style-configs/.github/workflows/reusable-audit.yml@main - secrets: - WEBHOOK_E2E_FAILURE: ${{ secrets.WEBHOOK_E2E_FAILURE }} + audit: + uses: inrupt/javascript-style-configs/.github/workflows/reusable-audit.yml@main + secrets: + WEBHOOK_E2E_FAILURE: ${{ secrets.WEBHOOK_E2E_FAILURE }} diff --git a/.github/workflows/cd-teardown.yml b/.github/workflows/cd-teardown.yml index 37a15591..eef9c2f1 100644 --- a/.github/workflows/cd-teardown.yml +++ b/.github/workflows/cd-teardown.yml @@ -6,24 +6,24 @@ env: CI: true jobs: unpublish-npm: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest if: github.event.ref_type == 'branch' steps: - - name: Prepare for unpublication from npm - uses: actions/setup-node@v2.1.5 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - name: Determine npm tag - # Remove non-alphanumeric characters - # See https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable - run: echo "TAG_SLUG=$(echo "${{ github.event.ref }}" | tr -cd '[:alnum:]-')" >> $GITHUB_ENV - - name: Remove npm tag for the deleted branch - run: | - # Unfortunately GitHub Actions does not currently let us do something like - # if: secrets.NPM_TOKEN != '' - # so simply skip the command if the env var is not set: - if [ -n $NODE_AUTH_TOKEN ]; then npm dist-tag rm @inrupt/solid-client-notifications $TAG_SLUG; fi - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - run: echo "Package tag [$TAG_SLUG] unpublished." + - name: Prepare for unpublication from npm + uses: actions/setup-node@v3 + with: + node-version: "16.x" + registry-url: "https://registry.npmjs.org" + - name: Determine npm tag + # Remove non-alphanumeric characters + # See https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable + run: echo "TAG_SLUG=$(echo "${{ github.event.ref }}" | tr -cd '[:alnum:]-')" >> $GITHUB_ENV + - name: Remove npm tag for the deleted branch + run: | + # Unfortunately GitHub Actions does not currently let us do something like + # if: secrets.NPM_TOKEN != '' + # so simply skip the command if the env var is not set: + if [ -n $NODE_AUTH_TOKEN ]; then npm dist-tag rm @inrupt/solid-client-notifications $TAG_SLUG; fi + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - run: echo "Package tag [$TAG_SLUG] unpublished." diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 1299076e..6bb5f9d5 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -3,261 +3,259 @@ name: CD on: push: branches: - - '**' + - "**" tags-ignore: - # Only create preview releases for branches - # (the `release` workflow creates actual releases for version tags): - - '**' + # Only create preview releases for branches + # (the `release` workflow creates actual releases for version tags): + - "**" env: CI: true jobs: prepare-deployment: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest outputs: tag-slug: ${{ steps.determine-npm-tag.outputs.tag-slug }} deployment-id: ${{ fromJson(steps.create-deployment.outputs.data).id }} steps: - - name: Create GitHub Deployment - id: create-deployment - if: github.actor != 'dependabot[bot]' - uses: octokit/request-action@v2.1.0 - with: - route: POST /repos/:repository/deployments - repository: ${{ github.repository }} - ref: ${{ github.sha }} - environment: review - transient_environment: true - auto_merge: false - mediaType: '{"previews": ["flash", "ant-man"]}' - # The deployment runs in parallel with CI, so status checks will never have succeeded yet: - required_contexts: '[]' - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: Determine npm tag - id: determine-npm-tag - run: | - # Remove non-alphanumeric characters - # See https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable - echo "::set-output name=tag-slug::$(echo ${GITHUB_REF#refs/heads/} | tr -cd '[:alnum:]-')" + - name: Create GitHub Deployment + id: create-deployment + if: github.actor != 'dependabot[bot]' + uses: octokit/request-action@v2.x + with: + route: POST /repos/:repository/deployments + repository: ${{ github.repository }} + ref: ${{ github.sha }} + environment: review + transient_environment: true + auto_merge: false + mediaType: '{"previews": ["flash", "ant-man"]}' + # The deployment runs in parallel with CI, so status checks will never have succeeded yet: + required_contexts: "[]" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Determine npm tag + id: determine-npm-tag + run: | + # Remove non-alphanumeric characters + # See https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable + echo "::set-output name=tag-slug::$(echo ${GITHUB_REF#refs/heads/} | tr -cd '[:alnum:]-')" publish-npm: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [prepare-deployment] outputs: version-nr: ${{ steps.determine-npm-version.outputs.version-nr }} steps: - - uses: actions/checkout@v2.3.4 - - name: Mark GitHub Deployment as in progress - id: start-deployment - uses: octokit/request-action@v2.1.0 - if: github.actor != 'dependabot[bot]' - with: - route: POST /repos/:repository/deployments/:deployment/statuses - repository: ${{ github.repository }} - deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} - environment: review - description: "Publishing to npm tag [${{ needs.prepare-deployment.outputs.tag-slug }}]…" - log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - state: in_progress - mediaType: '{"previews": ["flash", "ant-man"]}' - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/setup-node@v2.1.5 - with: - node-version: '14.x' - registry-url: 'https://registry.npmjs.org' - - name: Prepare prerelease version - id: determine-npm-version - if: github.actor != 'dependabot[bot]' - run: | - git config user.name $GITHUB_ACTOR - git config user.email gh-actions-${GITHUB_ACTOR}@github.com - # Unfortunately re-running a job does not change its run ID nor run number. - # To prevent re-releasing the same version when re-running the CD job, - # we incorporate a timestamp in the prerelease version: - TIMESTAMP=$(date --utc +%s) - # Make sure the prerelease is tagged with the branch name, and that they are sorted by build: - VERSION_NR=$(npm version prerelease --preid=$TAG_SLUG-$GITHUB_RUN_ID-$GITHUB_RUN_NUMBER-$TIMESTAMP) - echo "::set-output name=version-nr::$VERSION_NR" - env: - TAG_SLUG: ${{ needs.prepare-deployment.outputs.tag-slug }} - - run: npm ci - - name: Publish an npm tag for this branch - if: github.actor != 'dependabot[bot]' - run: | - # Unfortunately GitHub Actions does not currently let us do something like - # if: secrets.NPM_TOKEN != '' - # so simply skip the command if the env var is not set: - if [ -z $NODE_AUTH_TOKEN ]; then echo "No npm token defined; package not published."; fi - if [ -n $NODE_AUTH_TOKEN ]; then npm publish --access public --tag "$TAG_SLUG"; fi - if [ -n $NODE_AUTH_TOKEN ]; then echo "Package published. To install, run:"; fi - if [ -n $NODE_AUTH_TOKEN ]; then echo ""; fi - if [ -n $NODE_AUTH_TOKEN ]; then echo " npm install @inrupt/solid-client-notifications@$TAG_SLUG"; fi - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - TAG_SLUG: ${{ needs.prepare-deployment.outputs.tag-slug }} - - name: Mark GitHub Deployment as successful - if: github.actor != 'dependabot[bot]' - uses: octokit/request-action@v2.1.0 - with: - route: POST /repos/:repository/deployments/:deployment/statuses - repository: ${{ github.repository }} - deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} - environment: review - environment_url: 'https://www.npmjs.com/package/@inrupt/solid-client-notifications/v/${{ needs.prepare-deployment.outputs.tag-slug }}' - description: "Published to npm. To install, run: npm install @inrupt/solid-client-notifications@${{ needs.prepare-deployment.outputs.tag-slug }}" - log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - mediaType: '{"previews": ["flash", "ant-man"]}' - state: success - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: Mark GitHub Deployment as failed - uses: octokit/request-action@v2.1.0 - if: failure() - with: - route: POST /repos/:repository/deployments/:deployment/statuses - repository: ${{ github.repository }} - deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} - environment: review - description: "Publication to npm failed. Review the GitHub Actions log for more information." - log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - mediaType: '{"previews": ["flash", "ant-man"]}' - state: failure - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: Waiting for npm CDNs to update... - if: github.actor != 'dependabot[bot]' - run: | - echo "Giving npm some time to make the newly-published package available…" - sleep 5m - echo "Done waiting — hopefully that was enough time for the follow-up jobs to install the just-published package, to verify that everything looks OK." + - uses: actions/checkout@v3 + - name: Mark GitHub Deployment as in progress + id: start-deployment + uses: octokit/request-action@v2.x + if: github.actor != 'dependabot[bot]' + with: + route: POST /repos/:repository/deployments/:deployment/statuses + repository: ${{ github.repository }} + deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} + environment: review + description: "Publishing to npm tag [${{ needs.prepare-deployment.outputs.tag-slug }}]…" + log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + state: in_progress + mediaType: '{"previews": ["flash", "ant-man"]}' + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - uses: actions/setup-node@v3 + with: + node-version: "14.x" + registry-url: "https://registry.npmjs.org" + - name: Prepare prerelease version + id: determine-npm-version + if: github.actor != 'dependabot[bot]' + run: | + git config user.name $GITHUB_ACTOR + git config user.email gh-actions-${GITHUB_ACTOR}@github.com + # Unfortunately re-running a job does not change its run ID nor run number. + # To prevent re-releasing the same version when re-running the CD job, + # we incorporate a timestamp in the prerelease version: + TIMESTAMP=$(date --utc +%s) + # Make sure the prerelease is tagged with the branch name, and that they are sorted by build: + VERSION_NR=$(npm version prerelease --preid=$TAG_SLUG-$GITHUB_RUN_ID-$GITHUB_RUN_NUMBER-$TIMESTAMP) + echo "::set-output name=version-nr::$VERSION_NR" + env: + TAG_SLUG: ${{ needs.prepare-deployment.outputs.tag-slug }} + - run: npm ci + - name: Publish an npm tag for this branch + if: github.actor != 'dependabot[bot]' + run: | + # Unfortunately GitHub Actions does not currently let us do something like + # if: secrets.NPM_TOKEN != '' + # so simply skip the command if the env var is not set: + if [ -z $NODE_AUTH_TOKEN ]; then echo "No npm token defined; package not published."; fi + if [ -n $NODE_AUTH_TOKEN ]; then npm publish --access public --tag "$TAG_SLUG"; fi + if [ -n $NODE_AUTH_TOKEN ]; then echo "Package published. To install, run:"; fi + if [ -n $NODE_AUTH_TOKEN ]; then echo ""; fi + if [ -n $NODE_AUTH_TOKEN ]; then echo " npm install @inrupt/solid-client-notifications@$TAG_SLUG"; fi + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + TAG_SLUG: ${{ needs.prepare-deployment.outputs.tag-slug }} + - name: Mark GitHub Deployment as successful + if: github.actor != 'dependabot[bot]' + uses: octokit/request-action@v2.x + with: + route: POST /repos/:repository/deployments/:deployment/statuses + repository: ${{ github.repository }} + deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} + environment: review + environment_url: "https://www.npmjs.com/package/@inrupt/solid-client-notifications/v/${{ needs.prepare-deployment.outputs.tag-slug }}" + description: "Published to npm. To install, run: npm install @inrupt/solid-client-notifications@${{ needs.prepare-deployment.outputs.tag-slug }}" + log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + mediaType: '{"previews": ["flash", "ant-man"]}' + state: success + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Mark GitHub Deployment as failed + uses: octokit/request-action@v2.x + if: failure() + with: + route: POST /repos/:repository/deployments/:deployment/statuses + repository: ${{ github.repository }} + deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} + environment: review + description: "Publication to npm failed. Review the GitHub Actions log for more information." + log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + mediaType: '{"previews": ["flash", "ant-man"]}' + state: failure + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Waiting for npm CDNs to update... + if: github.actor != 'dependabot[bot]' + run: | + echo "Giving npm some time to make the newly-published package available…" + sleep 5m + echo "Done waiting — hopefully that was enough time for the follow-up jobs to install the just-published package, to verify that everything looks OK." verify-imports-node: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: matrix: node-version: [16.x, 14.x] needs: [prepare-deployment, publish-npm] steps: - - uses: actions/checkout@v2.3.4 - - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{ matrix.node-version }} - registry-url: 'https://registry.npmjs.org' - - name: Install the preview release of solid-client-notifications in the packaging test project - if: github.actor != 'dependabot[bot]' - run: | - cd .github/workflows/cd-packaging-tests/node - npm install @inrupt/solid-client-notifications@$VERSION_NR - env: - VERSION_NR: ${{ needs.publish-npm.outputs.version-nr }} - - name: Verify that the package can be imported in Node from a CommonJS module - if: github.actor != 'dependabot[bot]' - run: | - cd .github/workflows/cd-packaging-tests/node - node --unhandled-rejections=strict commonjs.cjs - - name: Verify that the package can be imported in Node from an ES module - if: github.actor != 'dependabot[bot]' - run: | - cd .github/workflows/cd-packaging-tests/node - node --unhandled-rejections=strict esmodule.mjs - # Node 10 does not support ES modules: - if: matrix.node-version != '10.x' + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + registry-url: "https://registry.npmjs.org" + - name: Install the preview release of solid-client-notifications in the packaging test project + if: github.actor != 'dependabot[bot]' + run: | + cd .github/workflows/cd-packaging-tests/node + npm install @inrupt/solid-client-notifications@$VERSION_NR + env: + VERSION_NR: ${{ needs.publish-npm.outputs.version-nr }} + - name: Verify that the package can be imported in Node from a CommonJS module + if: github.actor != 'dependabot[bot]' + run: | + cd .github/workflows/cd-packaging-tests/node + node --unhandled-rejections=strict commonjs.cjs + - name: Verify that the package can be imported in Node from an ES module + if: github.actor != 'dependabot[bot]' + run: | + cd .github/workflows/cd-packaging-tests/node + node --unhandled-rejections=strict esmodule.mjs verify-imports-parcel: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [prepare-deployment, publish-npm] steps: - - uses: actions/checkout@v2.3.4 - - uses: actions/setup-node@v2.1.5 - with: - node-version: '14.x' - registry-url: 'https://registry.npmjs.org' - - name: Verify that the package can be imported in a Parcel project - if: github.actor != 'dependabot[bot]' - run: | - cd .github/workflows/cd-packaging-tests/bundler-parcel - npm install - npm install @inrupt/solid-client-notifications@$VERSION_NR - # pin the version: https://github.com/parcel-bundler/parcel/issues/5943 - npx parcel@1.12.3 build index.ts - env: - VERSION_NR: ${{ needs.publish-npm.outputs.version-nr }} - - name: Archive Parcel build artifacts - if: github.actor != 'dependabot[bot]' - uses: actions/upload-artifact@v2.2.3 - continue-on-error: true - with: - name: parcel-dist - path: .github/workflows/cd-packaging-tests/bundler-parcel/dist + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: "14.x" + registry-url: "https://registry.npmjs.org" + - name: Verify that the package can be imported in a Parcel project + if: github.actor != 'dependabot[bot]' + run: | + cd .github/workflows/cd-packaging-tests/bundler-parcel + npm install + npm install @inrupt/solid-client-notifications@$VERSION_NR + # pin the version: https://github.com/parcel-bundler/parcel/issues/5943 + npx parcel@1.12.3 build index.ts + env: + VERSION_NR: ${{ needs.publish-npm.outputs.version-nr }} + - name: Archive Parcel build artifacts + if: github.actor != 'dependabot[bot]' + uses: actions/upload-artifact@v3 + continue-on-error: true + with: + name: parcel-dist + path: .github/workflows/cd-packaging-tests/bundler-parcel/dist verify-imports-webpack: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [prepare-deployment, publish-npm] steps: - - uses: actions/checkout@v2.3.4 - - uses: actions/setup-node@v2.1.5 - with: - node-version: '14.x' - registry-url: 'https://registry.npmjs.org' - - name: Verify that the package can be imported in a Webpack project - if: github.actor != 'dependabot[bot]' - run: | - cd .github/workflows/cd-packaging-tests/bundler-webpack - npm install @inrupt/solid-client-notifications@$VERSION_NR - npm install - npx webpack --devtool source-map - env: - VERSION_NR: ${{ needs.publish-npm.outputs.version-nr }} - - name: Archive Webpack build artifacts - uses: actions/upload-artifact@v2.2.3 - continue-on-error: true - if: github.actor != 'dependabot[bot]' - with: - name: webpack-dist - path: .github/workflows/cd-packaging-tests/bundler-webpack/dist + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: "14.x" + registry-url: "https://registry.npmjs.org" + - name: Verify that the package can be imported in a Webpack project + if: github.actor != 'dependabot[bot]' + run: | + cd .github/workflows/cd-packaging-tests/bundler-webpack + npm install @inrupt/solid-client-notifications@$VERSION_NR + npm install + npx webpack --devtool source-map + env: + VERSION_NR: ${{ needs.publish-npm.outputs.version-nr }} + - name: Archive Webpack build artifacts + uses: actions/upload-artifact@v3 + continue-on-error: true + if: github.actor != 'dependabot[bot]' + with: + name: webpack-dist + path: .github/workflows/cd-packaging-tests/bundler-webpack/dist # Run our Node-based end-to-end tests against the published package at least once, # to detect issues introduced by the build process: cd-end-to-end-tests: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest + environment: + name: "ESS Production" strategy: matrix: - node-version: [14.x] + node-version: [16.x] needs: [prepare-deployment, publish-npm] # Dependabot does not have access to our secrets, # so publishing packages for Dependabot PRs can only be manually started. # https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/ if: github.actor != 'dependabot[bot]' steps: - - uses: actions/checkout@v2.3.4 - - uses: actions/setup-node@v2.4.1 - with: - node-version: ${{ matrix.node-version }} - registry-url: 'https://registry.npmjs.org' - - run: npm ci - - name: Install the preview release of solid-client - # The `--force` allows us to install it even though our own package has the same name. - # See https://docs.npmjs.com/cli/v6/commands/npm-install#limitations-of-npms-install-algorithm - run: | - npm install --force @inrupt/solid-client@$VERSION_NR - env: - VERSION_NR: ${{ needs.publish-npm.outputs.version-nr }} - - name: Make sure that the end-to-end tests run against the just-published package - run: | - cd src/e2e-node - # For all files (`-type f`) in this directory, - # replace `../index` (i.e. in the import statement) with `@inrupt/solid-client`: - find ./ -type f -exec sed --in-place --expression='s/\.\.\/index/@inrupt\/solid-client/g' {} \; - - name: Run the Node-based end-to-end tests - run: npm run test:e2e:node - env: - E2E_TEST_ESS_POD: ${{ secrets.E2E_TEST_ESS_PROD_POD }} - E2E_TEST_ESS_IDP_URL: ${{ secrets.E2E_TEST_ESS_PROD_IDP_URL }} - E2E_TEST_ESS_CLIENT_ID: ${{ secrets.E2E_TEST_ESS_PROD_CLIENT_ID }} - E2E_TEST_ESS_CLIENT_SECRET: ${{ secrets.E2E_TEST_ESS_PROD_CLIENT_SECRET }} - E2E_TEST_DEV_NEXT_POD: ${{ secrets.E2E_TEST_DEV_NEXT_POD }} - E2E_TEST_DEV_NEXT_IDP_URL: ${{ secrets.E2E_TEST_DEV_NEXT_IDP_URL }} - E2E_TEST_DEV_NEXT_CLIENT_ID: ${{ secrets.E2E_TEST_DEV_NEXT_CLIENT_ID }} - E2E_TEST_DEV_NEXT_CLIENT_SECRET: ${{ secrets.E2E_TEST_DEV_NEXT_CLIENT_SECRET }} + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + registry-url: "https://registry.npmjs.org" + - run: npm ci + - name: Install the preview release of solid-client + # The `--force` allows us to install it even though our own package has the same name. + # See https://docs.npmjs.com/cli/v6/commands/npm-install#limitations-of-npms-install-algorithm + run: | + npm install --force @inrupt/solid-client-notifications@$VERSION_NR + env: + VERSION_NR: ${{ needs.publish-npm.outputs.version-nr }} + - name: Make sure that the end-to-end tests run against the just-published package + run: | + cd e2e/node + # For all files (`-type f`) in this directory, + # replace `../../src/index` (i.e. in the import statement) with `@inrupt/solid-client`: + find ./ -type f -exec sed --in-place --expression='s/\.\.\/\.\.\/src\/index/@inrupt\/solid-client-notifications/g' {} \; + - name: Run the Node-based end-to-end tests + run: npm run test:e2e:node + env: + E2E_TEST_NOTIFICATION_GATEWAY: ${{ secrets.E2E_TEST_NOTIFICATION_GATEWAY }} + E2E_TEST_NOTIFICATION_PROTOCOL: ${{ secrets.E2E_TEST_NOTIFICATION_PROTOCOL }} + E2E_TEST_IDP: ${{ secrets.E2E_TEST_IDP }} + E2E_TEST_CLIENT_ID: ${{ secrets.E2E_TEST_CLIENT_ID }} + E2E_TEST_CLIENT_SECRET: ${{ secrets.E2E_TEST_CLIENT_SECRET }} + E2E_TEST_ENVIRONMENT: "ESS Production" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b27a7661..f1d94299 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,24 +10,24 @@ jobs: strategy: matrix: # Available OS's: https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners - os: [ubuntu-20.04, windows-2019, macos-10.15] + os: [ubuntu-latest, windows-latest, macos-latest] node-version: [16.x, 14.x, 12.x] steps: - - uses: actions/checkout@v2.3.4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{ matrix.node-version }} - - name: Cache node modules - uses: actions/cache@v2.1.5 - env: - cache-name: cache-node-modules - with: - path: node_modules - key: ${{ runner.os }}-node${{ runner.node-version }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - - run: npm ci - - run: npm run build - - run: npm test + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Cache node modules + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + path: node_modules + key: ${{ runner.os }}-node${{ runner.node-version }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + - run: npm ci + - run: npm run build + - run: npm test lint: # FIXME: use a fixed version after it has been released diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index de939a6c..c2523203 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -8,13 +8,13 @@ name: "Static Application security Testing (CodeQL)" on: push: branches: - - '*' + - "*" pull_request: # The branches below must be a subset of the branches above branches: - - main + - main schedule: - - cron: '0 12 * * 6' + - cron: "0 12 * * 6" jobs: analyze: @@ -26,48 +26,48 @@ jobs: matrix: # Override automatic language detection by changing the below list # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] - language: ['javascript'] + language: ["javascript"] # Learn more... # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection steps: - - name: Checkout repository - uses: actions/checkout@v2.3.4 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 + - name: Checkout repository + uses: actions/checkout@v3 + with: + # We must fetch at least the immediate parents so that if this is + # a pull request then we can checkout the head. + fetch-depth: 2 - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} + # If this run was triggered by a pull request event, then checkout + # the head of the pull request instead of the merge commit. + - run: git checkout HEAD^2 + if: ${{ github.event_name == 'pull_request' }} - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - #- name: Autobuild - # uses: github/codeql-action/autobuild@v1 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + #- name: Autobuild + # uses: github/codeql-action/autobuild@v1 - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + #- run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/e2e-browser.yml b/.github/workflows/e2e-browser.yml index 91beac77..abaa9efb 100644 --- a/.github/workflows/e2e-browser.yml +++ b/.github/workflows/e2e-browser.yml @@ -21,34 +21,34 @@ jobs: # this library still implements the legacy one. environment-name: ["ESS Production"] steps: - - uses: actions/checkout@v2.3.4 - - name: Use Node.js 16.x - uses: actions/setup-node@v3 - with: - node-version: 16.x - cache: npm - - run: npm ci - - run: npm run build - - run: npx playwright install --with-deps - - run: npm run test:e2e:browser:setup - - run: npm run test:e2e:browser - env: - E2E_TEST_ENVIRONMENT: ${{ matrix.environment-name }} - E2E_TEST_UI_LOGIN: ${{ secrets.E2E_TEST_UI_LOGIN }} - E2E_TEST_UI_PASSWORD: ${{ secrets.E2E_TEST_UI_PASSWORD }} - E2E_TEST_NOTIFICATION_PROTOCOL: ${{ secrets.E2E_TEST_NOTIFICATION_PROTOCOL }} - E2E_TEST_NOTIFICATION_GATEWAY: ${{ secrets.E2E_TEST_NOTIFICATION_GATEWAY }} - E2E_TEST_IDP: ${{ secrets.E2E_TEST_IDP }} - - name: Archive browser-based end-to-end test request logs - uses: actions/upload-artifact@v3 - if: failure() - continue-on-error: true - with: - name: playwright-output - path: e2e/browser/test/test-results/ - - name: Archive production artifacts - uses: actions/upload-artifact@v3 - continue-on-error: true - with: - name: dist - path: dist + - uses: actions/checkout@v3 + - name: Use Node.js 16.x + uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: npm + - run: npm ci + - run: npm run build + - run: npx playwright install --with-deps + - run: npm run test:e2e:browser:setup + - run: npm run test:e2e:browser + env: + E2E_TEST_ENVIRONMENT: ${{ matrix.environment-name }} + E2E_TEST_UI_LOGIN: ${{ secrets.E2E_TEST_UI_LOGIN }} + E2E_TEST_UI_PASSWORD: ${{ secrets.E2E_TEST_UI_PASSWORD }} + E2E_TEST_NOTIFICATION_PROTOCOL: ${{ secrets.E2E_TEST_NOTIFICATION_PROTOCOL }} + E2E_TEST_NOTIFICATION_GATEWAY: ${{ secrets.E2E_TEST_NOTIFICATION_GATEWAY }} + E2E_TEST_IDP: ${{ secrets.E2E_TEST_IDP }} + - name: Archive browser-based end-to-end test request logs + uses: actions/upload-artifact@v3 + if: failure() + continue-on-error: true + with: + name: playwright-output + path: e2e/browser/test/test-results/ + - name: Archive production artifacts + uses: actions/upload-artifact@v3 + continue-on-error: true + with: + name: dist + path: dist diff --git a/.github/workflows/e2e-node.yml b/.github/workflows/e2e-node.yml index 6dd2160d..cae600c2 100644 --- a/.github/workflows/e2e-node.yml +++ b/.github/workflows/e2e-node.yml @@ -22,50 +22,50 @@ jobs: # NSS does not support static client registration, which we rely on for testing. environment-name: ["ESS Production", "ESS Dev-Next"] steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: npm - - run: npm ci - - run: npm run build - - run: npm run test:e2e:node - env: - E2E_TEST_NOTIFICATION_GATEWAY: ${{ secrets.E2E_TEST_NOTIFICATION_GATEWAY }} - E2E_TEST_NOTIFICATION_PROTOCOL: ${{ secrets.E2E_TEST_NOTIFICATION_PROTOCOL }} - E2E_TEST_IDP: ${{ secrets.E2E_TEST_IDP }} - E2E_TEST_CLIENT_ID: ${{ secrets.E2E_TEST_CLIENT_ID }} - E2E_TEST_CLIENT_SECRET: ${{ secrets.E2E_TEST_CLIENT_SECRET }} - E2E_TEST_ENVIRONMENT: ${{ matrix.environment-name }} - - name: Add status check with successful test result - id: set-status-check-success - uses: octokit/request-action@v2.1.0 - with: - route: POST /repos/:repository/statuses/:ref - repository: ${{ github.repository }} - ref: ${{ github.sha }} - state: success - context: 'End-to-end tests (node)' - description: 'Node.js notification end-to-end tests' - target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}?check_suite_focus=true - # The deployment runs in parallel with CI, so status checks will never have succeeded yet: - required_contexts: "[]" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: Add status check with failed test result - id: set-status-check-failure - if: failure() - uses: octokit/request-action@v2.1.0 - with: - route: POST /repos/:repository/statuses/:ref - repoitory: ${{ github.repository }} - ref: ${{ github.sha }} - state: failure - context: 'End-to-end tests (node)' - description: 'Node.js notification end-to-end tests' - target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}?check_suite_focus=true - # The deployment runs in parallel with CI, so status checks will never have succeeded yet: - required_contexts: "[]" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: npm + - run: npm ci + - run: npm run build + - run: npm run test:e2e:node + env: + E2E_TEST_NOTIFICATION_GATEWAY: ${{ secrets.E2E_TEST_NOTIFICATION_GATEWAY }} + E2E_TEST_NOTIFICATION_PROTOCOL: ${{ secrets.E2E_TEST_NOTIFICATION_PROTOCOL }} + E2E_TEST_IDP: ${{ secrets.E2E_TEST_IDP }} + E2E_TEST_CLIENT_ID: ${{ secrets.E2E_TEST_CLIENT_ID }} + E2E_TEST_CLIENT_SECRET: ${{ secrets.E2E_TEST_CLIENT_SECRET }} + E2E_TEST_ENVIRONMENT: ${{ matrix.environment-name }} + - name: Add status check with successful test result + id: set-status-check-success + uses: octokit/request-action@v2.x + with: + route: POST /repos/:repository/statuses/:ref + repository: ${{ github.repository }} + ref: ${{ github.sha }} + state: success + context: "End-to-end tests (node)" + description: "Node.js notification end-to-end tests" + target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}?check_suite_focus=true + # The deployment runs in parallel with CI, so status checks will never have succeeded yet: + required_contexts: "[]" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Add status check with failed test result + id: set-status-check-failure + if: failure() + uses: octokit/request-action@v2.x + with: + route: POST /repos/:repository/statuses/:ref + repoitory: ${{ github.repository }} + ref: ${{ github.sha }} + state: failure + context: "End-to-end tests (node)" + description: "Node.js notification end-to-end tests" + target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}?check_suite_focus=true + # The deployment runs in parallel with CI, so status checks will never have succeeded yet: + required_contexts: "[]" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 269a6c0b..b187d871 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,198 +1,198 @@ name: Release -on: - push: - tags: - - v[0-9]+.[0-9]+.[0-9]+ +on: + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+ env: CI: true jobs: prepare-deployment: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest outputs: deployment-id: ${{ fromJson(steps.create-deployment.outputs.data).id }} steps: - - name: Create GitHub Deployment - id: create-deployment - uses: octokit/request-action@v2.1.0 - with: - route: POST /repos/:repository/deployments - repository: ${{ github.repository }} - ref: ${{ github.sha }} - environment: review - transient_environment: true - auto_merge: false - mediaType: '{"previews": ["flash", "ant-man"]}' - # The deployment runs in parallel with CI, so status checks will never have succeeded yet: - required_contexts: '[]' - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Create GitHub Deployment + id: create-deployment + uses: octokit/request-action@v2.x + with: + route: POST /repos/:repository/deployments + repository: ${{ github.repository }} + ref: ${{ github.sha }} + environment: review + transient_environment: true + auto_merge: false + mediaType: '{"previews": ["flash", "ant-man"]}' + # The deployment runs in parallel with CI, so status checks will never have succeeded yet: + required_contexts: "[]" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" publish-npm: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [prepare-deployment] steps: - - uses: actions/checkout@v2.3.4 - - name: Mark GitHub Deployment as in progress - id: start-deployment - uses: octokit/request-action@v2.1.0 - with: - route: POST /repos/:repository/deployments/:deployment/statuses - repository: ${{ github.repository }} - deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} - environment: review - description: "Publishing to npm tag [${GITHUB_REF#refs/tags/v}]…" - log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - state: in_progress - mediaType: '{"previews": ["flash", "ant-man"]}' - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: Prepare for publication to npm - uses: actions/setup-node@v2.1.5 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - run: npm ci - - name: Publish to npm - run: | - npm publish --access public - echo "Package published. To install, run:" - echo "" - echo " npm install @inrupt/solid-client-notifications" - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Mark GitHub Deployment as successful - uses: octokit/request-action@v2.1.0 - with: - route: POST /repos/:repository/deployments/:deployment/statuses - repository: ${{ github.repository }} - deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} - environment: review - environment_url: 'https://www.npmjs.com/package/@inrupt/solid-client-notifications/v/${GITHUB_REF#refs/tags/v}' - description: "Published to npm. To install, run: npm install @inrupt/solid-client-notifications@${GITHUB_REF#refs/tags/v}" - log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - mediaType: '{"previews": ["flash", "ant-man"]}' - state: success - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: Mark GitHub Deployment as failed - uses: octokit/request-action@v2.1.0 - if: failure() - with: - route: POST /repos/:repository/deployments/:deployment/statuses - repository: ${{ github.repository }} - deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} - environment: review - description: "Publication to npm failed. Review the GitHub Actions log for more information." - log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} - mediaType: '{"previews": ["flash", "ant-man"]}' - state: failure - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - name: Waiting for npm CDNs to update... - run: | - echo "Giving npm some time to make the newly-published package available…" - sleep 5m - echo "Done waiting — hopefully that was enough time for the follow-up jobs to install the just-published package, to verify that everything looks OK." + - uses: actions/checkout@v3 + - name: Mark GitHub Deployment as in progress + id: start-deployment + uses: octokit/request-action@v2.x + with: + route: POST /repos/:repository/deployments/:deployment/statuses + repository: ${{ github.repository }} + deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} + environment: review + description: "Publishing to npm tag [${GITHUB_REF#refs/tags/v}]…" + log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + state: in_progress + mediaType: '{"previews": ["flash", "ant-man"]}' + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Prepare for publication to npm + uses: actions/setup-node@v3 + with: + node-version: "16.x" + registry-url: "https://registry.npmjs.org" + - run: npm ci + - name: Publish to npm + run: | + npm publish --access public + echo "Package published. To install, run:" + echo "" + echo " npm install @inrupt/solid-client-notifications" + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Mark GitHub Deployment as successful + uses: octokit/request-action@v2.x + with: + route: POST /repos/:repository/deployments/:deployment/statuses + repository: ${{ github.repository }} + deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} + environment: review + environment_url: "https://www.npmjs.com/package/@inrupt/solid-client-notifications/v/${GITHUB_REF#refs/tags/v}" + description: "Published to npm. To install, run: npm install @inrupt/solid-client-notifications@${GITHUB_REF#refs/tags/v}" + log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + mediaType: '{"previews": ["flash", "ant-man"]}' + state: success + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Mark GitHub Deployment as failed + uses: octokit/request-action@v2.x + if: failure() + with: + route: POST /repos/:repository/deployments/:deployment/statuses + repository: ${{ github.repository }} + deployment: ${{ needs.prepare-deployment.outputs.deployment-id }} + environment: review + description: "Publication to npm failed. Review the GitHub Actions log for more information." + log_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} + mediaType: '{"previews": ["flash", "ant-man"]}' + state: failure + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Waiting for npm CDNs to update... + run: | + echo "Giving npm some time to make the newly-published package available…" + sleep 5m + echo "Done waiting — hopefully that was enough time for the follow-up jobs to install the just-published package, to verify that everything looks OK." verify-imports-node: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: matrix: node-version: [16.x, 14.x] needs: [prepare-deployment, publish-npm] steps: - - uses: actions/checkout@v2.3.4 - - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{ matrix.node-version }} - registry-url: 'https://registry.npmjs.org' - - name: Install the preview release of solid-client-notifications in the packaging test project - run: | - cd .github/workflows/cd-packaging-tests/node - npm install @inrupt/solid-client-notifications - - name: Verify that the package can be imported in Node from a CommonJS module - run: | - cd .github/workflows/cd-packaging-tests/node - node --unhandled-rejections=strict commonjs.cjs - - name: Verify that the package can be imported in Node from an ES module - run: | - cd .github/workflows/cd-packaging-tests/node - node --unhandled-rejections=strict esmodule.mjs + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + registry-url: "https://registry.npmjs.org" + - name: Install the preview release of solid-client-notifications in the packaging test project + run: | + cd .github/workflows/cd-packaging-tests/node + npm install @inrupt/solid-client-notifications + - name: Verify that the package can be imported in Node from a CommonJS module + run: | + cd .github/workflows/cd-packaging-tests/node + node --unhandled-rejections=strict commonjs.cjs + - name: Verify that the package can be imported in Node from an ES module + run: | + cd .github/workflows/cd-packaging-tests/node + node --unhandled-rejections=strict esmodule.mjs verify-imports-parcel: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [prepare-deployment, publish-npm] steps: - - uses: actions/checkout@v2.3.4 - - uses: actions/setup-node@v2.1.5 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - name: Verify that the package can be imported in a Parcel project - run: | - cd .github/workflows/cd-packaging-tests/bundler-parcel - npm install @inrupt/solid-client-notifications - npx parcel build index.ts - - name: Archive Parcel build artifacts - uses: actions/upload-artifact@v2.2.3 - with: - name: parcel-dist - path: .github/workflows/cd-packaging-tests/bundler-parcel/dist + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: "16.x" + registry-url: "https://registry.npmjs.org" + - name: Verify that the package can be imported in a Parcel project + run: | + cd .github/workflows/cd-packaging-tests/bundler-parcel + npm install @inrupt/solid-client-notifications + npx parcel build index.ts + - name: Archive Parcel build artifacts + uses: actions/upload-artifact@v3 + with: + name: parcel-dist + path: .github/workflows/cd-packaging-tests/bundler-parcel/dist verify-imports-webpack: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: [prepare-deployment, publish-npm] steps: - - uses: actions/checkout@v2.3.4 - - uses: actions/setup-node@v2.1.5 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - - name: Verify that the package can be imported in a Webpack project - run: | - cd .github/workflows/cd-packaging-tests/bundler-webpack - npm install @inrupt/solid-client-notifications - npm install webpack@5 webpack-cli buffer - npx webpack --devtool source-map - - name: Archive Webpack build artifacts - uses: actions/upload-artifact@v2.2.3 - with: - name: webpack-dist - path: .github/workflows/cd-packaging-tests/bundler-webpack/dist + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: "16.x" + registry-url: "https://registry.npmjs.org" + - name: Verify that the package can be imported in a Webpack project + run: | + cd .github/workflows/cd-packaging-tests/bundler-webpack + npm install @inrupt/solid-client-notifications + npm install webpack@5 webpack-cli buffer + npx webpack --devtool source-map + - name: Archive Webpack build artifacts + uses: actions/upload-artifact@v3 + with: + name: webpack-dist + path: .github/workflows/cd-packaging-tests/bundler-webpack/dist # Run our Node-based end-to-end tests against the published package at least once, # to detect issues introduced by the build process: cd-end-to-end-tests: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: matrix: node-version: [16.x] needs: [prepare-deployment, publish-npm] steps: - - uses: actions/checkout@v2.3.4 - - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{ matrix.node-version }} - registry-url: 'https://registry.npmjs.org' - - run: npm ci - - name: Install the preview release of solid-client-notifications - # The `--force` allows us to install it even though our own package has the same name. - # See https://docs.npmjs.com/cli/v6/commands/npm-install#limitations-of-npms-install-algorithm - run: | - npm install --force @inrupt/solid-client-notifications - - name: Make sure that the end-to-end tests run against the just-published package - run: | - cd e2e/node - # For all files (`-type f`) in this directory, - # replace `../index` (i.e. in the import statement) with `@inrupt/solid-client-notifications`: - find ./ -type f -exec sed --in-place --expression='s/\.\.\/index/@inrupt\/solid-client-notifications/g' {} \; - - name: Run the Node-based end-to-end tests - run: npm run test:e2e:node - env: - E2E_TEST_ESS_NOTIFICATION_GATEWAY: ${{secrets.E2E_TEST_ESS_PROD_NOTIFICATION_GATEWAY}} - E2E_TEST_ESS_POD: ${{ secrets.E2E_TEST_ESS_PROD_POD }} - E2E_TEST_ESS_IDP_URL: ${{ secrets.E2E_TEST_ESS_PROD_IDP_URL }} - E2E_TEST_ESS_CLIENT_ID: ${{ secrets.E2E_TEST_ESS_PROD_CLIENT_ID }} - E2E_TEST_ESS_CLIENT_SECRET: ${{ secrets.E2E_TEST_ESS_PROD_CLIENT_SECRET }} + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + registry-url: "https://registry.npmjs.org" + - run: npm ci + - name: Install the preview release of solid-client-notifications + # The `--force` allows us to install it even though our own package has the same name. + # See https://docs.npmjs.com/cli/v6/commands/npm-install#limitations-of-npms-install-algorithm + run: | + npm install --force @inrupt/solid-client-notifications + - name: Make sure that the end-to-end tests run against the just-published package + run: | + cd e2e/node + # For all files (`-type f`) in this directory, + # replace `../index` (i.e. in the import statement) with `@inrupt/solid-client-notifications`: + find ./ -type f -exec sed --in-place --expression='s/\.\.\/index/@inrupt\/solid-client-notifications/g' {} \; + - name: Run the Node-based end-to-end tests + run: npm run test:e2e:node + env: + E2E_TEST_ESS_NOTIFICATION_GATEWAY: ${{secrets.E2E_TEST_ESS_PROD_NOTIFICATION_GATEWAY}} + E2E_TEST_ESS_POD: ${{ secrets.E2E_TEST_ESS_PROD_POD }} + E2E_TEST_ESS_IDP_URL: ${{ secrets.E2E_TEST_ESS_PROD_IDP_URL }} + E2E_TEST_ESS_CLIENT_ID: ${{ secrets.E2E_TEST_ESS_PROD_CLIENT_ID }} + E2E_TEST_ESS_CLIENT_SECRET: ${{ secrets.E2E_TEST_ESS_PROD_CLIENT_SECRET }} diff --git a/package.json b/package.json index ed52fab7..f6aac0bb 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "lint:fix": "npm run lint:eslint -- --fix && npm run lint:prettier -- --write", "lint:check": "npm run lint:eslint && npm run lint:prettier -- --check", "lint:eslint": "eslint --config .eslintrc.js \"src/\" \"e2e/\"", - "lint:prettier": "prettier \"{src,e2e}/**/*.{ts,tsx,js,jsx,css}\" \"*.{md,mdx,yml}\"", + "lint:prettier": "prettier \"{src,e2e}/**/*.{ts,tsx,js,jsx,css}\" \"**/*.{md,mdx,yml}\"", "test": "jest src", "test:e2e:node": "jest --config=jest.e2e.config.js e2e/node", "test:e2e:browser": "cd e2e/browser/test && playwright test",