From 1a1f89df904363b0e6c0ff13790bea35ec7e7aa4 Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Tue, 1 Oct 2024 01:14:11 -0500 Subject: [PATCH] ci: Remove duplicate build & test job in CI --- .github/workflows/benchmarks.yml | 106 ----------------------- .github/workflows/build-test.yml | 55 ++++++++++++ .github/workflows/ci.yml | 140 +++++++++++++++++++++---------- 3 files changed, 153 insertions(+), 148 deletions(-) delete mode 100644 .github/workflows/benchmarks.yml create mode 100644 .github/workflows/build-test.yml diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml deleted file mode 100644 index c7089ff63b..0000000000 --- a/.github/workflows/benchmarks.yml +++ /dev/null @@ -1,106 +0,0 @@ -name: Benchmarks - -on: - workflow_dispatch: - pull_request: - branches: - - '**' - paths: - - '**/src/**.js' - push: - branches: - - main - - v11 - paths: - - '**/src/**.js' - -jobs: - build_test: - name: Build & Test - uses: ./.github/workflows/ci.yml - - prepare: - name: Prepare environment - runs-on: ubuntu-latest - needs: build_test - timeout-minutes: 5 - steps: - - name: Download locally built preact package - uses: actions/download-artifact@v4 - with: - name: npm-package - - run: mv preact.tgz preact-local.tgz - - name: Download base package - uses: andrewiggins/download-base-artifact@v3 - with: - artifact: npm-package - workflow: ci.yml - required: false - - run: mv preact.tgz preact-main.tgz - - name: Upload locally build & base preact package - uses: actions/upload-artifact@v4 - with: - name: bench-environment - path: | - preact-local.tgz - preact-main.tgz - - bench_todo: - name: Bench todo - uses: ./.github/workflows/run-bench.yml - needs: prepare - with: - benchmark: todo/todo - timeout: 10 - - bench_text_update: - name: Bench text-update - uses: ./.github/workflows/run-bench.yml - needs: prepare - with: - benchmark: text-update/text-update - timeout: 10 - - bench_many_updates: - name: Bench many-updates - uses: ./.github/workflows/run-bench.yml - needs: prepare - with: - benchmark: many-updates/many-updates - timeout: 10 - - bench_replace1k: - name: Bench replace1k - uses: ./.github/workflows/run-bench.yml - needs: prepare - with: - benchmark: table-app/replace1k - - bench_update10th1k: - name: Bench 03_update10th1k_x16 - uses: ./.github/workflows/run-bench.yml - needs: prepare - with: - benchmark: table-app/update10th1k - - bench_create10k: - name: Bench create10k - uses: ./.github/workflows/run-bench.yml - needs: prepare - with: - benchmark: table-app/create10k - - bench_hydrate1k: - name: Bench hydrate1k - uses: ./.github/workflows/run-bench.yml - needs: prepare - with: - benchmark: table-app/hydrate1k - - bench_filter_list: - name: Bench filter-list - uses: ./.github/workflows/run-bench.yml - needs: prepare - with: - benchmark: filter-list/filter-list - timeout: 10 \ No newline at end of file diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 0000000000..98604af796 --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,55 @@ +name: Build & Test + +on: + workflow_dispatch: + workflow_call: + inputs: + ref: + description: 'Branch or tag ref to check out' + type: string + required: false + default: '' + artifact_name: + description: 'Name of the artifact to upload' + type: string + required: false + default: 'npm-package' + +jobs: + build_test: + name: Build & Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.ref || '' }} + - uses: actions/setup-node@v4 + with: + node-version-file: 'package.json' + cache: 'npm' + cache-dependency-path: '**/package-lock.json' + - run: npm ci + - name: test + env: + CI: true + COVERAGE: true + FLAKEY: false + # Not using `npm test` since it rebuilds source which npm ci has already done + run: | + npm run lint + npm run test:unit + - name: Coveralls GitHub Action + uses: coverallsapp/github-action@v2.3.0 + timeout-minutes: 2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Package + # Use --ignore-scripts here to avoid re-building again before pack + run: | + npm pack --ignore-scripts + mv preact-*.tgz preact.tgz + - name: Upload npm package + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.artifact_name || 'npm-package' }} + path: preact.tgz \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ca16caf6b..c21e60e8b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,61 +2,117 @@ name: CI on: workflow_dispatch: - workflow_call: - inputs: - ref: - description: 'Branch or tag ref to check out' - type: string - required: false - default: '' - artifact_name: - description: 'Name of the artifact to upload' - type: string - required: false - default: 'npm-package' pull_request: branches: - '**' + paths: + - '**/src/**.js' push: branches: - main - - restructure + - v11 + paths: + - '**/src/**.js' jobs: + filter_jobs: + outputs: + benchmarks: ${{ steps.filter.outputs.benchmarks }} + steps: + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + benchmarks: + - '**/src/**.js' + build_test: name: Build & Test + uses: ./.github/workflows/ci.yml + + prepare: + name: Prepare environment runs-on: ubuntu-latest + needs: build_test + if: ${{ needs.changes.outputs.benchmarks == 'true' }} + timeout-minutes: 5 steps: - - uses: actions/checkout@v4 + - name: Download locally built preact package + uses: actions/download-artifact@v4 with: - ref: ${{ inputs.ref || '' }} - - uses: actions/setup-node@v4 + name: npm-package + - run: mv preact.tgz preact-local.tgz + - name: Download base package + uses: andrewiggins/download-base-artifact@v3 with: - node-version-file: 'package.json' - cache: 'npm' - cache-dependency-path: '**/package-lock.json' - - run: npm ci - - name: test - env: - CI: true - COVERAGE: true - FLAKEY: false - # Not using `npm test` since it rebuilds source which npm ci has already done - run: | - npm run lint - npm run test:unit - - name: Coveralls GitHub Action - uses: coverallsapp/github-action@v2.3.0 - timeout-minutes: 2 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Package - # Use --ignore-scripts here to avoid re-building again before pack - run: | - npm pack --ignore-scripts - mv preact-*.tgz preact.tgz - - name: Upload npm package + artifact: npm-package + workflow: ci.yml + required: false + - run: mv preact.tgz preact-main.tgz + - name: Upload locally build & base preact package uses: actions/upload-artifact@v4 with: - name: ${{ inputs.artifact_name || 'npm-package' }} - path: preact.tgz \ No newline at end of file + name: bench-environment + path: | + preact-local.tgz + preact-main.tgz + + bench_todo: + name: Bench todo + uses: ./.github/workflows/run-bench.yml + needs: prepare + with: + benchmark: todo/todo + timeout: 10 + + bench_text_update: + name: Bench text-update + uses: ./.github/workflows/run-bench.yml + needs: prepare + with: + benchmark: text-update/text-update + timeout: 10 + + bench_many_updates: + name: Bench many-updates + uses: ./.github/workflows/run-bench.yml + needs: prepare + with: + benchmark: many-updates/many-updates + timeout: 10 + + bench_replace1k: + name: Bench replace1k + uses: ./.github/workflows/run-bench.yml + needs: prepare + with: + benchmark: table-app/replace1k + + bench_update10th1k: + name: Bench 03_update10th1k_x16 + uses: ./.github/workflows/run-bench.yml + needs: prepare + with: + benchmark: table-app/update10th1k + + bench_create10k: + name: Bench create10k + uses: ./.github/workflows/run-bench.yml + needs: prepare + with: + benchmark: table-app/create10k + + bench_hydrate1k: + name: Bench hydrate1k + uses: ./.github/workflows/run-bench.yml + needs: prepare + with: + benchmark: table-app/hydrate1k + + bench_filter_list: + name: Bench filter-list + uses: ./.github/workflows/run-bench.yml + needs: prepare + with: + benchmark: filter-list/filter-list + timeout: 10 \ No newline at end of file