From 90a87bc459fc0b1204b8f941221baeb5325b414a Mon Sep 17 00:00:00 2001 From: jdecroock Date: Fri, 25 Nov 2022 12:04:13 +0100 Subject: [PATCH] try visual regression action --- .circleci/config.yml | 31 ----------------- .github/workflows/ci.yml | 73 +++++++++++++++++++++++++++++++++++--- package.json | 1 + yarn.lock | 75 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 145 insertions(+), 35 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 913954ce..c32b1f5d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,28 +42,6 @@ jobs: paths: - node_modules - visual regression: - <<: *ramdisk - docker: - - image: buildkite/puppeteer:latest - user: node - environment: - COSMOS_HOST: localhost - COSMOS_PORT: 5001 - parallelism: 4 - steps: - - checkout - - *restore_node_modules_cache - - run: - command: yarn cosmos - background: true - - run: - command: sleep 5 && yarn run visual-regression:exec - environment: - PUPPETEER_EXECUTABLE_PATH: /usr/bin/google-chrome - - store_artifacts: - path: src/panel/__image_snapshots__/__diff_output__/ - build: <<: *node_env <<: *ramdisk @@ -149,12 +127,6 @@ workflows: filters: tags: only: /.*/ - - visual regression: - requires: - - install - filters: - tags: - only: /.*/ - build: requires: - install @@ -179,7 +151,6 @@ workflows: requires: - install - build - - visual regression - lint firefox - verify version filters: @@ -191,7 +162,6 @@ workflows: requires: - install - build - - visual regression - lint firefox - verify version filters: @@ -203,7 +173,6 @@ workflows: requires: - install - build - - visual regression - lint firefox - verify version filters: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff2d48c8..eb8e1482 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,11 +48,10 @@ jobs: steps.node-modules-cache.outputs.cache-hit != 'true' run: yarn install --prefer-offline --frozen-lockfile --non-interactive --silent - ## currently has an issue with graphql - ## - name: TypeScript - ## run: yarn run type-check + - name: TypeScript + run: yarn run type-check - - name: Linting + - name: Lint run: yarn run lint ## TODO: consolidate in linting step @@ -61,3 +60,69 @@ jobs: - name: Unit Tests run: TZ=Europe/London yarn run test --coverage + + - name: Build + run: yarn build && yarn bundle + + - name: Lint FireFox + run: yarn run lint:firefox + + visual-regression: + name: Visual Regression + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '16' + + - name: Get Yarn cache directory + id: yarn-cache-dir-path + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT + + - name: Use Yarn cache + uses: actions/cache@v3 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Use node_modules cache + id: node-modules-cache + uses: actions/cache@v3 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} + + - name: Install Dependencies + if: | + steps.yarn-cache.outputs.cache-hit != 'true' || + steps.node-modules-cache.outputs.cache-hit != 'true' + run: yarn install --prefer-offline --frozen-lockfile --non-interactive --silent + + - name: Run Cosmos + run: yarn run cosmos & + + - name: Wait for Cosmos to boot + run: yarn wait-on http://localhost:5001 + + - name: Run Puppeteer + run: yarn run visual-regression:exec + env: + COSMOS_HOST: locahost + COSMOS_PORT: 5000 + + - name: Store image diffs + uses: actions/upload-artifact@v2 + if: ${{ failure() }} + with: + name: image-snapshots + path: src/panel/__image_snapshots__/__diff_output__/ \ No newline at end of file diff --git a/package.json b/package.json index 615aca58..4ba815bf 100644 --- a/package.json +++ b/package.json @@ -142,6 +142,7 @@ "terser-webpack-plugin": "^4.2.2", "ts-jest": "^26.3.0", "typescript": "^4.9.3", + "wait-on": "^6.0.1", "web-ext": "^5.1.0", "webpack": "^4.44.1", "webpack-cli": "^3.3.12", diff --git a/yarn.lock b/yarn.lock index ea4d0139..89d3f954 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1370,6 +1370,18 @@ resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.1.1.tgz#076d78ce99822258cf813ecc1e7fa460fa74d052" integrity sha512-NQ17ii0rK1b34VZonlmT2QMJFI70m0TRwbknO/ihlbatXyaktDhN/98vBiUU6kNBPljqGqyIrl2T4nY2RpFANg== +"@hapi/hoek@^9.0.0": + version "9.3.0" + resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb" + integrity sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ== + +"@hapi/topo@^5.0.0": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012" + integrity sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg== + dependencies: + "@hapi/hoek" "^9.0.0" + "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" @@ -1723,6 +1735,23 @@ dependencies: mkdirp "^1.0.4" +"@sideway/address@^4.1.3": + version "4.1.4" + resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.4.tgz#03dccebc6ea47fdc226f7d3d1ad512955d4783f0" + integrity sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw== + dependencies: + "@hapi/hoek" "^9.0.0" + +"@sideway/formula@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.0.tgz#fe158aee32e6bd5de85044be615bc08478a0a13c" + integrity sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg== + +"@sideway/pinpoint@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df" + integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ== + "@sindresorhus/is@^0.14.0": version "0.14.0" resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" @@ -3109,6 +3138,13 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.10.0.tgz#a17b3a8ea811060e74d47d306122400ad4497ae2" integrity sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA== +axios@^0.25.0: + version "0.25.0" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.25.0.tgz#349cfbb31331a9b4453190791760a8d35b093e0a" + integrity sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g== + dependencies: + follow-redirects "^1.14.7" + babel-jest@^26.3.0: version "26.3.0" resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-26.3.0.tgz#10d0ca4b529ca3e7d1417855ef7d7bd6fc0c3463" @@ -6110,6 +6146,11 @@ follow-redirects@^1.0.0: dependencies: debug "^3.0.0" +follow-redirects@^1.14.7: + version "1.15.2" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" + integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== + for-each@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" @@ -8119,6 +8160,17 @@ jetpack-id@1.0.0: resolved "https://registry.yarnpkg.com/jetpack-id/-/jetpack-id-1.0.0.tgz#2cf9fbae46d8074fc16b7de0071c8efebca473a6" integrity sha1-LPn7rkbYB0/Ba33gBxyO/rykc6Y= +joi@^17.6.0: + version "17.7.0" + resolved "https://registry.yarnpkg.com/joi/-/joi-17.7.0.tgz#591a33b1fe1aca2bc27f290bcad9b9c1c570a6b3" + integrity sha512-1/ugc8djfn93rTE3WRKdCzGGt/EtiYKxITMO4Wiv6q5JL1gl9ePt4kBsl1S499nbosspfctIQTpYIhSmHA3WAg== + dependencies: + "@hapi/hoek" "^9.0.0" + "@hapi/topo" "^5.0.0" + "@sideway/address" "^4.1.3" + "@sideway/formula" "^3.0.0" + "@sideway/pinpoint" "^2.0.0" + js-select@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/js-select/-/js-select-0.6.0.tgz#c284e22824d5927aec962dcdf247174aefb0d190" @@ -11043,6 +11095,13 @@ rxjs@^6.6.2: dependencies: tslib "^1.9.0" +rxjs@^7.5.4: + version "7.5.7" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.7.tgz#2ec0d57fdc89ece220d2e702730ae8f1e49def39" + integrity sha512-z9MzKh/UcOqB3i20H6rtrlaE/CgjLOvheWK/9ILrbhROGTweAi1BaFsTT9FbwZi5Trr1qNRs+MXkhmR06awzQA== + dependencies: + tslib "^2.1.0" + safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" @@ -12378,6 +12437,11 @@ tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q== +tslib@^2.1.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e" + integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA== + tsutils@^3.17.1: version "3.17.1" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" @@ -12829,6 +12893,17 @@ w3c-xmlserializer@^2.0.0: dependencies: xml-name-validator "^3.0.0" +wait-on@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/wait-on/-/wait-on-6.0.1.tgz#16bbc4d1e4ebdd41c5b4e63a2e16dbd1f4e5601e" + integrity sha512-zht+KASY3usTY5u2LgaNqn/Cd8MukxLGjdcZxT2ns5QzDmTFc4XoWBgC+C/na+sMRZTuVygQoMYwdcVjHnYIVw== + dependencies: + axios "^0.25.0" + joi "^17.6.0" + lodash "^4.17.21" + minimist "^1.2.5" + rxjs "^7.5.4" + walker@^1.0.7, walker@~1.0.5: version "1.0.7" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb"