From 601e63b3f1a301b8ae743539094d7390e2218f01 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 17 Dec 2023 18:05:04 +0000 Subject: [PATCH 1/7] [depbot] Bump the deps group with 2 updates Bumps the deps group with 2 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact) and [actions/download-artifact](https://github.com/actions/download-artifact). Updates `actions/upload-artifact` from 3 to 4 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v3...v4) Updates `actions/download-artifact` from 3 to 4 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major dependency-group: deps - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-major dependency-group: deps ... Signed-off-by: dependabot[bot] --- .github/workflows/Build-gear-loader-network.yml | 4 ++-- .github/workflows/CI.yaml | 2 +- .github/workflows/benchmarks.yml | 4 ++-- .github/workflows/build.yml | 2 +- .github/workflows/comparison-table.yml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/Build-gear-loader-network.yml b/.github/workflows/Build-gear-loader-network.yml index ace98317b67..2c524c69410 100644 --- a/.github/workflows/Build-gear-loader-network.yml +++ b/.github/workflows/Build-gear-loader-network.yml @@ -34,7 +34,7 @@ jobs: cargo build --release --locked --package gear-node-loader - name: Archive production artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: gear-loader path: | @@ -48,7 +48,7 @@ jobs: uses: actions/checkout@v4 - name: Download artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: gear-loader diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 8ea62ea73ee..daa24ac73ae 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -150,7 +150,7 @@ jobs: needs: build steps: - name: Download artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 - name: Delete previous release uses: dev-drprasad/delete-tag-and-release@v1.0.1 diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index a2932cbffa8..72b7c938a12 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -49,14 +49,14 @@ jobs: - name: "ACTIONS: Upload artifact with benchmarking errors (if exist)" if: ${{ always() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: benchmarking-errors path: scripts/benchmarking/benchmarking_errors.txt if-no-files-found: ignore - name: "ACTIONS: Upload artifact with updated weights (vara)" - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: weights-vara path: runtime/vara/src/weights/ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0a08e75669c..349432e47a6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -174,7 +174,7 @@ jobs: - name: Upload artifacts if: github.event_name == 'push' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: path: artifact diff --git a/.github/workflows/comparison-table.yml b/.github/workflows/comparison-table.yml index 17f39581145..a77660b5ac7 100644 --- a/.github/workflows/comparison-table.yml +++ b/.github/workflows/comparison-table.yml @@ -40,7 +40,7 @@ jobs: ./scripts/weight-diff.sh master $(git branch --show-current) ${{ inputs.runtime }} --display-units > ${{ inputs.runtime }}-tables.txt - name: "ACTIONS: Upload artifact with comparison tables (${{ inputs.runtime }})" - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ inputs.runtime }}-tables path: ${{ inputs.runtime }}-tables.txt From d6bdbd9c29e90228e87eb31671262276bb111460 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Mon, 18 Dec 2023 22:25:25 +0800 Subject: [PATCH 2/7] ci(dispatch): provide logs for debugging skipping --- .github/actions/label/build.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/label/build.js b/.github/actions/label/build.js index c4e80416e39..277fb0f2975 100644 --- a/.github/actions/label/build.js +++ b/.github/actions/label/build.js @@ -23,7 +23,8 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); * * @returns {Promise<[boolean, string]>} [skip, String(check_runs)] **/ -const skip = async ({ github }) => { +const skip = async ({ github, core }) => { + core.info("Checking if need to skip dispatch from ${REF_NAME}, is fork: ${IS_FORK}"); if (!IS_FORK && REF_NAME.startsWith("dependabot")) return [true, ""] const { @@ -146,7 +147,7 @@ const listJobs = async ({ github, core, run_id }) => { * The main function. **/ module.exports = async ({ github, core }) => { - const [skipAction, check_runs] = await skip({ github }); + const [skipAction, check_runs] = await skip({ github, core }); if (skipAction) { core.info("Build has already been processed, check runs: " + check_runs); From 7250b396893b94a0763d0acc8a340470977f36a8 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Mon, 18 Dec 2023 22:27:11 +0800 Subject: [PATCH 3/7] ci(dispatch): trigger skipping From 513260c54c5d2f80988547bd55b3a45b568764f5 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Mon, 18 Dec 2023 22:35:17 +0800 Subject: [PATCH 4/7] ci(label): debug repo name on dispatching --- .github/actions/label/build.js | 6 +++--- .github/workflows/label.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/label/build.js b/.github/actions/label/build.js index 277fb0f2975..6196feb2bfe 100644 --- a/.github/actions/label/build.js +++ b/.github/actions/label/build.js @@ -3,7 +3,7 @@ */ const [owner, repo] = ["gear-tech", "gear"]; -const { LABEL, REF, HEAD_SHA, TITLE, NUMBER, IS_FORK, REF_NAME } = process.env; +const { LABEL, REF, HEAD_SHA, TITLE, NUMBER, REPO, REF_NAME } = process.env; const linux = LABEL === "A0-pleasereview" || LABEL === "A4-insubstantial" || @@ -24,8 +24,8 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); * @returns {Promise<[boolean, string]>} [skip, String(check_runs)] **/ const skip = async ({ github, core }) => { - core.info("Checking if need to skip dispatch from ${REF_NAME}, is fork: ${IS_FORK}"); - if (!IS_FORK && REF_NAME.startsWith("dependabot")) return [true, ""] + core.info(`Checking if need to skip dispatch from ${REPO}:${REF_NAME}`); + if (REPO === "gear-tech/gear" && REF_NAME.startsWith("dependabot")) return [true, ""] const { data: { check_runs }, diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 1952652fcb1..16ef58feb2a 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -25,7 +25,7 @@ jobs: REF_NAME: ${{ github.ref_name }} TITLE: ${{ github.event.pull_request.title }} NUMBER: ${{ github.event.number }} - IS_FORK: ${{ github.event.pull_request.head.repo.full_name != 'gear-tech/gear' }} + REPO: ${{ github.event.pull_request.head.repo.full_name }} with: script: | const script = require('./.github/actions/label/build.js'); From 683e135c6765bc7c5899552892e8d3357a9f8368 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Mon, 18 Dec 2023 22:41:10 +0800 Subject: [PATCH 5/7] ci(label): use head ref for the branch name --- .github/actions/label/build.js | 7 ++++--- .github/workflows/label.yml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/actions/label/build.js b/.github/actions/label/build.js index 6196feb2bfe..2a228100769 100644 --- a/.github/actions/label/build.js +++ b/.github/actions/label/build.js @@ -3,7 +3,7 @@ */ const [owner, repo] = ["gear-tech", "gear"]; -const { LABEL, REF, HEAD_SHA, TITLE, NUMBER, REPO, REF_NAME } = process.env; +const { LABEL, REF, HEAD_SHA, TITLE, NUMBER, REPO, HEAD_REF } = process.env; const linux = LABEL === "A0-pleasereview" || LABEL === "A4-insubstantial" || @@ -24,8 +24,9 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); * @returns {Promise<[boolean, string]>} [skip, String(check_runs)] **/ const skip = async ({ github, core }) => { - core.info(`Checking if need to skip dispatch from ${REPO}:${REF_NAME}`); - if (REPO === "gear-tech/gear" && REF_NAME.startsWith("dependabot")) return [true, ""] + core.info(`The env REF is: ${REF}`); + core.info(`Checking if need to skip dispatch from ${REPO}:${HEAD_REF}`); + if (REPO === "gear-tech/gear" && REF.startsWith("dependabot")) return [true, ""] const { data: { check_runs }, diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 16ef58feb2a..b2eefec53d4 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -22,7 +22,7 @@ jobs: HEAD_SHA: ${{ github.event.pull_request.head.sha }} LABEL: ${{ github.event.label.name }} REF: ${{ github.head_ref || github.ref_name }} - REF_NAME: ${{ github.ref_name }} + HEAD_REF: ${{ github.head_ref }} TITLE: ${{ github.event.pull_request.title }} NUMBER: ${{ github.event.number }} REPO: ${{ github.event.pull_request.head.repo.full_name }} From 1a91541280afc3257d8b7a73c153c771793c8c9f Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Mon, 18 Dec 2023 22:43:01 +0800 Subject: [PATCH 6/7] ci(label): clean unused environment variables --- .github/actions/label/build.js | 5 ++--- .github/workflows/label.yml | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/actions/label/build.js b/.github/actions/label/build.js index 2a228100769..0412a34e18a 100644 --- a/.github/actions/label/build.js +++ b/.github/actions/label/build.js @@ -3,7 +3,7 @@ */ const [owner, repo] = ["gear-tech", "gear"]; -const { LABEL, REF, HEAD_SHA, TITLE, NUMBER, REPO, HEAD_REF } = process.env; +const { LABEL, REF, HEAD_SHA, TITLE, NUMBER, REPO } = process.env; const linux = LABEL === "A0-pleasereview" || LABEL === "A4-insubstantial" || @@ -24,8 +24,7 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); * @returns {Promise<[boolean, string]>} [skip, String(check_runs)] **/ const skip = async ({ github, core }) => { - core.info(`The env REF is: ${REF}`); - core.info(`Checking if need to skip dispatch from ${REPO}:${HEAD_REF}`); + core.info(`Checking if need to skip dispatch from ${REPO}:${REF}`); if (REPO === "gear-tech/gear" && REF.startsWith("dependabot")) return [true, ""] const { diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index b2eefec53d4..d1d7ba41015 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -22,7 +22,6 @@ jobs: HEAD_SHA: ${{ github.event.pull_request.head.sha }} LABEL: ${{ github.event.label.name }} REF: ${{ github.head_ref || github.ref_name }} - HEAD_REF: ${{ github.head_ref }} TITLE: ${{ github.event.pull_request.title }} NUMBER: ${{ github.event.number }} REPO: ${{ github.event.pull_request.head.repo.full_name }} From 1565eb436237feaeb7c704dd644897d36b9d3743 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Mon, 18 Dec 2023 22:55:14 +0800 Subject: [PATCH 7/7] ci(label): clean outdated code --- .github/actions/label/build.js | 44 +++++++++++++--------------------- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/.github/actions/label/build.js b/.github/actions/label/build.js index 0412a34e18a..1bda6876641 100644 --- a/.github/actions/label/build.js +++ b/.github/actions/label/build.js @@ -20,12 +20,13 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); /** * If skipping this action. - * - * @returns {Promise<[boolean, string]>} [skip, String(check_runs)] **/ -const skip = async ({ github, core }) => { +const checkSkip = async ({ github, core }) => { core.info(`Checking if need to skip dispatch from ${REPO}:${REF}`); - if (REPO === "gear-tech/gear" && REF.startsWith("dependabot")) return [true, ""] + if (REPO === "gear-tech/gear" && REF.startsWith("dependabot")) { + core.info("This pull request is from dependabot, skipping dispatching."); + process.exit(0); + } const { data: { check_runs }, @@ -35,24 +36,18 @@ const skip = async ({ github, core }) => { ref: REF, }); - const runs = linux - ? check_runs.filter( - (run) => run.name === "build" || run.name === "build / linux" - ) - : check_runs.filter((run) => run.name === "build / macos-x86"); - - let skipAction = false; - for (run of runs) { - // If there is already a build, skip this action. - if ( - run.name === "build / linux" - || run.name === "build / macos-x86" - || (run.name === "build" && run.conclusion !== "skipped")) { - return [true]; - } + if (check_runs.filter((run) => ( + (run.name === "build" && run.conclusion !== "skipped") + || run.name === "build / linux" + || run.name === "build / macos-x86" + )).length > 0) { + core.info( + "Build has already been processed, check runs: ", + JSON.stringify(check_runs, null, 2) + ); + + process.exit(0) } - - return [skipAction, JSON.stringify(check_runs, null, 2)]; }; /** @@ -147,12 +142,7 @@ const listJobs = async ({ github, core, run_id }) => { * The main function. **/ module.exports = async ({ github, core }) => { - const [skipAction, check_runs] = await skip({ github, core }); - - if (skipAction) { - core.info("Build has already been processed, check runs: " + check_runs); - return; - } + await checkSkip({ github, core }); const run = await dispatchWorkflow({ core, github }); core.info(`Dispatched workflow ${run.html_url}`);