From bca7255470ed2804ffec53a93151a5353d8a2c23 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 5 Apr 2022 10:57:28 +0100 Subject: [PATCH 01/45] Update README.md --- README.md | 129 +----------------------------------------------------- 1 file changed, 1 insertion(+), 128 deletions(-) diff --git a/README.md b/README.md index 8e33b32b5e..1fecce836d 100644 --- a/README.md +++ b/README.md @@ -1,128 +1 @@ -# MOD.UK [Design System](https://design-system.digital.mod.uk/) - - ![Build & Test Master](https://github.com/defencedigital/mod-uk-design-system/workflows/Build%20&%20Test%20Master/badge.svg) - [![GitHub release](https://img.shields.io/github/release/royal-navy/design-system.svg)](https://github.com/defencedigital/mod-uk-design-system/releases) [![GitHub license](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://github.com/design-system/blob/master/LICENSE) [![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=defencedigital_mod-uk-design-system&metric=coverage)](https://sonarcloud.io/dashboard?id=defencedigital_mod-uk-design-system) [![Storybook](https://cdn.jsdelivr.net/gh/storybookjs/brand@master/badge/badge-storybook.svg)](http://storybook.design-system.digital.mod.uk) - -Build web applications that meet the Defence Digital service standards. - -Visit the [Roadmap board](https://github.com/defencedigital/mod-uk-design-system/projects/7) to view the high-level objectives for the MOD.UK Design System. To check on issues currently being completed, view our [Tactical board](https://github.com/defencedigital/mod-uk-design-system/projects/6) instead. - -## Releases & versioning - -All packages are published to the [NPM registry](https://www.npmjs.com/search?q=%40defencedigital) and we adhere to [semantic versioning](https://semver.org/). - -## Supported technologies - -The following view layer libraries are currently supported: - -- React - -## Component usage guidelines - -Please refer to the [component demo pages](https://design-system.digital.mod.uk/components) and [Storybook](http://storybook.design-system.digital.mod.uk/) to see interactive examples, code snippets and details on how best to consume each of the components. - -## Installation & quick start - -### Installation - -To install and save to your project's package.json dependencies, run: - -``` -# with npm -npm install @defencedigital/fonts @defencedigital/react-component-library styled-components - -# ...or with yarn -yarn add @defencedigital/fonts @defencedigital/react-component-library styled-components -``` - -Note: [`styled-components`](https://styled-components.com/) is a required [peer dependency](https://nodejs.org/en/blog/npm/peer-dependencies/) and is installed with the above command. - -### Quick start - -Here's a quick example application to get you started: - -```javascript -import React from 'react' -import ReactDOM from 'react-dom' -import '@defencedigital/fonts' -import { GlobalStyleProvider, Button } from '@defencedigital/react-component-library' - -function App() { - return ( - - - - ) -} - -ReactDOM.render(, document.querySelector('#app')) -``` - -## Monorepo & package management - ->Splitting up large codebases into separate independently versioned packages is extremely useful for code sharing. However, making changes across many repositories is messy and difficult to track, and testing across repositories gets complicated really fast. -> ->To solve these (and many other) problems, some projects will organize their codebases into multi-package repositories (sometimes called monorepos). - -Each package folder has it's own npm package.json and can act like a stand alone project. Yarn workspaces detects dependencies that are held within the monorepo and creates a link between them, so you can work on a react component and see instant updates in Storybook. - -Manage dependencies for packages like normal, but remember to use `yarn add` instead of `npm install`. - -## Run locally - -You'll need [Git](https://help.github.com/articles/set-up-git/) and [Node.js](https://nodejs.org/en/) installed to get this project running. - -Note: You will need the [active LTS (Long-term support)](https://github.com/nodejs/Release#release-schedule) Node.js version for this project (as specified in [.nvmrc](./.nvmrc)) - -### Fork repository (optional) -If you're an external contributor make sure to [fork this project first](https://help.github.com/articles/fork-a-repo/) - -### Clone repository -``` -git clone git@github.com:Royal-Navy/design-system.git # or clone your own fork - -cd design-system -``` - -### Using nvm (optional) -If you work across multiple Node.js projects there's a good chance they require different Node.js and npm versions. - -To enable this we use [nvm (Node Version Manager)](https://github.com/creationix/nvm) to switch between versions easily. - -1. [Install nvm](https://github.com/creationix/nvm#installation) -2. Run `nvm install` in the project directory (this will use [.nvmrc](./.nvmrc)) - -## Scripts - -The top level project contains scripts that are then executed for all packages. - -- `lint` Checks syntax and simple errors in javascript files. -- `test` Runs Jest tests in all the packages. -- `build` Runs the build script in all packages. - -## Git hooks - -Git commit hooks trigger linting of all staged files when a change is committed. - -## Prettier - -We have configured a set of Prettier options to enforce consistent code formatting. - -## Browser support - -The MOD.UK Design System currently supports all major evergreen browsers. - -## Licensing - -The defencedigital/mod-uk-design-system is licensed under the [Apache License 2.0](https://github.com/defencedigital/mod-uk-design-system/blob/master/LICENSE). - -## Contributing -Read the [contributing guidelines](docs/contributing.md). - -## Thanks - - - -We use [Chromatic](https://www.chromaticqa.com/) for visual regression testing. +# This repo is for testing GitHub Actions only. From 242f373d51f8bb129989cfc0c437fd75e62795ea Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 5 Apr 2022 13:28:42 +0100 Subject: [PATCH 02/45] Delete CODEOWNERS --- .github/CODEOWNERS | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 619ba1f5e0..0000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,8 +0,0 @@ -# This is a comment. -# Each line is a file pattern followed by one or more owners. - -# These owners will be the default owners for everything in -# the repo. Unless a later match takes precedence, -# @thyhjwb6, @m7kvqbe1 and @jpveooys will be requested for -# review when someone opens a pull request. -* @thyhjwb6 @m7kvqbe1 @jpveooys From 94f52d8f8ef60eea6f9edd3cd80b9a1cf4cb2018 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 5 Apr 2022 13:29:23 +0100 Subject: [PATCH 03/45] Delete dependabot.yml --- .github/dependabot.yml | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 97aa6d2588..0000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,19 +0,0 @@ -version: 2 -updates: -- package-ecosystem: npm - directory: "/" - schedule: - interval: weekly - open-pull-requests-limit: 5 - reviewers: - - m7kvqbe1 - - thyhjwb6 - labels: - - "Type: Dependencies" - commit-message: - prefix: chore(Security) - rebase-strategy: auto - ignore: - # Newer versions break older browsers, see e.g. https://github.com/juliencrn/usehooks-ts/issues/97 - - dependency-name: "usehooks-ts" - versions: [">2.2.1"] From 4eb2403f82560a596faab9fcefe87fcd4a1db9a4 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 5 Apr 2022 13:39:32 +0100 Subject: [PATCH 04/45] Update sonar-project.properties --- sonar-project.properties | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index 371c363f69..368f4be54d 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,7 +1,8 @@ -sonar.organization=defencedigital -sonar.projectKey=defencedigital_mod-uk-design-system +sonar.projectKey=jpveooys_github-actions-testing +sonar.organization=jpveooys + # This is the name and version displayed in the SonarCloud UI. -sonar.projectName=mod-uk-design-system +sonar.projectName=github-actions-testing #sonar.projectVersion=1.0 # Path to sources From 46bfebf767aad0884ca55c8c5941bbfc0872eae7 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 5 Apr 2022 15:45:05 +0100 Subject: [PATCH 05/45] ci(GHA): Refactor visual regression tests --- .github/workflows/build_and_test.yml | 16 ++++--- .github/workflows/visual_regression.yml | 58 +++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/visual_regression.yml diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 4e11f0a1f4..e35e0a1969 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -121,7 +121,7 @@ jobs: - name: SonarCloud Scan uses: defencedigital/design-system-sonarcloud-action@master - if: ${{ github.actor != 'dependabot[bot]' }} + if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} @@ -219,11 +219,9 @@ jobs: yarn --cwd packages/design-tokens build yarn --cwd packages/design-tokens test - Test_visual_regression: + Build_storybook: runs-on: ubuntu-latest needs: [Build_icon_library, Test_react-component-library] - # 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: - name: Git clone repository uses: actions/checkout@v2 @@ -241,7 +239,13 @@ jobs: with: name: dist - - name: Run visual regression tests + - name: Build Storybook run: | tar -xzf dist.tar.gz && mv distil packages/icon-library/dist && mv distdt packages/design-tokens/dist - yarn --cwd packages/react-component-library chromatic --project-token=${{secrets.CHROMATIC_TOKEN}} --ci + yarn --cwd packages/react-component-library storybook:static + + - name: Upload Storybook artifact + uses: actions/upload-artifact@v3 + with: + name: storybook-static + path: .static_storybook diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml new file mode 100644 index 0000000000..15294d50b7 --- /dev/null +++ b/.github/workflows/visual_regression.yml @@ -0,0 +1,58 @@ +name: SonarCloud scan + +on: + workflow_run: + types: + - completed + workflows: + - 'Build & Test' + +jobs: + test_visual_regression: + name: Run visual regression tests + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - name: Git clone repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Cache Node modules + uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-modules-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }} + + - name: Install dependencies + run: | + yarn install --frozen-lockfile + + - name: 'Download pre-built Storybook' + uses: actions/github-script@v6 + with: + script: | + const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + }); + const matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name == "storybook-static" + })[0]; + const download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + const fs = require('fs'); + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/storybook-static.zip`, Buffer.from(download.data)); + + - name: 'Unzip pre-built Storybook' + run: unzip storybook-static.zip -d packages/react-component-library/.static_storybook + + - name: Run visual regression tests + run: | + cd packages/react-component-library + npx --no chromatic --storybook-build-dir .static_storybook --branch-name ${{ github.event.workflow_run.pull_requests[0].head.label }} From 096ca0552d96d4ac8b2d353b04400eb1495a9875 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 5 Apr 2022 16:19:08 +0100 Subject: [PATCH 06/45] ci(GHA): Refactor visual regression tests --- .github/workflows/visual_regression.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index 15294d50b7..17ac450369 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -53,6 +53,8 @@ jobs: run: unzip storybook-static.zip -d packages/react-component-library/.static_storybook - name: Run visual regression tests + env: + CHROMATIC_SHA: ${{ github.event.workflow_run.head_sha }} run: | cd packages/react-component-library npx --no chromatic --storybook-build-dir .static_storybook --branch-name ${{ github.event.workflow_run.pull_requests[0].head.label }} From eb2f2ec41156f0f4c045069ccf74495458070605 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 5 Apr 2022 16:26:11 +0100 Subject: [PATCH 07/45] ci(GHA): Refactor visual regression tests --- .github/workflows/visual_regression.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index 17ac450369..2a80e2b9e0 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -1,4 +1,4 @@ -name: SonarCloud scan +name: Visual regression tests on: workflow_run: From a2c9f8e52e85294587d3b66ef262964fab293049 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 5 Apr 2022 16:48:57 +0100 Subject: [PATCH 08/45] ci(GHA): Create local-pr-test --- .github/workflows/visual_regression.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index 2a80e2b9e0..cfb5d2a058 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -57,4 +57,4 @@ jobs: CHROMATIC_SHA: ${{ github.event.workflow_run.head_sha }} run: | cd packages/react-component-library - npx --no chromatic --storybook-build-dir .static_storybook --branch-name ${{ github.event.workflow_run.pull_requests[0].head.label }} + npx --no chromatic --storybook-build-dir .static_storybook --branch-name ${{ github.event.workflow_run.pull_requests[0].head.label }} --project-token=${{secrets.CHROMATIC_TOKEN}} From 105ebad846db80a633d39c2b83a7d926ffb0d886 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 5 Apr 2022 17:01:46 +0100 Subject: [PATCH 09/45] ci(GHA): Create local-pr-test --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index e35e0a1969..cb51a77e87 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -248,4 +248,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: storybook-static - path: .static_storybook + path: packages/react-component-library/.static_storybook From c10bbda3a4d2128fe7aa5a1496325ebae371de5c Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 5 Apr 2022 17:05:28 +0100 Subject: [PATCH 10/45] ci(GHA): Create local-pr-test --- .github/workflows/visual_regression.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index cfb5d2a058..d27eb7f101 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -57,4 +57,4 @@ jobs: CHROMATIC_SHA: ${{ github.event.workflow_run.head_sha }} run: | cd packages/react-component-library - npx --no chromatic --storybook-build-dir .static_storybook --branch-name ${{ github.event.workflow_run.pull_requests[0].head.label }} --project-token=${{secrets.CHROMATIC_TOKEN}} + npx --no chromatic --storybook-build-dir .static_storybook --branch-name ${{ github.event.workflow_run.pull_requests[0].head.label }} --project-token ${{secrets.CHROMATIC_TOKEN}} From 97ff4362a6e07b16c4de0002071abd5a7d58c6c5 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 5 Apr 2022 18:02:40 +0100 Subject: [PATCH 11/45] ci(GHA): Create local-pr-test --- .github/workflows/visual_regression.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index d27eb7f101..1afddcf2b6 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -57,4 +57,4 @@ jobs: CHROMATIC_SHA: ${{ github.event.workflow_run.head_sha }} run: | cd packages/react-component-library - npx --no chromatic --storybook-build-dir .static_storybook --branch-name ${{ github.event.workflow_run.pull_requests[0].head.label }} --project-token ${{secrets.CHROMATIC_TOKEN}} + npx exec --no chromatic -- --project-token ${{secrets.CHROMATIC_TOKEN}} --storybook-build-dir .static_storybook --branch-name ${{ github.event.workflow_run.pull_requests[0].head.label }} From ac7d33620b96688ee2ff2955fbd4fd6cbeb13ae5 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 5 Apr 2022 18:15:51 +0100 Subject: [PATCH 12/45] ci(GHA): Create local-pr-test --- .github/workflows/visual_regression.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index 1afddcf2b6..abb2e5ad4e 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -57,4 +57,4 @@ jobs: CHROMATIC_SHA: ${{ github.event.workflow_run.head_sha }} run: | cd packages/react-component-library - npx exec --no chromatic -- --project-token ${{secrets.CHROMATIC_TOKEN}} --storybook-build-dir .static_storybook --branch-name ${{ github.event.workflow_run.pull_requests[0].head.label }} + npm exec --no chromatic -- --project-token ${{secrets.CHROMATIC_TOKEN}} --storybook-build-dir .static_storybook --branch-name ${{ github.event.workflow_run.pull_requests[0].head.label }} From eab2d11ac6d2c517272ab1d1623b3b6fb016b667 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 5 Apr 2022 19:21:12 +0100 Subject: [PATCH 13/45] ci(GHA): Create local-pr-test --- .github/workflows/visual_regression.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index abb2e5ad4e..7daa7f46ad 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -55,6 +55,8 @@ jobs: - name: Run visual regression tests env: CHROMATIC_SHA: ${{ github.event.workflow_run.head_sha }} + CHROMATIC_BRANCH: ${{ github.event.workflow_run.pull_requests[0].head.label }} + CHROMATIC_SLUG: ${{ github.repository }} run: | cd packages/react-component-library - npm exec --no chromatic -- --project-token ${{secrets.CHROMATIC_TOKEN}} --storybook-build-dir .static_storybook --branch-name ${{ github.event.workflow_run.pull_requests[0].head.label }} + npm exec --no chromatic -- --project-token ${{secrets.CHROMATIC_TOKEN}} --storybook-build-dir .static_storybook From 538101e6b393417b65b718c9e12825f31152ac53 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Wed, 6 Apr 2022 09:29:15 +0100 Subject: [PATCH 14/45] ci(GHA): Create local-pr-test --- .github/workflows/visual_regression.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index 7daa7f46ad..c95ea98191 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -52,6 +52,13 @@ jobs: - name: 'Unzip pre-built Storybook' run: unzip storybook-static.zip -d packages/react-component-library/.static_storybook + - name: Dump context + env: + GITHUB_EVENT_CONTEXT: ${{ toJson(github.event) }} + run: | + echo -e "$GITHUB_EVENT_CONTEXT" + + shell: bash - name: Run visual regression tests env: CHROMATIC_SHA: ${{ github.event.workflow_run.head_sha }} From c6455b35a65934caddd81597a67f44d607a91fea Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Wed, 6 Apr 2022 09:30:20 +0100 Subject: [PATCH 15/45] ci(GHA): Create local-pr-test --- .github/workflows/visual_regression.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index c95ea98191..280ee7df22 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -57,8 +57,8 @@ jobs: GITHUB_EVENT_CONTEXT: ${{ toJson(github.event) }} run: | echo -e "$GITHUB_EVENT_CONTEXT" + shell: bash - shell: bash - name: Run visual regression tests env: CHROMATIC_SHA: ${{ github.event.workflow_run.head_sha }} From 5dafc2d9b58f7af0837abbf1641361c8d10b8df5 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Wed, 6 Apr 2022 09:55:42 +0100 Subject: [PATCH 16/45] ci(GHA): Create local-pr-test --- .github/workflows/visual_regression.yml | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index 280ee7df22..d94220463f 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -52,18 +52,12 @@ jobs: - name: 'Unzip pre-built Storybook' run: unzip storybook-static.zip -d packages/react-component-library/.static_storybook - - name: Dump context + - uses: chromaui/action@v1 + name: Run visual regression tests env: - GITHUB_EVENT_CONTEXT: ${{ toJson(github.event) }} - run: | - echo -e "$GITHUB_EVENT_CONTEXT" - shell: bash - - - name: Run visual regression tests - env: - CHROMATIC_SHA: ${{ github.event.workflow_run.head_sha }} - CHROMATIC_BRANCH: ${{ github.event.workflow_run.pull_requests[0].head.label }} - CHROMATIC_SLUG: ${{ github.repository }} - run: | - cd packages/react-component-library - npm exec --no chromatic -- --project-token ${{secrets.CHROMATIC_TOKEN}} --storybook-build-dir .static_storybook + GITHUB_SHA: ${{ github.event.workflow_run.head_sha }} + GITHUB_REF: refs/pulls/${{ github.event.workflow_run.pull_requests[0].number }}/merge + with: + projectToken: ${{secrets.CHROMATIC_TOKEN}} + workingDir: packages/react-component-library + storybookBuildDir: .static_storybook From c1ede5787a1c8b3d917160d1bc972851240abc19 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Wed, 6 Apr 2022 11:29:13 +0100 Subject: [PATCH 17/45] ci(GHA): Create local-pr-test --- .github/workflows/visual_regression.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index d94220463f..3865a56ec5 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -7,6 +7,10 @@ on: workflows: - 'Build & Test' +env: + PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} + HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} + jobs: test_visual_regression: name: Run visual regression tests @@ -18,6 +22,11 @@ jobs: with: fetch-depth: 0 + - name: Fetch PR ref + if: env.PR_NUMBER + run: | + git fetch +refs/pull/${{ env.PR_NUMBER }}/merge + - name: Cache Node modules uses: actions/cache@v2 with: @@ -56,8 +65,9 @@ jobs: name: Run visual regression tests env: GITHUB_SHA: ${{ github.event.workflow_run.head_sha }} - GITHUB_REF: refs/pulls/${{ github.event.workflow_run.pull_requests[0].number }}/merge + GITHUB_REF: ${{ env.PR_NUMBER && format('refs/pull/{}/merge', env.PR_NUMBER) || format('refs/heads/{0}', env.HEAD_BRANCH) }} with: projectToken: ${{secrets.CHROMATIC_TOKEN}} workingDir: packages/react-component-library storybookBuildDir: .static_storybook + exitZeroOnChanges: false From e1b77cce796b0ede14f70f10d84aadf828e2a164 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Wed, 6 Apr 2022 11:48:25 +0100 Subject: [PATCH 18/45] ci(GHA): Create local-pr-test --- .github/workflows/build_and_test.yml | 3 +++ .github/workflows/visual_regression.yml | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index cb51a77e87..18995d867f 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -7,6 +7,9 @@ on: - master workflow_dispatch: +env: + ORIGINAL_GITHUB_REF: ${{ env.GITHUB_REF }} + jobs: Build_icon_library: runs-on: ubuntu-latest diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index 3865a56ec5..ae265d75c4 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -70,4 +70,3 @@ jobs: projectToken: ${{secrets.CHROMATIC_TOKEN}} workingDir: packages/react-component-library storybookBuildDir: .static_storybook - exitZeroOnChanges: false From c2fde6ae4e36ad8994ddd154cdd46e85072fab91 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Wed, 6 Apr 2022 11:51:11 +0100 Subject: [PATCH 19/45] ci(GHA): Create local-pr-test --- .github/workflows/build_and_test.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 18995d867f..cf69f4c43e 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -7,9 +7,6 @@ on: - master workflow_dispatch: -env: - ORIGINAL_GITHUB_REF: ${{ env.GITHUB_REF }} - jobs: Build_icon_library: runs-on: ubuntu-latest @@ -60,6 +57,12 @@ jobs: - name: Run audit run: yarn run audit + Debug: + runs-on: ubuntu-latest + steps: + - name: Debug + run: echo "$GITHUB_REF" + Check_commits: runs-on: ubuntu-latest needs: Build_icon_library From 55a18eb82bbb18b259b1e71a6708820107745b74 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Wed, 6 Apr 2022 13:54:46 +0100 Subject: [PATCH 20/45] ci(GHA): Create local-pr-test --- .github/workflows/visual_regression.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index ae265d75c4..336d21102b 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -65,7 +65,7 @@ jobs: name: Run visual regression tests env: GITHUB_SHA: ${{ github.event.workflow_run.head_sha }} - GITHUB_REF: ${{ env.PR_NUMBER && format('refs/pull/{}/merge', env.PR_NUMBER) || format('refs/heads/{0}', env.HEAD_BRANCH) }} + GITHUB_REF: ${{ env.PR_NUMBER && format('refs/pull/{0}/merge', env.PR_NUMBER) || format('refs/heads/{0}', env.HEAD_BRANCH) }} with: projectToken: ${{secrets.CHROMATIC_TOKEN}} workingDir: packages/react-component-library From 2b2835f2595bb524781ae03ce3f6f3eb947aacc9 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Wed, 6 Apr 2022 14:09:20 +0100 Subject: [PATCH 21/45] ci(GHA): Create local-pr-test --- .github/workflows/visual_regression.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index 336d21102b..68d8196d0a 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -25,7 +25,7 @@ jobs: - name: Fetch PR ref if: env.PR_NUMBER run: | - git fetch +refs/pull/${{ env.PR_NUMBER }}/merge + git fetch origin +refs/pull/${{ env.PR_NUMBER }}/merge - name: Cache Node modules uses: actions/cache@v2 From f84de541df928cf88e328d8f147a0a92dcb3b3fb Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Wed, 6 Apr 2022 15:02:20 +0100 Subject: [PATCH 22/45] ci(GHA): Create local-pr-test --- .github/workflows/visual_regression.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index 68d8196d0a..4e63ce4622 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -64,6 +64,7 @@ jobs: - uses: chromaui/action@v1 name: Run visual regression tests env: + GITHUB_EVENT_CONTEXT: ${{ toJson(github.event) }} GITHUB_SHA: ${{ github.event.workflow_run.head_sha }} GITHUB_REF: ${{ env.PR_NUMBER && format('refs/pull/{0}/merge', env.PR_NUMBER) || format('refs/heads/{0}', env.HEAD_BRANCH) }} with: From 42aacd0de419e6721fd04b6e5ef9913102178ade Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Wed, 6 Apr 2022 15:45:26 +0100 Subject: [PATCH 23/45] ci(GHA): Create local-pr-test --- .github/workflows/visual_regression.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index 4e63ce4622..914ee82ecd 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -64,7 +64,7 @@ jobs: - uses: chromaui/action@v1 name: Run visual regression tests env: - GITHUB_EVENT_CONTEXT: ${{ toJson(github.event) }} + GITHUB_CONTEXT: ${{ toJson(github) }} GITHUB_SHA: ${{ github.event.workflow_run.head_sha }} GITHUB_REF: ${{ env.PR_NUMBER && format('refs/pull/{0}/merge', env.PR_NUMBER) || format('refs/heads/{0}', env.HEAD_BRANCH) }} with: From 4fdc45912c70fe2207aea7e38edf2b1f34ab286f Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Wed, 6 Apr 2022 15:59:56 +0100 Subject: [PATCH 24/45] ci(GHA): Create local-pr-test --- .github/workflows/visual_regression.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index 914ee82ecd..68d8196d0a 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -64,7 +64,6 @@ jobs: - uses: chromaui/action@v1 name: Run visual regression tests env: - GITHUB_CONTEXT: ${{ toJson(github) }} GITHUB_SHA: ${{ github.event.workflow_run.head_sha }} GITHUB_REF: ${{ env.PR_NUMBER && format('refs/pull/{0}/merge', env.PR_NUMBER) || format('refs/heads/{0}', env.HEAD_BRANCH) }} with: From 85ea5c3174d2ebd09aab11aae8c3533d6161e8b9 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Wed, 6 Apr 2022 16:06:29 +0100 Subject: [PATCH 25/45] ci(GHA): Create local-pr-test --- .github/workflows/build_and_test.yml | 1 + .github/workflows/visual_regression.yml | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index cf69f4c43e..c7cb5e6c71 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -249,6 +249,7 @@ jobs: run: | tar -xzf dist.tar.gz && mv distil packages/icon-library/dist && mv distdt packages/design-tokens/dist yarn --cwd packages/react-component-library storybook:static + echo "$GITHUB_REF" > packages/react-component-library/.static_storybook/github_ref - name: Upload Storybook artifact uses: actions/upload-artifact@v3 diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index 68d8196d0a..19c363eb08 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -7,10 +7,6 @@ on: workflows: - 'Build & Test' -env: - PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} - HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} - jobs: test_visual_regression: name: Run visual regression tests @@ -59,13 +55,16 @@ jobs: fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/storybook-static.zip`, Buffer.from(download.data)); - name: 'Unzip pre-built Storybook' - run: unzip storybook-static.zip -d packages/react-component-library/.static_storybook + run: | + unzip storybook-static.zip -d packages/react-component-library/.static_storybook + ORIGINAL_GITHUB_REF=$(> $GITHUB_ENV - uses: chromaui/action@v1 name: Run visual regression tests env: GITHUB_SHA: ${{ github.event.workflow_run.head_sha }} - GITHUB_REF: ${{ env.PR_NUMBER && format('refs/pull/{0}/merge', env.PR_NUMBER) || format('refs/heads/{0}', env.HEAD_BRANCH) }} + GITHUB_REF: ${{ env.ORIGINAL_GITHUB_REF }} with: projectToken: ${{secrets.CHROMATIC_TOKEN}} workingDir: packages/react-component-library From 779efcbf0dbcded8f714a46455abed175ac06b23 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Wed, 6 Apr 2022 16:20:53 +0100 Subject: [PATCH 26/45] ci(GHA): Create local-pr-test --- .github/workflows/visual_regression.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index 19c363eb08..e6f4dbf726 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -18,11 +18,6 @@ jobs: with: fetch-depth: 0 - - name: Fetch PR ref - if: env.PR_NUMBER - run: | - git fetch origin +refs/pull/${{ env.PR_NUMBER }}/merge - - name: Cache Node modules uses: actions/cache@v2 with: @@ -60,6 +55,10 @@ jobs: ORIGINAL_GITHUB_REF=$(> $GITHUB_ENV + - name: Fetch original ref + run: | + git fetch origin "+$ORIGINAL_GITHUB_REF" + - uses: chromaui/action@v1 name: Run visual regression tests env: From 7fcec586b76f967e8069270377ef09ed29614094 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Wed, 6 Apr 2022 16:42:51 +0100 Subject: [PATCH 27/45] ci(GHA): Create local-pr-test --- .github/workflows/build_and_test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index c7cb5e6c71..9cd561c1ec 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -61,7 +61,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Debug - run: echo "$GITHUB_REF" + run: | + echo "$GITHUB_REF" + echo "${{ github.head_ref }}" + echo "${{ github.ref_name }}" Check_commits: runs-on: ubuntu-latest From b57c27583fc3c7a6df34678d08bab83535cff7fe Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Wed, 6 Apr 2022 16:58:48 +0100 Subject: [PATCH 28/45] ci(GHA): Create local-pr-test --- .github/workflows/build_and_test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 9cd561c1ec..8875a90916 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -62,7 +62,8 @@ jobs: steps: - name: Debug run: | - echo "$GITHUB_REF" + echo "${{ env.GITHUB_REF }}" + echo "${{ github.event.pull_request.head.label }}" echo "${{ github.head_ref }}" echo "${{ github.ref_name }}" From c4e13216f2d5b13a58d7a17a957b6996b6583dd3 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Thu, 7 Apr 2022 09:26:28 +0100 Subject: [PATCH 29/45] ci(GHA): Create local-pr-test --- .github/workflows/build_and_test.yml | 6 +++++- .github/workflows/visual_regression.yml | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 8875a90916..b4f4e81941 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -59,6 +59,9 @@ jobs: Debug: runs-on: ubuntu-latest + env: + EVENT_DATA: ${{ toJson(github.event) }} + ENV: ${{ toJson(env) }} steps: - name: Debug run: | @@ -253,7 +256,8 @@ jobs: run: | tar -xzf dist.tar.gz && mv distil packages/icon-library/dist && mv distdt packages/design-tokens/dist yarn --cwd packages/react-component-library storybook:static - echo "$GITHUB_REF" > packages/react-component-library/.static_storybook/github_ref + echo "$GITHUB_REF" > packages/react-component-library/.static_storybook/ref + echo "${{ github.event.pull_request.head.label }}" > packages/react-component-library/.static_storybook/head_label - name: Upload Storybook artifact uses: actions/upload-artifact@v3 diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index e6f4dbf726..e0f35f53ef 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -52,8 +52,10 @@ jobs: - name: 'Unzip pre-built Storybook' run: | unzip storybook-static.zip -d packages/react-component-library/.static_storybook - ORIGINAL_GITHUB_REF=$(> $GITHUB_ENV + echo "ORIGINAL_HEAD_LABEL=$ORIGINAL_HEAD_LABEL" >> $GITHUB_ENV - name: Fetch original ref run: | From 168934332505254207115c7bef842a27bfaf9c89 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Thu, 7 Apr 2022 09:29:53 +0100 Subject: [PATCH 30/45] ci(GHA): Create local-pr-test --- .github/workflows/build_and_test.yml | 5 +- .github/workflows/npmsmoketest.yml | 66 ---------------- .github/workflows/project_issues.yml | 18 ----- .github/workflows/project_notify.yml | 43 ----------- .github/workflows/project_stale_issues.yml | 18 ----- .github/workflows/release.yml | 89 ---------------------- 6 files changed, 4 insertions(+), 235 deletions(-) delete mode 100644 .github/workflows/npmsmoketest.yml delete mode 100644 .github/workflows/project_issues.yml delete mode 100644 .github/workflows/project_notify.yml delete mode 100644 .github/workflows/project_stale_issues.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index b4f4e81941..49e5f4e13a 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -61,11 +61,14 @@ jobs: runs-on: ubuntu-latest env: EVENT_DATA: ${{ toJson(github.event) }} - ENV: ${{ toJson(env) }} steps: - name: Debug run: | echo "${{ env.GITHUB_REF }}" + echo "${{ env.GITHUB_SHA }}" + echo "${{ env.GITHUB_REF_NAME }}" + echo "${{ env.GITHUB_HEAD_REF }}" + echo "${{ env.GITHUB_REPOSITORY }}" echo "${{ github.event.pull_request.head.label }}" echo "${{ github.head_ref }}" echo "${{ github.ref_name }}" diff --git a/.github/workflows/npmsmoketest.yml b/.github/workflows/npmsmoketest.yml deleted file mode 100644 index acfb32cbbc..0000000000 --- a/.github/workflows/npmsmoketest.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: NPM Smoke Test - -on: - push: - branches: - - master - pull_request: - -jobs: - NPM_smoketest: - runs-on: ubuntu-latest - - steps: - - name: Git clone repository - uses: actions/checkout@v2 - - - name: Cache Node modules - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }} - - - name: Install Dependencies - run: | - yarn install - - - name: Build design-tokens - run: yarn --cwd packages/design-tokens build - - - name: Build icon-library - run: yarn --cwd packages/icon-library build - - - name: Build react-component-library - run: yarn --cwd packages/react-component-library build - - - name: Update CRA template to use local packages - run: | - TEMPLATE=packages/cra-template-defencedigital/template.json - PACKAGES=( - design-tokens - fonts - icon-library - react-component-library - ) - for i in "${PACKAGES[@]}"; - do - contents="$(jq '.package.dependencies."@defencedigital/'$i'" = "file:'$GITHUB_WORKSPACE'/packages/'$i'"' $TEMPLATE)" \ - && echo "${contents}" > $TEMPLATE - done - cat $TEMPLATE - - - name: Create boilerplate app - run: | - if [ -d "$RUNNER_TEMP/my-app" ]; then rm -Rf $RUNNER_TEMP/my-app ; fi - npx create-react-app $RUNNER_TEMP/my-app --template file:../${{ github.event.repository.name }}/packages/cra-template-defencedigital - - - name: Build boilerlate app - run: | - cd $RUNNER_TEMP/my-app - grep version node_modules/@defencedigital/**/package.json - yarn build - - - name: Lint boilerlate app - run: | - cd $RUNNER_TEMP/my-app - yarn lint diff --git a/.github/workflows/project_issues.yml b/.github/workflows/project_issues.yml deleted file mode 100644 index bf20229bf2..0000000000 --- a/.github/workflows/project_issues.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Project Automation - move issues - -on: - issues: - types: [labeled] - -jobs: - Move_labelled_issues: - runs-on: ubuntu-latest - steps: - - name: Move small/med labeled issues to Candidates column - uses: defencedigital/design-system-moveissue-action@master - with: - action-token: "${{ secrets.GHA_ISSUES_TOKEN }}" - project-url: "https://github.com/defencedigital/mod-uk-design-system/projects/6" - column-name: "Candidates for Ready" - label-name: "Size: Small,Size: Medium" - columns-to-ignore: "Ready,In Progress,In Review,Done" diff --git a/.github/workflows/project_notify.yml b/.github/workflows/project_notify.yml deleted file mode 100644 index 2e140bf3e9..0000000000 --- a/.github/workflows/project_notify.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Project Automation - notify - -on: - schedule: - - cron: '0 8 * * 1-5' - -jobs: - Notify: - runs-on: ubuntu-latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - name: Send slack message for triage issues - env: - TRIAGE_URL: https://github.com/defencedigital/mod-uk-design-system/issues?q=is%3Aissue+is%3Aopen+label%3A%22Status%3A+Awaiting+triage%22 - run: | - - result=$(( gh issue list --repo defencedigital/mod-uk-design-system -l 'Status: Awaiting triage' ) 2>&1) - - slack_triage () { - curl -X POST -H 'Content-type: application/json' --data '{"text":"There are <'$TRIAGE_URL'|Triage issues> to review this morning"}' ${{ secrets.SLACK_WEBHOOK }} - } - slack_notriage () { - curl -X POST -H 'Content-type: application/json' --data '{"text":"There are no issues to Triage this morning"}' ${{ secrets.SLACK_WEBHOOK }} - } - - if [[ `echo $result` == *"Awaiting triage"* ]]; then slack_triage ; else slack_notriage; fi - - - name: Send slack message for stale issues - env: - STALE_URL: https://github.com/defencedigital/mod-uk-design-system/issues?q=is%3Aissue+is%3Aopen+label%3A%22Status%3A+Stale%22 - run: | - - result=$(( gh issue list --repo defencedigital/mod-uk-design-system -l 'Status: Stale' ) 2>&1) - - slack_stale () { - curl -X POST -H 'Content-type: application/json' --data '{"text":"There are <'$STALE_URL'|Stale issues> to review this morning"}' ${{ secrets.SLACK_WEBHOOK }} - } - slack_nostale () { - curl -X POST -H 'Content-type: application/json' --data '{"text":"There are no Stale issues to review this morning"}' ${{ secrets.SLACK_WEBHOOK }} - } - - if [[ `echo $result` == *"Status: Stale"* ]]; then slack_stale ; else slack_nostale; fi diff --git a/.github/workflows/project_stale_issues.yml b/.github/workflows/project_stale_issues.yml deleted file mode 100644 index b0afd0b5b0..0000000000 --- a/.github/workflows/project_stale_issues.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Project Automation - stale issues - -on: - schedule: - - cron: '0 1 * * 1' - -jobs: - Update_stale_issues: - runs-on: ubuntu-latest - steps: - - name: Add label & comment to stale issues - uses: actions/stale@v3 - with: - stale-issue-message: 'This issue has been marked as stale because it has been open for 60 days with no activity' - days-before-stale: 60 - days-before-close: -1 - stale-issue-label: 'Status: Stale' - exempt-issue-labels: 'Release: Next major' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 1792ee13df..0000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: Release - -on: - schedule: - - cron: '0 4 * * 1-5' - -jobs: - release: - name: 'Release & Publish' - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v2 - with: - # pulls all commits (needed for lerna / semantic release to correctly version) - fetch-depth: 0 - token: ${{ secrets.GH_TOKEN }} - - - name: Pull all tags - # pulls all tags (needed for lerna / semantic release to correctly version) - run: git fetch --all --tags - - - name: Setup Node.js - uses: actions/setup-node@v1 - with: - node-version: 16 - registry-url: 'https://registry.npmjs.org' - - - name: Install dependencies - run: yarn install - - - name: Get version from lerna.json before release step - id: initversion - run: | - echo "::set-output name=version::$(grep '"version":' lerna.json | cut -d\" -f4)" - - - name: Check for package changes - id: changes - run: | - npx lerna changed 2>&1 | tail -1 |tee outfile - echo "::set-output name=changed::$(cat outfile)" - - - name: GitHub Release - id: release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GIT_AUTHOR_NAME: ${{ secrets.GH_NAME }} - GIT_AUTHOR_EMAIL: ${{ secrets.GH_EMAIL }} - GIT_COMMITTER_NAME: ${{ secrets.GH_NAME }} - GIT_COMMITTER_EMAIL: ${{ secrets.GH_EMAIL }} - if: contains(steps.changes.outputs.changed, 'ready to publish') - run: "yarn lerna:run-version --yes --create-release github -m \"chore(Release): %v [skip ci]\" --conventional-commits" - - - name: Get version from package.json after release step - id: extractver - run: | - echo "::set-output name=version::$(grep '"version":' lerna.json | cut -d\" -f4)" - - - name: Confirm version changes - run: | - echo "the initial version is ${{steps.initversion.outputs.version}}" - echo "the updated version is ${{steps.extractver.outputs.version}}" - - - name: Publish NPM packages - if: steps.initversion.outputs.version != steps.extractver.outputs.version - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - run: | - npm publish --tag latest ./packages/design-tokens - npm publish --tag latest ./packages/eslint-config-react - npm publish --tag latest ./packages/fonts - npm publish --tag latest ./packages/icon-library - npm publish --tag latest ./packages/react-component-library - npm publish --tag latest ./packages/cra-template-defencedigital - - - name: Publish Storybook - if: steps.initversion.outputs.version != steps.extractver.outputs.version - run: | - curl -X POST -d {} ${{ secrets.STORYBOOK_TOKEN }} - - - name: Send notification on failure - if: failure() - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} - uses: defencedigital/design-system-slacknotify-action@master - with: - channel_id: C02H226CT33 - status: FAILED - color: danger From 1dc66c39287ed3d53a483ac515fd780cc17bf513 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Thu, 7 Apr 2022 09:38:32 +0100 Subject: [PATCH 31/45] ci(GHA): Create local-pr-test --- .github/workflows/build_and_test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 49e5f4e13a..6bc5511902 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -64,11 +64,11 @@ jobs: steps: - name: Debug run: | - echo "${{ env.GITHUB_REF }}" - echo "${{ env.GITHUB_SHA }}" - echo "${{ env.GITHUB_REF_NAME }}" - echo "${{ env.GITHUB_HEAD_REF }}" - echo "${{ env.GITHUB_REPOSITORY }}" + echo "$GITHUB_REF" + echo "$GITHUB_SHA" + echo "$GITHUB_REF_NAME" + echo "$GITHUB_HEAD_REF" + echo "$GITHUB_REPOSITORY" echo "${{ github.event.pull_request.head.label }}" echo "${{ github.head_ref }}" echo "${{ github.ref_name }}" From 640f58ea76f13cbd4e95b68cb2e5b854230c1e47 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Thu, 7 Apr 2022 11:18:28 +0100 Subject: [PATCH 32/45] ci(GHA): Create local-pr-test --- .github/workflows/build_and_test.yml | 9 +++++++-- .github/workflows/visual_regression.yml | 22 ++++++++-------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 6bc5511902..15bd0a4405 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -256,11 +256,16 @@ jobs: name: dist - name: Build Storybook + env: + CHROMATIC_SHA: ${{ github.event.pull_request.head.sha || github.sha }} + CHROMATIC_BRANCH: ${{ github.head_ref || github.ref_name }} + CHROMATIC_SLUG: ${{ github.event.pull_request.head.repo.full_name || github.repository }} run: | tar -xzf dist.tar.gz && mv distil packages/icon-library/dist && mv distdt packages/design-tokens/dist yarn --cwd packages/react-component-library storybook:static - echo "$GITHUB_REF" > packages/react-component-library/.static_storybook/ref - echo "${{ github.event.pull_request.head.label }}" > packages/react-component-library/.static_storybook/head_label + echo "$CHROMATIC_SHA" > packages/react-component-library/.static_storybook/sha + echo "$CHROMATIC_BRANCH" > packages/react-component-library/.static_storybook/branch + echo "$CHROMATIC_SLUG" > packages/react-component-library/.static_storybook/slug - name: Upload Storybook artifact uses: actions/upload-artifact@v3 diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml index e0f35f53ef..23df9811fb 100644 --- a/.github/workflows/visual_regression.yml +++ b/.github/workflows/visual_regression.yml @@ -52,21 +52,15 @@ jobs: - name: 'Unzip pre-built Storybook' run: | unzip storybook-static.zip -d packages/react-component-library/.static_storybook - ORIGINAL_REF=$(> $GITHUB_ENV - echo "ORIGINAL_HEAD_LABEL=$ORIGINAL_HEAD_LABEL" >> $GITHUB_ENV + echo "CHROMATIC_SHA=$(> $GITHUB_ENV + echo "CHROMATIC_BRANCH=$(> $GITHUB_ENV + echo "CHROMATIC_SLUG=$(> $GITHUB_ENV - name: Fetch original ref run: | - git fetch origin "+$ORIGINAL_GITHUB_REF" + git fetch origin "+$CHROMATIC_SHA" - - uses: chromaui/action@v1 - name: Run visual regression tests - env: - GITHUB_SHA: ${{ github.event.workflow_run.head_sha }} - GITHUB_REF: ${{ env.ORIGINAL_GITHUB_REF }} - with: - projectToken: ${{secrets.CHROMATIC_TOKEN}} - workingDir: packages/react-component-library - storybookBuildDir: .static_storybook + - name: Run visual regression tests + run: | + cd packages/react-component-library + npm exec --no -- chromatic --project-token=${{secrets.CHROMATIC_TOKEN}} --storybook-build-dir=.static_storybook From 4d12b0f8ae4f2790d28c5289fa7eb0b0df0f0ca3 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Fri, 8 Apr 2022 11:23:39 +0100 Subject: [PATCH 33/45] ci(GHA): Add final-ish versions of updated workflows --- .github/dependabot.yml | 16 +++++ .github/workflows/automerge.yml | 45 ------------ .github/workflows/build_and_test.yml | 84 +++++++++-------------- .github/workflows/codeql.yml | 38 ++++++++++ .github/workflows/post_build_and_test.yml | 79 +++++++++++++++++++++ 5 files changed, 167 insertions(+), 95 deletions(-) create mode 100644 .github/dependabot.yml delete mode 100644 .github/workflows/automerge.yml create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/post_build_and_test.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..4958fbab08 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: +- package-ecosystem: npm + directory: "/" + schedule: + interval: monthly + open-pull-requests-limit: 5 + labels: + - "Type: Dependencies" + commit-message: + prefix: chore(Security) + rebase-strategy: auto + ignore: + # Newer versions break older browsers, see e.g. https://github.com/juliencrn/usehooks-ts/issues/97 + - dependency-name: "usehooks-ts" + versions: [">2.2.1"] diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml deleted file mode 100644 index eade300a8f..0000000000 --- a/.github/workflows/automerge.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Dependabot Automerge - -on: - workflow_run: - types: - - completed - workflows: - - 'Build & Test' - branches: - - 'dependabot/**' - -jobs: - Test_visual_regression: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' && github.actor == 'dependabot[bot]' }} - steps: - - name: Git clone repository - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Cache Node modules - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }} - - name: Build icon-library - run: | - yarn install --frozen-lockfile - yarn --cwd packages/icon-library build - - name: Build design-tokens - run: | - yarn --cwd packages/design-tokens build - - name: Run visual regression tests - run: | - yarn --cwd packages/react-component-library chromatic --project-token=${{secrets.CHROMATIC_TOKEN}} - Automerge: - name: Merge Dependabot PR's - runs-on: ubuntu-latest - needs: [Test_visual_regression] - steps: - - name: Auto merge Dependabot minor and patch version bumps - uses: defencedigital/design-system-mergeme-action@master - with: - GITHUB_TOKEN: ${{ secrets.MERGE_BOT }} - PRESET: DEPENDABOT_MINOR diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 15bd0a4405..d58cf02b66 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -12,16 +12,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Git clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Cache Node modules - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} - name: Cache Cypress binary - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cache/Cypress key: cypress-${{ runner.os }}-cypress-${{ hashFiles('**/yarn.lock') }} @@ -43,7 +43,7 @@ jobs: tar -czvf dist.tar.gz distil distdt - name: Persist artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: dist path: ./dist.tar.gz @@ -52,40 +52,24 @@ jobs: runs-on: ubuntu-latest steps: - name: Git clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Run audit run: yarn run audit - Debug: - runs-on: ubuntu-latest - env: - EVENT_DATA: ${{ toJson(github.event) }} - steps: - - name: Debug - run: | - echo "$GITHUB_REF" - echo "$GITHUB_SHA" - echo "$GITHUB_REF_NAME" - echo "$GITHUB_HEAD_REF" - echo "$GITHUB_REPOSITORY" - echo "${{ github.event.pull_request.head.label }}" - echo "${{ github.head_ref }}" - echo "${{ github.ref_name }}" - Check_commits: runs-on: ubuntu-latest needs: Build_icon_library if: ${{ github.event_name == 'pull_request' }} steps: - name: Git clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Cache Node modules - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} - name: check commits run: | @@ -96,13 +80,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Git clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Cache Node modules - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} - name: Get dependencies & run lint run: | @@ -114,16 +98,16 @@ jobs: needs: [Build_icon_library, Lint_react-component-library] steps: - name: Git clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Cache Node modules - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} - name: Attach workspace - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: dist @@ -150,16 +134,16 @@ jobs: browser: ['chrome', 'firefox'] steps: - name: Git clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Cache Node modules - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} - name: Cache Cypress binary - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.cache/Cypress key: cypress-${{ runner.os }}-cypress-${{ hashFiles('**/yarn.lock') }} @@ -167,7 +151,7 @@ jobs: cypress-${{ runner.os }}-cypress- - name: Attach workspace - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: dist @@ -199,16 +183,16 @@ jobs: needs: [Build_icon_library, Lint_react-component-library] steps: - name: Git clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Cache Node modules - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} - name: Attach workspace - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: dist @@ -222,13 +206,13 @@ jobs: needs: [Build_icon_library] steps: - name: Git clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Cache Node modules - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} - name: Jest design-tokens run: | @@ -237,21 +221,21 @@ jobs: Build_storybook: runs-on: ubuntu-latest - needs: [Build_icon_library, Test_react-component-library] + needs: [Build_icon_library] steps: - name: Git clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Cache Node modules - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }} + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} - name: Attach workspace - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: dist @@ -267,7 +251,7 @@ jobs: echo "$CHROMATIC_BRANCH" > packages/react-component-library/.static_storybook/branch echo "$CHROMATIC_SLUG" > packages/react-component-library/.static_storybook/slug - - name: Upload Storybook artifact + - name: Upload Storybook artefact uses: actions/upload-artifact@v3 with: name: storybook-static diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000000..b923582056 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,38 @@ +name: 'CodeQL security scan' + +on: + push: + branches: [master] + pull_request: + branches: [master] + schedule: + - cron: '16 9 * * 5' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ['typescript'] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + - name: Perform CodeQL analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/post_build_and_test.yml b/.github/workflows/post_build_and_test.yml new file mode 100644 index 0000000000..f7d005e766 --- /dev/null +++ b/.github/workflows/post_build_and_test.yml @@ -0,0 +1,79 @@ +name: Dependabot Automerge + +on: + workflow_run: + types: + - completed + workflows: + - 'Build & Test' + +jobs: + Test_visual_regression: + runs-on: ubuntu-latest + if: github.event.workflow_run.conclusion == 'success' + steps: + - name: Git clone repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Cache Node modules + uses: actions/cache@v3 + with: + path: '**/node_modules' + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} + + - name: Install dependencies + run: | + yarn install --frozen-lockfile + + # Based on + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow + - name: Download pre-built Storybook + uses: actions/github-script@v6 + with: + script: | + const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + }); + const matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name == "storybook-static" + })[0]; + const download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + const fs = require('fs'); + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/storybook-static.zip`, Buffer.from(download.data)); + + - name: Unzip pre-built Storybook + run: | + unzip storybook-static.zip -d packages/react-component-library/.static_storybook + echo "CHROMATIC_SHA=$(> $GITHUB_ENV + echo "CHROMATIC_BRANCH=$(> $GITHUB_ENV + echo "CHROMATIC_SLUG=$(> $GITHUB_ENV + + - name: Fetch original ref + run: | + git fetch origin "+$CHROMATIC_SHA" + + - name: Run visual regression tests + run: | + cd packages/react-component-library + npm exec --no -- chromatic --project-token=${{secrets.CHROMATIC_TOKEN}} --storybook-build-dir=.static_storybook + + Automerge: + name: Merge Dependabot PR's + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' + needs: [Test_visual_regression] + steps: + - name: Auto merge Dependabot minor and patch version bumps + uses: defencedigital/design-system-mergeme-action@master + with: + GITHUB_TOKEN: ${{ secrets.MERGE_BOT }} + PRESET: DEPENDABOT_MINOR From cccefcb500226354ab8a80dfd8235460291a269d Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Fri, 8 Apr 2022 11:36:44 +0100 Subject: [PATCH 34/45] ci(GHA): Add final-ish versions of updated workflows --- .github/workflows/post_build_and_test.yml | 2 +- .github/workflows/visual_regression.yml | 66 ----------------------- 2 files changed, 1 insertion(+), 67 deletions(-) delete mode 100644 .github/workflows/visual_regression.yml diff --git a/.github/workflows/post_build_and_test.yml b/.github/workflows/post_build_and_test.yml index f7d005e766..0bf677f1e7 100644 --- a/.github/workflows/post_build_and_test.yml +++ b/.github/workflows/post_build_and_test.yml @@ -1,4 +1,4 @@ -name: Dependabot Automerge +name: Post Build & Test on: workflow_run: diff --git a/.github/workflows/visual_regression.yml b/.github/workflows/visual_regression.yml deleted file mode 100644 index 23df9811fb..0000000000 --- a/.github/workflows/visual_regression.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Visual regression tests - -on: - workflow_run: - types: - - completed - workflows: - - 'Build & Test' - -jobs: - test_visual_regression: - name: Run visual regression tests - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - name: Git clone repository - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Cache Node modules - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }} - - - name: Install dependencies - run: | - yarn install --frozen-lockfile - - - name: 'Download pre-built Storybook' - uses: actions/github-script@v6 - with: - script: | - const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - const matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == "storybook-static" - })[0]; - const download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - const fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/storybook-static.zip`, Buffer.from(download.data)); - - - name: 'Unzip pre-built Storybook' - run: | - unzip storybook-static.zip -d packages/react-component-library/.static_storybook - echo "CHROMATIC_SHA=$(> $GITHUB_ENV - echo "CHROMATIC_BRANCH=$(> $GITHUB_ENV - echo "CHROMATIC_SLUG=$(> $GITHUB_ENV - - - name: Fetch original ref - run: | - git fetch origin "+$CHROMATIC_SHA" - - - name: Run visual regression tests - run: | - cd packages/react-component-library - npm exec --no -- chromatic --project-token=${{secrets.CHROMATIC_TOKEN}} --storybook-build-dir=.static_storybook From 7e08d09717b80aa4ee3acc05ee4ead2dbfa799ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Apr 2022 11:45:07 +0100 Subject: [PATCH 35/45] chore(Security): bump @types/lodash from 4.14.180 to 4.14.181 --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 7ebf7d8ad0..d352135a43 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4722,9 +4722,9 @@ integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= "@types/lodash@^4.14.149", "@types/lodash@^4.14.161", "@types/lodash@^4.14.167": - version "4.14.180" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.180.tgz#4ab7c9ddfc92ec4a887886483bc14c79fb380670" - integrity sha512-XOKXa1KIxtNXgASAnwj7cnttJxS4fksBRywK/9LzRV5YxrF80BXZIGeQSuoESQ/VkUj30Ae0+YcuHc15wJCB2g== + version "4.14.181" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.181.tgz#d1d3740c379fda17ab175165ba04e2d03389385d" + integrity sha512-n3tyKthHJbkiWhDZs3DkhkCzt2MexYHXlX0td5iMplyfwketaOeKboEVBqzceH7juqvEg3q5oUoBFxSLu7zFag== "@types/mdast@^3.0.0": version "3.0.10" From c5961ac1ac0d04d54e2f8f8ee1c7a40d2ba6bab5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Apr 2022 11:45:48 +0100 Subject: [PATCH 36/45] chore(Security): bump @storybook/addons --- yarn.lock | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index d352135a43..fc54775818 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2985,7 +2985,7 @@ global "^4.4.0" regenerator-runtime "^0.13.7" -"@storybook/addons@6.5.0-alpha.55", "@storybook/addons@^6.5.0-alpha.49": +"@storybook/addons@6.5.0-alpha.55": version "6.5.0-alpha.55" resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-6.5.0-alpha.55.tgz#28228ac7d13994d05d2b6ceaaf1d7cad5b9fc755" integrity sha512-XOjVXc+v3UNPnS3jmySlYoznK9SE+SgwLxJ9GMnIsDCRBQLT7duebTJHl74p0nmgGHj7h64x652PyCNi5M721Q== @@ -3002,6 +3002,23 @@ global "^4.4.0" regenerator-runtime "^0.13.7" +"@storybook/addons@^6.5.0-alpha.49": + version "6.5.0-alpha.59" + resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-6.5.0-alpha.59.tgz#e7e338fde3f2ee7229a80a8571500f2bd4d8e287" + integrity sha512-9JRvNxoZKBMFP5zpvA4leG2krxle1vq6U/vDQZiCPGqr5Tz5X2t/2utHpa4vakNuUD0GI2GqIc9inuqeGy8TsA== + dependencies: + "@storybook/api" "6.5.0-alpha.59" + "@storybook/channels" "6.5.0-alpha.59" + "@storybook/client-logger" "6.5.0-alpha.59" + "@storybook/core-events" "6.5.0-alpha.59" + "@storybook/csf" "0.0.2--canary.7c6c115.0" + "@storybook/router" "6.5.0-alpha.59" + "@storybook/theming" "6.5.0-alpha.59" + "@types/webpack-env" "^1.16.0" + core-js "^3.8.2" + global "^4.4.0" + regenerator-runtime "^0.13.7" + "@storybook/api@6.5.0-alpha.49": version "6.5.0-alpha.49" resolved "https://registry.yarnpkg.com/@storybook/api/-/api-6.5.0-alpha.49.tgz#c845a06dbaba99f9442d377f9b739592ed4d768f" @@ -3071,6 +3088,29 @@ ts-dedent "^2.0.0" util-deprecate "^1.0.2" +"@storybook/api@6.5.0-alpha.59": + version "6.5.0-alpha.59" + resolved "https://registry.yarnpkg.com/@storybook/api/-/api-6.5.0-alpha.59.tgz#81d11a7cbe2693cffa5a6099d8983a53e1a2841f" + integrity sha512-SOVQQ793N8A8W0HqWPVZ3K1yCU3i9el7nip7NXu630gTW3zS7aK96R1SnIi0IVGAz8r8YPLNvsCdDxohvTZyVw== + dependencies: + "@storybook/channels" "6.5.0-alpha.59" + "@storybook/client-logger" "6.5.0-alpha.59" + "@storybook/core-events" "6.5.0-alpha.59" + "@storybook/csf" "0.0.2--canary.7c6c115.0" + "@storybook/router" "6.5.0-alpha.59" + "@storybook/semver" "^7.3.2" + "@storybook/theming" "6.5.0-alpha.59" + core-js "^3.8.2" + fast-deep-equal "^3.1.3" + global "^4.4.0" + lodash "^4.17.21" + memoizerific "^1.11.3" + regenerator-runtime "^0.13.7" + store2 "^2.12.0" + telejson "^5.3.3" + ts-dedent "^2.0.0" + util-deprecate "^1.0.2" + "@storybook/babel-plugin-require-context-hook@1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@storybook/babel-plugin-require-context-hook/-/babel-plugin-require-context-hook-1.0.1.tgz#0a4ec9816f6c7296ebc97dd8de3d2b7ae76f2e26" @@ -3314,6 +3354,15 @@ ts-dedent "^2.0.0" util-deprecate "^1.0.2" +"@storybook/channels@6.5.0-alpha.59": + version "6.5.0-alpha.59" + resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-6.5.0-alpha.59.tgz#475d1bbe438eacb02d0b0dcc7be9ed3db1f5ac99" + integrity sha512-Dbr2DOSrtifUaHdAqEY7Ng/93q8apCtF/s+DF1ZE7R5NLPPaNSqm+ieqAWpbPhSFSW1ynAcSj/th9LWZgkZ9bQ== + dependencies: + core-js "^3.8.2" + ts-dedent "^2.0.0" + util-deprecate "^1.0.2" + "@storybook/client-api@6.5.0-alpha.49": version "6.5.0-alpha.49" resolved "https://registry.yarnpkg.com/@storybook/client-api/-/client-api-6.5.0-alpha.49.tgz#248e9ad2c4ca2f1927348e8cd925a02cf46cf0cc" @@ -3390,6 +3439,14 @@ core-js "^3.8.2" global "^4.4.0" +"@storybook/client-logger@6.5.0-alpha.59": + version "6.5.0-alpha.59" + resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-6.5.0-alpha.59.tgz#a0a63c43cfc8013cd4861c66de2f4fa73bf6d295" + integrity sha512-86N5wvjJAS1/oIyIMgU5/PSSPeAcptrsrIZY96Dpg9y6gaupPkFc0JzBuFUAinVpIHzr3E/8FjTmac6DaQ1ncA== + dependencies: + core-js "^3.8.2" + global "^4.4.0" + "@storybook/components@6.5.0-alpha.49": version "6.5.0-alpha.49" resolved "https://registry.yarnpkg.com/@storybook/components/-/components-6.5.0-alpha.49.tgz#1b513395531ccc61431f5a053e16ae72a1458847" @@ -3664,6 +3721,13 @@ dependencies: core-js "^3.8.2" +"@storybook/core-events@6.5.0-alpha.59": + version "6.5.0-alpha.59" + resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-6.5.0-alpha.59.tgz#c09eaf9d840e13cf4b43a3f78464d34449d14a81" + integrity sha512-cX1qgrA5CHFCRjwENbh92kdX3Qu17nCv4dgJ1g6I48M9Nut5+SGHJiMH6FqqBsoiR7eqScrDR1gh11eTHsW7HQ== + dependencies: + core-js "^3.8.2" + "@storybook/core-server@6.5.0-alpha.49": version "6.5.0-alpha.49" resolved "https://registry.yarnpkg.com/@storybook/core-server/-/core-server-6.5.0-alpha.49.tgz#89f9521a2c628d6196de193639fb377a68ee3932" @@ -3827,6 +3891,13 @@ dependencies: lodash "^4.17.15" +"@storybook/csf@0.0.2--canary.7c6c115.0": + version "0.0.2--canary.7c6c115.0" + resolved "https://registry.yarnpkg.com/@storybook/csf/-/csf-0.0.2--canary.7c6c115.0.tgz#91724e34be7b168acddb8df7e7821ed371ce31ff" + integrity sha512-LRIDJp2JionBqZ4/c2DncDk5jGzd3sua92jGbQVRtVyIGdaAVDuNtqXY9Fh+yzO7QE03Cm+BEs59Yat5J7EdEQ== + dependencies: + lodash "^4.17.15" + "@storybook/csf@0.0.2--canary.87bc651.0": version "0.0.2--canary.87bc651.0" resolved "https://registry.yarnpkg.com/@storybook/csf/-/csf-0.0.2--canary.87bc651.0.tgz#c7b99b3a344117ef67b10137b6477a3d2750cf44" @@ -4183,6 +4254,15 @@ core-js "^3.8.2" regenerator-runtime "^0.13.7" +"@storybook/router@6.5.0-alpha.59": + version "6.5.0-alpha.59" + resolved "https://registry.yarnpkg.com/@storybook/router/-/router-6.5.0-alpha.59.tgz#ee031bdf91c9509c2a6c8d3f6fccdcb6ee2df64b" + integrity sha512-OfIXWKVZWMbRFR+LotUrgJFW0WZHq0PCYor2CvUNQqxAHi2EMeJh0TteqUJPmAxdjk2nt2gFMJBKh4WA/hCmqQ== + dependencies: + "@storybook/client-logger" "6.5.0-alpha.59" + core-js "^3.8.2" + regenerator-runtime "^0.13.7" + "@storybook/semver@^7.3.2": version "7.3.2" resolved "https://registry.yarnpkg.com/@storybook/semver/-/semver-7.3.2.tgz#f3b9c44a1c9a0b933c04e66d0048fcf2fa10dac0" @@ -4297,6 +4377,15 @@ core-js "^3.8.2" regenerator-runtime "^0.13.7" +"@storybook/theming@6.5.0-alpha.59": + version "6.5.0-alpha.59" + resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-6.5.0-alpha.59.tgz#001f146772cf0e3df2cc58ac38ec584f7ec10ea7" + integrity sha512-kTISuyJhN1fTE2l1rAqIvJcgOlpVRIiomrRE4RNiiGc4Yu7guNyxTFe945Wokw+JubKkwzLEvkHXTzC9H0f95g== + dependencies: + "@storybook/client-logger" "6.5.0-alpha.59" + core-js "^3.8.2" + regenerator-runtime "^0.13.7" + "@storybook/ui@6.5.0-alpha.49": version "6.5.0-alpha.49" resolved "https://registry.yarnpkg.com/@storybook/ui/-/ui-6.5.0-alpha.49.tgz#bb860f536880585cd46209ac4ee1296cb944fffa" From b4834bab66602c5e3db3bbcfd8c2d8a267221937 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Mon, 11 Apr 2022 09:53:10 +0100 Subject: [PATCH 37/45] ci(GHA): Add final-ish versions of updated workflows --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index d58cf02b66..70c25fe199 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -121,7 +121,7 @@ jobs: - name: SonarCloud Scan uses: defencedigital/design-system-sonarcloud-action@master - if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' + if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From daffd21781a9aefedd3a754a8c6cc9ffaed9cdb7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Apr 2022 10:51:44 +0100 Subject: [PATCH 38/45] chore(Security): bump @babel/plugin-transform-modules-commonjs --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index fc54775818..4f472160dc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -830,9 +830,9 @@ babel-plugin-dynamic-import-node "^2.3.3" "@babel/plugin-transform-modules-commonjs@^7.16.7", "@babel/plugin-transform-modules-commonjs@^7.8.3": - version "7.17.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.17.7.tgz#d86b217c8e45bb5f2dbc11eefc8eab62cf980d19" - integrity sha512-ITPmR2V7MqioMJyrxUo2onHNC3e+MvfFiFIR0RP21d3PtlVb6sfzoxNKiphSZUOM9hEIdzCcZe83ieX3yoqjUA== + version "7.17.9" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.17.9.tgz#274be1a2087beec0254d4abd4d86e52442e1e5b6" + integrity sha512-2TBFd/r2I6VlYn0YRTz2JdazS+FoUuQ2rIFHoAxtyP/0G3D82SBLaRq9rnUkpqlLg03Byfl/+M32mpxjO6KaPw== dependencies: "@babel/helper-module-transforms" "^7.17.7" "@babel/helper-plugin-utils" "^7.16.7" From 6a4bee4624218c5f6b1828e9da2efa000ba162b9 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 12 Apr 2022 11:53:31 +0100 Subject: [PATCH 39/45] ci(GHA): Add final-ish versions of updated workflows --- .github/workflows/post_build_and_test.yml | 18 ++------------- .../download-storybook-artifact.js | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 scripts/github-actions/download-storybook-artifact.js diff --git a/.github/workflows/post_build_and_test.yml b/.github/workflows/post_build_and_test.yml index 0bf677f1e7..d785eecbb6 100644 --- a/.github/workflows/post_build_and_test.yml +++ b/.github/workflows/post_build_and_test.yml @@ -33,22 +33,8 @@ jobs: uses: actions/github-script@v6 with: script: | - const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - const matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == "storybook-static" - })[0]; - const download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - const fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/storybook-static.zip`, Buffer.from(download.data)); + const script = require('../../scripts/github-actions/download-storybook-artifact') + await script({ github, context }) - name: Unzip pre-built Storybook run: | diff --git a/scripts/github-actions/download-storybook-artifact.js b/scripts/github-actions/download-storybook-artifact.js new file mode 100644 index 0000000000..746496a831 --- /dev/null +++ b/scripts/github-actions/download-storybook-artifact.js @@ -0,0 +1,22 @@ +const fs = require('fs') + +module.exports = async ({ github, context }) => { + const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: context.payload.workflow_run.id, + }) + + const matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { + return artifact.name === 'storybook-static' + })[0] + + const download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }) + + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/storybook-static.zip`, Buffer.from(download.data)) +} From 33ec16c058b167c77f526d1a256bf6d2e6f08396 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 12 Apr 2022 13:06:31 +0100 Subject: [PATCH 40/45] ci(GHA): Add final-ish versions of updated workflows --- .github/workflows/post_build_and_test.yml | 2 +- scripts/github-actions/download-storybook-artifact.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/post_build_and_test.yml b/.github/workflows/post_build_and_test.yml index d785eecbb6..5e4c0f325b 100644 --- a/.github/workflows/post_build_and_test.yml +++ b/.github/workflows/post_build_and_test.yml @@ -33,7 +33,7 @@ jobs: uses: actions/github-script@v6 with: script: | - const script = require('../../scripts/github-actions/download-storybook-artifact') + const script = require('${{ github.workspace }}/scripts/github-actions/download-storybook-artifact') await script({ github, context }) - name: Unzip pre-built Storybook diff --git a/scripts/github-actions/download-storybook-artifact.js b/scripts/github-actions/download-storybook-artifact.js index 746496a831..5dbc8dfa86 100644 --- a/scripts/github-actions/download-storybook-artifact.js +++ b/scripts/github-actions/download-storybook-artifact.js @@ -18,5 +18,5 @@ module.exports = async ({ github, context }) => { archive_format: 'zip', }) - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/storybook-static.zip`, Buffer.from(download.data)) + fs.writeFileSync(`${github.workspace}/storybook-static.zip`, Buffer.from(download.data)) } From cdef7dfb70a4e20cf2a4652898fd1cdfb82628fa Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 12 Apr 2022 13:27:16 +0100 Subject: [PATCH 41/45] ci(GHA): Add final-ish versions of updated workflows --- scripts/github-actions/download-storybook-artifact.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/github-actions/download-storybook-artifact.js b/scripts/github-actions/download-storybook-artifact.js index 5dbc8dfa86..746496a831 100644 --- a/scripts/github-actions/download-storybook-artifact.js +++ b/scripts/github-actions/download-storybook-artifact.js @@ -18,5 +18,5 @@ module.exports = async ({ github, context }) => { archive_format: 'zip', }) - fs.writeFileSync(`${github.workspace}/storybook-static.zip`, Buffer.from(download.data)) + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/storybook-static.zip`, Buffer.from(download.data)) } From b75d36658950029409d01b91c703710711eaa7ed Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 12 Apr 2022 14:17:54 +0100 Subject: [PATCH 42/45] ci(GHA): Add final-ish versions of updated workflows --- .github/workflows/post_build_and_test.yml | 4 ++-- ...ad-storybook-artifact.js => downloadStorybookArtifact.mjs} | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename scripts/github-actions/{download-storybook-artifact.js => downloadStorybookArtifact.mjs} (86%) diff --git a/.github/workflows/post_build_and_test.yml b/.github/workflows/post_build_and_test.yml index 5e4c0f325b..3995d5aecc 100644 --- a/.github/workflows/post_build_and_test.yml +++ b/.github/workflows/post_build_and_test.yml @@ -33,8 +33,8 @@ jobs: uses: actions/github-script@v6 with: script: | - const script = require('${{ github.workspace }}/scripts/github-actions/download-storybook-artifact') - await script({ github, context }) + const { downloadStorybookArtifact } = await import('${{ github.workspace }}/scripts/github-actions/download-storybook-artifact.mjs') + await downloadStorybookArtifact({ github, context }) - name: Unzip pre-built Storybook run: | diff --git a/scripts/github-actions/download-storybook-artifact.js b/scripts/github-actions/downloadStorybookArtifact.mjs similarity index 86% rename from scripts/github-actions/download-storybook-artifact.js rename to scripts/github-actions/downloadStorybookArtifact.mjs index 746496a831..211f91e3f8 100644 --- a/scripts/github-actions/download-storybook-artifact.js +++ b/scripts/github-actions/downloadStorybookArtifact.mjs @@ -1,6 +1,6 @@ -const fs = require('fs') +import fs from 'fs' -module.exports = async ({ github, context }) => { +export const downloadStorybookArtifact = async ({ github, context }) => { const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ owner: context.repo.owner, repo: context.repo.repo, From 43b323c2e559c81756225f09f2a5942b40d91326 Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 12 Apr 2022 14:31:11 +0100 Subject: [PATCH 43/45] ci(GHA): Add final-ish versions of updated workflows --- .github/workflows/post_build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/post_build_and_test.yml b/.github/workflows/post_build_and_test.yml index 3995d5aecc..21ccafc511 100644 --- a/.github/workflows/post_build_and_test.yml +++ b/.github/workflows/post_build_and_test.yml @@ -33,7 +33,7 @@ jobs: uses: actions/github-script@v6 with: script: | - const { downloadStorybookArtifact } = await import('${{ github.workspace }}/scripts/github-actions/download-storybook-artifact.mjs') + const { downloadStorybookArtifact } = await import('${{ github.workspace }}/scripts/github-actions/downloadStorybookArtifact.mjs') await downloadStorybookArtifact({ github, context }) - name: Unzip pre-built Storybook From 2de3c6dfb55d4e4ad8338a7a4587a0d3f80439ad Mon Sep 17 00:00:00 2001 From: jpveooys <66470099+jpveooys@users.noreply.github.com> Date: Tue, 12 Apr 2022 15:03:10 +0100 Subject: [PATCH 44/45] ci(GHA): Add final-ish versions of updated workflows --- scripts/github-actions/downloadStorybookArtifact.mjs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/github-actions/downloadStorybookArtifact.mjs b/scripts/github-actions/downloadStorybookArtifact.mjs index 211f91e3f8..59c62e3102 100644 --- a/scripts/github-actions/downloadStorybookArtifact.mjs +++ b/scripts/github-actions/downloadStorybookArtifact.mjs @@ -1,5 +1,11 @@ import fs from 'fs' +/** + * Used by .github/workflows/post_build_and_test.yml + * + * Based on + * https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow + */ export const downloadStorybookArtifact = async ({ github, context }) => { const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ owner: context.repo.owner, @@ -18,5 +24,8 @@ export const downloadStorybookArtifact = async ({ github, context }) => { archive_format: 'zip', }) - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/storybook-static.zip`, Buffer.from(download.data)) + fs.writeFileSync( + `${process.env.GITHUB_WORKSPACE}/storybook-static.zip`, + Buffer.from(download.data) + ) } From 7864f02f69eb9aeff009e0fff591db2ab6b140ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Jan 2023 11:15:21 +0000 Subject: [PATCH 45/45] chore(Security): bump react-string-replace from 0.4.4 to 1.1.0 Bumps [react-string-replace](https://github.com/iansinnott/react-string-replace) from 0.4.4 to 1.1.0. - [Release notes](https://github.com/iansinnott/react-string-replace/releases) - [Commits](https://github.com/iansinnott/react-string-replace/compare/v0.4.4...v1.1.0) --- updated-dependencies: - dependency-name: react-string-replace dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- packages/react-component-library/package.json | 2 +- yarn.lock | 28 +++++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/packages/react-component-library/package.json b/packages/react-component-library/package.json index 31544436c1..c23e23a5f2 100644 --- a/packages/react-component-library/package.json +++ b/packages/react-component-library/package.json @@ -162,7 +162,7 @@ "react-merge-refs": "^1.1.0", "react-popper": "^2.2.5", "react-select": "^4.1.0", - "react-string-replace": "^0.4.4", + "react-string-replace": "^1.1.0", "react-toast-notifications": "^2.4.0", "react-transition-group": "^4.4.1", "styled-normalize": "^8.0.7", diff --git a/yarn.lock b/yarn.lock index 4f472160dc..4e29d5c8ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10793,9 +10793,9 @@ imagemin@^7.0.1: replace-ext "^1.0.0" immer@^9.0.6: - version "9.0.12" - resolved "https://registry.yarnpkg.com/immer/-/immer-9.0.12.tgz#2d33ddf3ee1d247deab9d707ca472c8c942a0f20" - integrity sha512-lk7UNmSbAukB5B6dh9fnh5D0bJTOFKxVg2cyJWTYrWRfhLrLMBquONcUs3aFq507hNoIZEDDh8lb8UtOizSMhA== + version "9.0.16" + resolved "https://registry.yarnpkg.com/immer/-/immer-9.0.16.tgz#8e7caab80118c2b54b37ad43e05758cdefad0198" + integrity sha512-qenGE7CstVm1NrHQbMh8YaSzTZTFNP3zPqr3YU0S0UY441j4bJTg4A2Hh5KAhwgaiU6ZZ1Ar6y/2f4TblnMReQ== import-fresh@^3.0.0, import-fresh@^3.1.0, import-fresh@^3.2.1: version "3.3.0" @@ -15307,12 +15307,10 @@ react-sizeme@^3.0.1: shallowequal "^1.1.0" throttle-debounce "^3.0.1" -react-string-replace@^0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/react-string-replace/-/react-string-replace-0.4.4.tgz#24006fbe0db573d5be583133df38b1a735cb4225" - integrity sha512-FAMkhxmDpCsGTwTZg7p/2v+/GTmxAp73so3fbSvlAcBBX36ujiGRNEaM/1u+jiYQrArhns+7eE92g2pi5E5FUA== - dependencies: - lodash "^4.17.4" +react-string-replace@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/react-string-replace/-/react-string-replace-1.1.0.tgz#a3f7b458e697e77d70b0ea663caf38ab38f7cc17" + integrity sha512-N6RalSDFGbOHs0IJi1H611WbZsvk3ZT47Jl2JEXFbiS3kTwsdCYij70Keo/tWtLy7sfhDsYm7CwNM/WmjXIaMw== "react-test-renderer@^16.8.0 || ^17.0.0": version "17.0.2" @@ -16026,9 +16024,9 @@ seek-bzip@^1.0.5: commander "^2.8.1" semver-regex@^2.0.0, semver-regex@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-3.1.3.tgz#b2bcc6f97f63269f286994e297e229b6245d0dc3" - integrity sha512-Aqi54Mk9uYTjVexLnR67rTyBusmwd04cLkHy9hNvk3+G3nT2Oyg7E0l4XVbOaNwIvQ3hHeYxGcyEy+mKreyBFQ== + version "3.1.4" + resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-3.1.4.tgz#13053c0d4aa11d070a2f2872b6b1e3ae1e1971b4" + integrity sha512-6IiqeZNgq01qGf0TId0t3NvKzSvUsjcpdEO3AQNeIjR6A2+ckTnQlDpl4qu1bjRv0RzN3FP9hzFmws3lKqRWkA== semver-truncate@^1.1.2: version "1.1.2" @@ -18361,9 +18359,9 @@ write-pkg@^4.0.0: write-json-file "^3.2.0" ws@8.2.3, ws@^7.3.1, ws@^7.4.6, ws@^8.2.3, ws@^8.4.2: - version "8.5.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" - integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== + version "8.11.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.11.0.tgz#6a0d36b8edfd9f96d8b25683db2f8d7de6e8e143" + integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg== x-default-browser@^0.4.0: version "0.4.0"