From 0a47d0dd07d3f2e57ba58b8427d88153e0036e5b Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Thu, 18 Jul 2024 21:09:27 +1200 Subject: [PATCH 01/19] added missing snapshot warning --- tests/e2e/samples.js | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/tests/e2e/samples.js b/tests/e2e/samples.js index ea5715de2..ab5b25870 100644 --- a/tests/e2e/samples.js +++ b/tests/e2e/samples.js @@ -24,6 +24,12 @@ class TestError extends Error { } } +class MissingSnapshotError extends Error { + constructor(message) { + super(message) + } +} + async function processSample(page, sample, command) { const relPath = `${sample.dirName}/${sample.fileName}` const vanillaJsHtml = `${rootDir}/samples/vanilla-js/${relPath}.html` @@ -145,7 +151,16 @@ async function processSample(page, sample, command) { // Compare screenshot to the original and throw error on differences const testImg = PNG.sync.read(testImgBuffer) // BUG: copy if original image doesn't exist and report in test results? - const originalImg = PNG.sync.read(fs.readFileSync(originalImgPath)) + let originalImg; + try { + originalImg = PNG.sync.read(fs.readFileSync(originalImgPath)) + } catch (e) { + if (e.code === 'ENOENT') { + //The file could not be found so throw a MissingSnapshotError + throw new MissingSnapshotError(relPath) + } + throw e + } const { width, height } = testImg const diffImg = new PNG({ width, height }) @@ -241,6 +256,7 @@ async function processSamples(command, paths) { let numCompleted = 0 const failedTests = [] // {path, error} + const testsMissingSnapshots = [] // 'pathForSnapshot' // Build a list of samples to process let samples = extractSampleInfo() @@ -278,10 +294,14 @@ async function processSamples(command, paths) { try { await processSample(page, sample, command) } catch (e) { - failedTests.push({ - path: `${sample.dirName}/${sample.fileName}`, - error: e, - }) + if (e instanceof MissingSnapshotError) { + testsMissingSnapshots.push(e.message) + } else { + failedTests.push({ + path: `${sample.dirName}/${sample.fileName}`, + error: e, + }) + } } numCompleted++ if (!process.stdout.isTTY) { @@ -310,6 +330,13 @@ async function processSamples(command, paths) { chalk.green.bold(`${samples.length} tests completed in ${duration} sec.`) ) + if (testsMissingSnapshots.length > 0) { + console.log(chalk.yellow.bold(`${testsMissingSnapshots.length} tests were missing snapshots to compare against. Those tests are:`)) + for (const testMissingSnapshot of testsMissingSnapshots) { + console.log(chalk.yellow.bold(`${testMissingSnapshot}\n`)) + } + } + if (failedTests.length > 0) { console.log(chalk.red.bold(`${failedTests.length} tests failed`)) } From 66508501a975101bbce0341d8ab8b1a7b4cadb64 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Thu, 18 Jul 2024 21:28:36 +1200 Subject: [PATCH 02/19] fail ci if test fails --- package.json | 4 +++- tests/e2e/samples.js | 26 ++++++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 4cce5d346..f0c69b2a2 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,11 @@ "lint": "eslint .", "lint:fix": "eslint . --fix", "test": "npm run e2e && npm run unit", + "test:ci": "npm run e2e:ci && npm run unit", "unit": "jest tests/unit/", "e2e": "node tests/e2e/samples.js test", "e2e:update": "node tests/e2e/samples.js update", + "e2e:ci": "node tests/e2e/samples.js test:ci", "build:samples": "node samples/source/index.js generate" }, "dependencies": { @@ -105,4 +107,4 @@ "visualizations", "data" ] -} +} \ No newline at end of file diff --git a/tests/e2e/samples.js b/tests/e2e/samples.js index ab5b25870..cc3a0692b 100644 --- a/tests/e2e/samples.js +++ b/tests/e2e/samples.js @@ -234,7 +234,7 @@ async function updateBundle(config) { } } -async function processSamples(command, paths) { +async function processSamples(command, paths, isCI) { const startTime = Date.now() await updateBundle(builds['web-umd-dev']) @@ -367,18 +367,32 @@ async function processSamples(command, paths) { throw new Error('Code coverage report failed to generate') } } + + if (failedTests.length > 0 && isCI) { + //Exit with error code to fail CI if a test failed + process.exit(1) + } } // Run as 'node samples.js ...' -// Supports two commands: +// Supports three commands: // - 'test' for running e2e tests +// - 'test:ci' for running e2e tests in CI - 'test:ci' exits with status code 1 if a test fails, while 'test' always exits with status code 0 // - 'update' for updating samples screenshots used for e2e tests comparison // Path options have the format 'bar/basic-bar'. Paths are optional for 'test' command. // For 'update' command 'all' path can be used to update all screenshots. -const command = process.argv[2] -if (['update', 'test'].includes(command)) { - processSamples(command, process.argv.slice(3)) - .catch((e) => console.log(e)) +const commandInput = process.argv[2] +if (['update', 'test', 'test:ci'].includes(commandInput)) { + const isCI = commandInput === 'test:ci' + const command = isCI ? 'test' : commandInput + processSamples(command, process.argv.slice(3), isCI) + .catch((e) => { + console.error(e) + if (isCI) { + //Exit with error code to fail CI if something failed + process.exit(1) + } + }) .then(() => { if (browser) { return browser.close() From 4286a98cd858da84a7478e8ebb9b59545982b8e7 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Thu, 18 Jul 2024 21:28:52 +1200 Subject: [PATCH 03/19] split lint and ci into different files --- .github/workflows/ci.yml | 28 ++++++++++++++++++++++++++++ .github/workflows/lint.yml | 20 ++++++++++++++++++++ .github/workflows/node.js.yml | 32 -------------------------------- 3 files changed, 48 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..624e120b8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +# This workflow will do a clean install of node dependencies, build samples from both the upstream and downstream repositories, + +name: Node.js CI + +on: + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + node-version: [18.x, 20.x, 22.x] + os: [windows-latest, macos-latest, ubuntu-latest] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm test + - run: npm run build --if-present diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 000000000..b268a6675 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,20 @@ +name: Lint + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 22.x + uses: actions/setup-node@v4 + with: + node-version: 22.x + - run: npm ci + - name: Lint + run: npm run lint \ No newline at end of file diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index ad8d7f198..000000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,32 +0,0 @@ -# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Node.js CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [12.x, 14.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm ci - - run: npm run lint - - run: npm test - - run: npm run build --if-present From ddf5a3acc32fd37effbb6408c0a9fe2c3060e64c Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Thu, 18 Jul 2024 21:29:18 +1200 Subject: [PATCH 04/19] use new test:ci script in ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 624e120b8..36d3a4cba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,5 +24,5 @@ jobs: with: node-version: ${{ matrix.node-version }} - run: npm ci - - run: npm test + - run: npm run test:ci - run: npm run build --if-present From 6153f6cbf903512b181c8b08b1d00d85730ff8cb Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Fri, 19 Jul 2024 00:45:26 +1200 Subject: [PATCH 05/19] added testing steps to ci workflow --- .github/workflows/ci.yml | 69 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36d3a4cba..f3abfc70f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,8 @@ -# This workflow will do a clean install of node dependencies, build samples from both the upstream and downstream repositories, +# This workflow will do the following when a pull request is made against the main branch: +# 1. Clone base repository (apexcharts/apexcharts.js), install npm packages, build samples, and then generate e2e snapshots +# 2. Clone head repository (the repository with the code in the pull request), install npm packages, build samples, get snapshots generated from the base repository, run tests, and then generate an apexcharts build +# Test coverage results, base repository snapshots, head repository snapshots and diffs, sample HTML, and the apexcharts build are all uploaded to the workflow artifacts as they get created +# The diffs, build, and coverage results get uploaded even if the test fails for manual inspection and to make debugging easier name: Node.js CI @@ -18,11 +22,66 @@ jobs: # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - - uses: actions/checkout@v4 + - name: Pull base repository + uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.base.repo.full_name }} - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - run: npm ci - - run: npm run test:ci - - run: npm run build --if-present + - name: Install base repository's packages + run: npm ci + - name: Generate base repository's samples + run: npm build:samples + - name: Upload Base Repository Samples + uses: actions/upload-artifact@v4 + with: + name: 'Base Repository Vanilla JS Samples' + path: samples/vanilla-js + - name: Generate base repository's e2e snapshots + run: npm run e2e:update + - name: Upload Base Repository e2e Snapshots + uses: actions/upload-artifact@v4 + with: + name: 'Base Repository Snapshots' + path: tests/e2e/snapshots + - name: Copy snapshots to temp folder + run: cp -r tests/e2e/snapshots ${{ runner.temp }}/snapshots + + - name: Checkout head repository + uses: actions/checkout@v4 + - name: Install head repository's packages + run: npm ci + - name: Generate head repository's samples + run: npm build:samples + - name: Upload Head Repository Samples + uses: actions/upload-artifact@v4 + with: + name: 'Head Repository Vanilla JS Samples' + path: samples/vanilla-js + - name: Delete snapshots folder + run: rm -rf tests/e2e/snapshots + - name: Copy snapshots from temp folder + run: cp -r ${{ runner.temp }}/snapshots tests/e2e + - name: Run tests + run: npm run test:ci + - name: Upload Head Repository Diffs + if: '!cancelled()' + uses: actions/upload-artifact@v4 + with: + name: 'Snapshot Diffs' + path: tests/e2e/diffs + if-no-files-found: ignore + - name: Build apexcharts + run: npm run build --if-present + - name: Upload Head Repository Build + if: '!cancelled()' + with: + name: 'Build' + path: dist + - name: Upload Head Repository Coverage + if: '!cancelled()' + with: + name: 'Coverage' + path: coverage From 717a88125cd7c371a54e51c3572a29d2b46976fb Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Fri, 19 Jul 2024 00:48:00 +1200 Subject: [PATCH 06/19] added uses keys for upload build and coverage steps --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3abfc70f..670acbb05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,11 +77,13 @@ jobs: run: npm run build --if-present - name: Upload Head Repository Build if: '!cancelled()' + uses: actions/upload-artifact@v4 with: name: 'Build' path: dist - name: Upload Head Repository Coverage if: '!cancelled()' + uses: actions/upload-artifact@v4 with: name: 'Coverage' path: coverage From ee88d0129f548b663986f7ee642e94533b958054 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Fri, 19 Jul 2024 00:59:06 +1200 Subject: [PATCH 07/19] set fail-fast to false --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 670acbb05..7f694af59 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: node-version: [18.x, 20.x, 22.x] os: [windows-latest, macos-latest, ubuntu-latest] From 3b369934d7386d56836a06ef86db0fa1da3fc280 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Fri, 19 Jul 2024 01:02:56 +1200 Subject: [PATCH 08/19] correct build commands --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f694af59..c8462f1d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: - name: Install base repository's packages run: npm ci - name: Generate base repository's samples - run: npm build:samples + run: npm run build:samples - name: Upload Base Repository Samples uses: actions/upload-artifact@v4 with: @@ -55,7 +55,7 @@ jobs: - name: Install head repository's packages run: npm ci - name: Generate head repository's samples - run: npm build:samples + run: npm run build:samples - name: Upload Head Repository Samples uses: actions/upload-artifact@v4 with: From 581b0de58a780be2b565c7b4b1e6e6109aaf2385 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Fri, 19 Jul 2024 01:14:00 +1200 Subject: [PATCH 09/19] give artifacts different names --- .github/workflows/ci.yml | 51 +++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8462f1d8..454f67e43 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ # This workflow will do the following when a pull request is made against the main branch: # 1. Clone base repository (apexcharts/apexcharts.js), install npm packages, build samples, and then generate e2e snapshots # 2. Clone head repository (the repository with the code in the pull request), install npm packages, build samples, get snapshots generated from the base repository, run tests, and then generate an apexcharts build -# Test coverage results, base repository snapshots, head repository snapshots and diffs, sample HTML, and the apexcharts build are all uploaded to the workflow artifacts as they get created +# Test coverage results, base repository snapshots, head repository snapshots and diffs, sample HTML, and the apexcharts build are all uploaded to the workflow artifacts # The diffs, build, and coverage results get uploaded even if the test fails for manual inspection and to make debugging easier name: Node.js CI @@ -23,6 +23,9 @@ jobs: # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: + - name: Create artifacts folders + run: mkdir ${{ runner.temp }}/artifacts ${{ runner.temp }}/artifacts/base-repository ${{ runner.temp }}/artifacts/head-repository + - name: Pull base repository uses: actions/checkout@v4 with: @@ -35,18 +38,12 @@ jobs: run: npm ci - name: Generate base repository's samples run: npm run build:samples - - name: Upload Base Repository Samples - uses: actions/upload-artifact@v4 - with: - name: 'Base Repository Vanilla JS Samples' - path: samples/vanilla-js + - name: Copy Base Repository Samples To Artifacts Folder + run: cp -r samples/vanilla-js ${{ runner.temp }}/artifacts/base-repository/samples - name: Generate base repository's e2e snapshots run: npm run e2e:update - - name: Upload Base Repository e2e Snapshots - uses: actions/upload-artifact@v4 - with: - name: 'Base Repository Snapshots' - path: tests/e2e/snapshots + - name: Copy Base Repository e2e Snapshots To Artifacts Folder + run: cp -r tests/e2e/snapshots ${{ runner.temp }}/artifacts/base-repository/snapshots - name: Copy snapshots to temp folder run: cp -r tests/e2e/snapshots ${{ runner.temp }}/snapshots @@ -56,35 +53,29 @@ jobs: run: npm ci - name: Generate head repository's samples run: npm run build:samples - - name: Upload Head Repository Samples - uses: actions/upload-artifact@v4 - with: - name: 'Head Repository Vanilla JS Samples' - path: samples/vanilla-js + - name: Copy Head Repository Samples To Artifacts Folder + run: cp -r samples/vanilla-js ${{ runner.temp }}/artifacts/head-repository/samples - name: Delete snapshots folder run: rm -rf tests/e2e/snapshots - name: Copy snapshots from temp folder run: cp -r ${{ runner.temp }}/snapshots tests/e2e - name: Run tests run: npm run test:ci - - name: Upload Head Repository Diffs + - name: Copy Head Repository Diffs To Artifacts Folder if: '!cancelled()' - uses: actions/upload-artifact@v4 - with: - name: 'Snapshot Diffs' - path: tests/e2e/diffs - if-no-files-found: ignore + run: cp -r tests/e2e/diffs ${{ runner.temp }}/artifacts/head-repository/diffs - name: Build apexcharts + if: '!cancelled()' run: npm run build --if-present - - name: Upload Head Repository Build + - name: Copy Head Repository Build To Artifacts Folder if: '!cancelled()' - uses: actions/upload-artifact@v4 - with: - name: 'Build' - path: dist - - name: Upload Head Repository Coverage + run: cp -r dist ${{ runner.temp }}/artifacts/head-repository/build + - name: Copy Head Repository Test Coverage To Artifacts Folder + if: '!cancelled()' + run: cp -r coverage ${{ runner.temp }}/artifacts/head-repository/coverage + - name: Upload Artifacts if: '!cancelled()' uses: actions/upload-artifact@v4 with: - name: 'Coverage' - path: coverage + name: node${{ matrix.node-version }}${{ runner.os }}results + path: ${{ runner.temp }}/artifacts From 93ac0e3c533c3f52f55504993133f96854e34867 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Fri, 19 Jul 2024 01:30:06 +1200 Subject: [PATCH 10/19] fixed step failure on Windows --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 454f67e43..4c42399e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,8 +23,10 @@ jobs: # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - - name: Create artifacts folders - run: mkdir ${{ runner.temp }}/artifacts ${{ runner.temp }}/artifacts/base-repository ${{ runner.temp }}/artifacts/head-repository + - name: Create base repository artifacts folder + run: mkdir -p ${{ runner.temp }}/artifacts/base-repository + - name: Create head repository artifacts folder + run: mkdir -p ${{ runner.temp }}/artifacts/head-repository - name: Pull base repository uses: actions/checkout@v4 From 75cb4a178f0190c460d8ada7733f3775d3cd62a3 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Fri, 19 Jul 2024 01:56:04 +1200 Subject: [PATCH 11/19] get correct ref for base repository --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c42399e2..f6c22333a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,10 +28,11 @@ jobs: - name: Create head repository artifacts folder run: mkdir -p ${{ runner.temp }}/artifacts/head-repository - - name: Pull base repository + - name: Checkout base repository uses: actions/checkout@v4 with: repository: ${{ github.event.pull_request.base.repo.full_name }} + ref: ${{ github.event.pull_request.base.ref }} - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: From ef07f9a488f316e5dac50292fac6a9235a83765c Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Fri, 19 Jul 2024 01:56:17 +1200 Subject: [PATCH 12/19] fixed step failure on windows --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6c22333a..a6bd90776 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,7 +59,7 @@ jobs: - name: Copy Head Repository Samples To Artifacts Folder run: cp -r samples/vanilla-js ${{ runner.temp }}/artifacts/head-repository/samples - name: Delete snapshots folder - run: rm -rf tests/e2e/snapshots + run: rm -r tests/e2e/snapshots - name: Copy snapshots from temp folder run: cp -r ${{ runner.temp }}/snapshots tests/e2e - name: Run tests From f3c3edc113439deedd89c0f9527463c178124a7b Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Fri, 19 Jul 2024 23:42:46 +1200 Subject: [PATCH 13/19] Add test reproducibility job --- .github/workflows/ci.yml | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a6bd90776..47aa1a2b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ on: jobs: build: - + name: Test & Build runs-on: ${{ matrix.os }} strategy: @@ -82,3 +82,30 @@ jobs: with: name: node${{ matrix.node-version }}${{ runner.os }}results path: ${{ runner.temp }}/artifacts + + test-reproducibility: + name: Test Reproducibility + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + node-version: [18.x, 20.x, 22.x] + os: [windows-latest, macos-latest, ubuntu-latest] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup Node ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - name: Install packages + run: npm ci + - name: Build samples + run: npm run build:samples + - name: Generate snapshots + run: npm run e2e:update + - name: Run tests + run: npm run test:ci + From 12750f410386fa64dc660b633537e22fbb2c4105 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Fri, 19 Jul 2024 23:43:16 +1200 Subject: [PATCH 14/19] temporarily change node version to 22.4.1 --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47aa1a2b9..b92114f2e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [18.x, 20.x, 22.x] + node-version: [18.x, 20.x, 22.4.1] os: [windows-latest, macos-latest, ubuntu-latest] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ @@ -90,7 +90,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [18.x, 20.x, 22.x] + node-version: [18.x, 20.x, 22.4.1] os: [windows-latest, macos-latest, ubuntu-latest] steps: From 455bdf4cc2edc79727e5781f648f3899ee4e0423 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Sat, 20 Jul 2024 00:05:15 +1200 Subject: [PATCH 15/19] temporarily make lint job use Node 22.4.1 --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b268a6675..556885f5c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,10 +11,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Use Node.js 22.x + - name: Use Node.js 22.4.1 uses: actions/setup-node@v4 with: - node-version: 22.x + node-version: 22.4.1 - run: npm ci - name: Lint run: npm run lint \ No newline at end of file From 1afe80f041ae61f9c2436878c9de473a37aa3f80 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Sat, 20 Jul 2024 00:34:17 +1200 Subject: [PATCH 16/19] removed redundant step --- .github/workflows/ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b92114f2e..066d497f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,8 +47,6 @@ jobs: run: npm run e2e:update - name: Copy Base Repository e2e Snapshots To Artifacts Folder run: cp -r tests/e2e/snapshots ${{ runner.temp }}/artifacts/base-repository/snapshots - - name: Copy snapshots to temp folder - run: cp -r tests/e2e/snapshots ${{ runner.temp }}/snapshots - name: Checkout head repository uses: actions/checkout@v4 @@ -60,8 +58,8 @@ jobs: run: cp -r samples/vanilla-js ${{ runner.temp }}/artifacts/head-repository/samples - name: Delete snapshots folder run: rm -r tests/e2e/snapshots - - name: Copy snapshots from temp folder - run: cp -r ${{ runner.temp }}/snapshots tests/e2e + - name: Copy snapshots from base repository + run: cp -r ${{ runner.temp }}/artifacts/base-repository/snapshots tests/e2e - name: Run tests run: npm run test:ci - name: Copy Head Repository Diffs To Artifacts Folder From 505137171990a0e4f5cd49dc0e13ab4b4b3b8677 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Sat, 20 Jul 2024 02:28:18 +1200 Subject: [PATCH 17/19] unpin node.js 22.4.1 --- .github/workflows/ci.yml | 4 ++-- .github/workflows/lint.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 066d497f2..d1103f518 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [18.x, 20.x, 22.4.1] + node-version: [18.x, 20.x, 22.x] os: [windows-latest, macos-latest, ubuntu-latest] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ @@ -88,7 +88,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [18.x, 20.x, 22.4.1] + node-version: [18.x, 20.x, 22.x] os: [windows-latest, macos-latest, ubuntu-latest] steps: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 556885f5c..b268a6675 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,10 +11,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Use Node.js 22.4.1 + - name: Use Node.js 22.x uses: actions/setup-node@v4 with: - node-version: 22.4.1 + node-version: 22.x - run: npm ci - name: Lint run: npm run lint \ No newline at end of file From a1f234a457f97cf65277725b3571a62461d6725c Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Sat, 20 Jul 2024 03:10:01 +1200 Subject: [PATCH 18/19] pin node 22.x to 22.4.1 --- .github/workflows/ci.yml | 4 ++-- .github/workflows/lint.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1103f518..066d497f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [18.x, 20.x, 22.x] + node-version: [18.x, 20.x, 22.4.1] os: [windows-latest, macos-latest, ubuntu-latest] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ @@ -88,7 +88,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [18.x, 20.x, 22.x] + node-version: [18.x, 20.x, 22.4.1] os: [windows-latest, macos-latest, ubuntu-latest] steps: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b268a6675..556885f5c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,10 +11,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Use Node.js 22.x + - name: Use Node.js 22.4.1 uses: actions/setup-node@v4 with: - node-version: 22.x + node-version: 22.4.1 - run: npm ci - name: Lint run: npm run lint \ No newline at end of file From 31b69d3e31e99ad773ed065bb75c363f23e84ac0 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster <84299475+Sebastian-Webster@users.noreply.github.com> Date: Wed, 24 Jul 2024 15:53:08 +1200 Subject: [PATCH 19/19] changed versions --- .github/workflows/ci.yml | 10 ++++------ .github/workflows/lint.yml | 4 ++-- PULL_REQUEST_TEMPLATE.md | 1 + 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 066d497f2..95876263b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,13 +13,12 @@ on: jobs: build: name: Test & Build - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - node-version: [18.x, 20.x, 22.4.1] - os: [windows-latest, macos-latest, ubuntu-latest] + node-version: [18.x, 20.x, 22.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: @@ -83,13 +82,12 @@ jobs: test-reproducibility: name: Test Reproducibility - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - node-version: [18.x, 20.x, 22.4.1] - os: [windows-latest, macos-latest, ubuntu-latest] + node-version: [18.x, 20.x, 22.x] steps: - name: Checkout repository diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 556885f5c..b268a6675 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,10 +11,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Use Node.js 22.4.1 + - name: Use Node.js 22.x uses: actions/setup-node@v4 with: - node-version: 22.4.1 + node-version: 22.x - run: npm ci - name: Lint run: npm run lint \ No newline at end of file diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index a0581309b..3053d500a 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -21,3 +21,4 @@ Please delete options that are not relevant. - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes +- [ ] My branch is up to date with any changes from the main branch