From d3f1fea02281d0eb2f5485ca25ddd4627daa75f6 Mon Sep 17 00:00:00 2001 From: ale18V Date: Tue, 13 Oct 2026 14:28:21 +0200 Subject: [PATCH 1/2] ci: prototype native path-gated webapp checks --- .github/workflows/_build.yml | 5 +++++ .github/workflows/_test.yml | 10 +++++++++ .github/workflows/check-formatting.yml | 3 +++ .github/workflows/verify-webapp.yml | 30 ++++++++++++++++++++++++++ .github/workflows/verify.yml | 6 ++++-- 5 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/verify-webapp.yml diff --git a/.github/workflows/_build.yml b/.github/workflows/_build.yml index 46704d40d..1b4ea7e36 100644 --- a/.github/workflows/_build.yml +++ b/.github/workflows/_build.yml @@ -1,9 +1,14 @@ name: build on: workflow_call: + inputs: + docker: + type: boolean + default: true jobs: build-server-docker: + if: inputs.docker runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml index 406d47ef4..5bc118561 100644 --- a/.github/workflows/_test.yml +++ b/.github/workflows/_test.yml @@ -1,9 +1,14 @@ name: test on: workflow_call: + inputs: + webapp_only: + type: boolean + default: false jobs: test-discojs: + if: ${{ !inputs.webapp_only }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 @@ -14,6 +19,7 @@ jobs: - run: pnpm exec vitest --run --project=discojs test-discojs-node: + if: ${{ !inputs.webapp_only }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 @@ -24,6 +30,7 @@ jobs: - run: pnpm exec vitest --run --project=discojs-node test-discojs-web: + if: ${{ !inputs.webapp_only }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 @@ -34,6 +41,7 @@ jobs: - run: pnpm exec vitest --run --project=discojs-web test-server: + if: ${{ !inputs.webapp_only }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 @@ -157,6 +165,7 @@ jobs: if-no-files-found: ignore test-cli: + if: ${{ !inputs.webapp_only }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 @@ -184,6 +193,7 @@ jobs: pnpm -F cli start -t cifar10 -u 3 -e 1 -r 1 -i ci-cifar10 test-docs-examples: + if: ${{ !inputs.webapp_only }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 diff --git a/.github/workflows/check-formatting.yml b/.github/workflows/check-formatting.yml index 5ddaf4a0d..2e47a401f 100644 --- a/.github/workflows/check-formatting.yml +++ b/.github/workflows/check-formatting.yml @@ -3,6 +3,9 @@ on: push: branches: [main] pull_request: + merge_group: + types: [checks_requested] + branches: [main] jobs: format-check: diff --git a/.github/workflows/verify-webapp.yml b/.github/workflows/verify-webapp.yml new file mode 100644 index 000000000..97615fa12 --- /dev/null +++ b/.github/workflows/verify-webapp.yml @@ -0,0 +1,30 @@ +name: verify-webapp +on: + pull_request: + paths: + - "webapp/**" + +permissions: + contents: read + +jobs: + download-datasets: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: ./.github/actions/download-datasets + + static-analysis: + uses: ./.github/workflows/_static-analysis.yml + + build: + needs: [download-datasets, static-analysis] + uses: ./.github/workflows/_build.yml + with: + docker: false + + test: + needs: [build] + uses: ./.github/workflows/_test.yml + with: + webapp_only: true diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 445473e1a..3c263ffa2 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -2,11 +2,13 @@ name: verify on: push: branches: [main] - paths-ignore: - - "**/*.md" + merge_group: + types: [checks_requested] + branches: [main] pull_request: paths-ignore: - "**/*.md" + - "webapp/**" permissions: contents: read From 4ecefee04aa9925bbfe1e24bb30870dda4570ee2 Mon Sep 17 00:00:00 2001 From: ale18V Date: Wed, 21 Oct 2026 00:56:26 +0200 Subject: [PATCH 2/2] ci: verify fully after merge before publishing and deploying --- .github/workflows/check-formatting.yml | 3 --- .github/workflows/publish-deploy.yml | 19 +++++++++++++++++-- .github/workflows/verify.yml | 20 +++++++++++++++++--- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/.github/workflows/check-formatting.yml b/.github/workflows/check-formatting.yml index 2e47a401f..5ddaf4a0d 100644 --- a/.github/workflows/check-formatting.yml +++ b/.github/workflows/check-formatting.yml @@ -3,9 +3,6 @@ on: push: branches: [main] pull_request: - merge_group: - types: [checks_requested] - branches: [main] jobs: format-check: diff --git a/.github/workflows/publish-deploy.yml b/.github/workflows/publish-deploy.yml index faae53fdd..71975b084 100644 --- a/.github/workflows/publish-deploy.yml +++ b/.github/workflows/publish-deploy.yml @@ -1,17 +1,23 @@ name: publish-deploy on: - push: + workflow_run: + workflows: ["verify"] branches: [main] + types: [completed] + push: tags: [v*] jobs: publish-npm: + if: github.event_name == 'push' || (github.event.workflow_run.event == 'push' && github.event.workflow_run.conclusion == 'success') runs-on: ubuntu-latest permissions: id-token: write contents: read steps: - uses: actions/checkout@v7 + with: + ref: ${{ github.event.workflow_run.head_sha || github.ref }} - uses: actions/setup-node@v7 with: node-version-file: .nvmrc @@ -26,12 +32,14 @@ jobs: - run: pnpm -F 'discojs*' publish --access public --tag latest build-webapp: - if: github.ref_type == 'branch' + if: github.event_name == 'workflow_run' && github.event.workflow_run.event == 'push' && github.event.workflow_run.conclusion == 'success' runs-on: ubuntu-latest permissions: contents: read steps: - uses: actions/checkout@v7 + with: + ref: ${{ github.event.workflow_run.head_sha }} - uses: ./.github/actions/setup-node - run: pnpm -F webapp run build - uses: actions/upload-pages-artifact@v5 @@ -53,6 +61,7 @@ jobs: uses: actions/deploy-pages@v5 publish-github-container: + if: github.event_name == 'push' || (github.event.workflow_run.event == 'push' && github.event.workflow_run.conclusion == 'success') runs-on: ubuntu-latest permissions: contents: read @@ -60,6 +69,9 @@ jobs: outputs: digest: ${{ steps.build.outputs.digest }} steps: + - uses: actions/checkout@v7 + with: + ref: ${{ github.event.workflow_run.head_sha || github.ref }} - uses: docker/login-action@v4 with: registry: ghcr.io @@ -75,6 +87,7 @@ jobs: - uses: docker/build-push-action@v7 id: build with: + context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} @@ -88,6 +101,8 @@ jobs: id-token: write steps: - uses: actions/checkout@v7 + with: + ref: ${{ github.event.workflow_run.head_sha }} - uses: google-github-actions/auth@v3 with: project_id: disco-367212 diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 3c263ffa2..724327b0d 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -2,9 +2,6 @@ name: verify on: push: branches: [main] - merge_group: - types: [checks_requested] - branches: [main] pull_request: paths-ignore: - "**/*.md" @@ -30,3 +27,20 @@ jobs: test: needs: [build] uses: ./.github/workflows/_test.yml + + complete: + if: always() + needs: [download-datasets, static-analysis, build, test] + runs-on: ubuntu-latest + env: + DATASETS: ${{ needs.download-datasets.result }} + STATIC: ${{ needs.static-analysis.result }} + BUILD: ${{ needs.build.result }} + TEST: ${{ needs.test.result }} + steps: + - name: Check verification results + run: | + test "$DATASETS" = success + test "$STATIC" = success + test "$BUILD" = success + test "$TEST" = success