From 87299fe4ac695df93b00402d794d7a6df9c739f1 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 10:39:47 -0700 Subject: [PATCH 01/30] [bfops/unity-test-tweaks]: C#/Unity test suite concurrency improvements --- .github/workflows/csharp-test.yml | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index f642f611739..9354fedb0e8 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -7,8 +7,40 @@ on: pull_request: jobs: + # The unity testsuite will fail if we try to run too many at once, due to the limited number of license seats. + # This job "gates" our testsuite runs by waiting until there's room to run. + gate: + # This prevents more than one gate check from running at once, to prevent potential race conditions. + concurrency: + group: unity-test-workflow-gate + cancel-in-progress: false + runs-on: ubuntu-latest + steps: + - name: Wait until <2 workflows running + run: | + while true; do + running=$(gh run list \ + --workflow "${GITHUB_WORKFLOW}" \ + --status in_progress \ + --json status \ + | jq 'length') + if [ "$running" -lt 2 ]; then + echo "Allowed to run" + break + fi + echo "2 workflows running. Waiting..." + sleep 30 + done + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + unity-testsuite: + needs: gate runs-on: ubuntu-latest + # Cancel any previous testsuites running on the same PR and/or ref. + concurrency: + group: ci-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true steps: - name: Checkout repository uses: actions/checkout@v4 From 97924eb5ee25cbd173b9c7d815e78ed688514c79 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 10:44:42 -0700 Subject: [PATCH 02/30] [bfops/unity-test-tweaks]: fix? --- .github/workflows/csharp-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 9354fedb0e8..cb488afce2e 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -20,6 +20,7 @@ jobs: run: | while true; do running=$(gh run list \ + --repo "${GITHUB_REPOSITORY}" \ --workflow "${GITHUB_WORKFLOW}" \ --status in_progress \ --json status \ From e434c033a39af071f412b26a2f0b9d7b0aadf97f Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 10:45:48 -0700 Subject: [PATCH 03/30] [bfops/unity-test-tweaks]: empty From d4940c56b2f6add6420af8467b8ee78b7d81f135 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 10:45:52 -0700 Subject: [PATCH 04/30] [bfops/unity-test-tweaks]: empty From 0de62304dd1a87a3a26e5f946c766325b9efa2fb Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 10:45:58 -0700 Subject: [PATCH 05/30] [bfops/unity-test-tweaks]: empty From ba1da34f2ac9799307a71577b2c56917a0ffdea2 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 10:49:27 -0700 Subject: [PATCH 06/30] [bfops/unity-test-tweaks]: fix comparison --- .github/workflows/csharp-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index cb488afce2e..46a1f710d3a 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -25,7 +25,8 @@ jobs: --status in_progress \ --json status \ | jq 'length') - if [ "$running" -lt 2 ]; then + # Use `-le` because this job itself counts as one. + if [ "$running" -le 2 ]; then echo "Allowed to run" break fi From ca33f15839200ce446526b55d867e711d5cab0da Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 10:52:23 -0700 Subject: [PATCH 07/30] [bfops/unity-test-tweaks]: remove cancel previous behavior --- .github/workflows/csharp-test.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 46a1f710d3a..086b4ad7ab2 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -40,9 +40,10 @@ jobs: needs: gate runs-on: ubuntu-latest # Cancel any previous testsuites running on the same PR and/or ref. - concurrency: - group: ci-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true +# TODO: Uncomment this before merging! +# concurrency: +# group: ci-${{ github.event.pull_request.number || github.ref }} +# cancel-in-progress: true steps: - name: Checkout repository uses: actions/checkout@v4 From 068a80a83d12606aea4b71b223be91e91533afa2 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 10:52:48 -0700 Subject: [PATCH 08/30] [bfops/unity-test-tweaks]: empty From 9c6680744e8731085146e7779527655125fc38c4 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 10:52:56 -0700 Subject: [PATCH 09/30] [bfops/unity-test-tweaks]: empty From e82044517c90fd5fb5dd306fd7dbff0dce4a36c3 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 10:53:01 -0700 Subject: [PATCH 10/30] [bfops/unity-test-tweaks]: empty From 016b154cdae112c72d8cbdf875b00cece98ee268 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 10:56:28 -0700 Subject: [PATCH 11/30] [bfops/unity-test-tweaks]: add output --- .github/workflows/csharp-test.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 086b4ad7ab2..052891c763f 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -30,7 +30,11 @@ jobs: echo "Allowed to run" break fi - echo "2 workflows running. Waiting..." + echo "$running workflows running. Waiting..." + gh run list \ + --repo "${GITHUB_REPOSITORY}" \ + --workflow "${GITHUB_WORKFLOW}" \ + --status in_progress \ sleep 30 done env: From 7171e7080449a4a064c0c16bcdc2a238368054c5 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 10:58:30 -0700 Subject: [PATCH 12/30] [bfops/unity-test-tweaks]: uncomment --- .github/workflows/csharp-test.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 052891c763f..41b84cd4b1e 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -44,10 +44,9 @@ jobs: needs: gate runs-on: ubuntu-latest # Cancel any previous testsuites running on the same PR and/or ref. -# TODO: Uncomment this before merging! -# concurrency: -# group: ci-${{ github.event.pull_request.number || github.ref }} -# cancel-in-progress: true + concurrency: + group: ci-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true steps: - name: Checkout repository uses: actions/checkout@v4 From 235fb7f07d2bdb58fc99c3e9a04c7d6c8b44246f Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:02:24 -0700 Subject: [PATCH 13/30] [bfops/unity-test-tweaks]: fix race condition? --- .github/workflows/csharp-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 41b84cd4b1e..14ed141313c 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -19,6 +19,7 @@ jobs: - name: Wait until <2 workflows running run: | while true; do + sleep 10; running=$(gh run list \ --repo "${GITHUB_REPOSITORY}" \ --workflow "${GITHUB_WORKFLOW}" \ @@ -35,7 +36,6 @@ jobs: --repo "${GITHUB_REPOSITORY}" \ --workflow "${GITHUB_WORKFLOW}" \ --status in_progress \ - sleep 30 done env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b161562e3a57661c4c97974c30d20bc7a52b6cfa Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:02:34 -0700 Subject: [PATCH 14/30] [bfops/unity-test-tweaks]: empty commit to bump CI From b87bc252f97e2479e09d38e47e4f2978ccd9cb47 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:03:08 -0700 Subject: [PATCH 15/30] [bfops/unity-test-tweaks]: fix? --- .github/workflows/csharp-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 14ed141313c..81610206015 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -19,7 +19,7 @@ jobs: - name: Wait until <2 workflows running run: | while true; do - sleep 10; + sleep 10 running=$(gh run list \ --repo "${GITHUB_REPOSITORY}" \ --workflow "${GITHUB_WORKFLOW}" \ From 6e05c9bcb644e385106530ad98332a20bf2a00af Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:03:15 -0700 Subject: [PATCH 16/30] [bfops/unity-test-tweaks]: empty commit to bump CI From 2b7975b80fef99d788b69502b0db1641738e6b5c Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:04:19 -0700 Subject: [PATCH 17/30] [bfops/unity-test-tweaks]: fix? --- .github/workflows/csharp-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 81610206015..e589213fe36 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -35,7 +35,7 @@ jobs: gh run list \ --repo "${GITHUB_REPOSITORY}" \ --workflow "${GITHUB_WORKFLOW}" \ - --status in_progress \ + --status in_progress done env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From fa81e737577e6ed14f34626e8ec085bbb7cfdf84 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:04:24 -0700 Subject: [PATCH 18/30] [bfops/unity-test-tweaks]: empty commit to bump CI From 63b5e27638a6cc022680a7fac647373d64ce5568 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:04:38 -0700 Subject: [PATCH 19/30] [bfops/unity-test-tweaks]: empty commit to bump CI From c6b65f1c50d58ec8d6bb733d720b9a8aab1222f8 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:07:53 -0700 Subject: [PATCH 20/30] [bfops/unity-test-tweaks]: fix? --- .github/workflows/csharp-test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index e589213fe36..700aaf43199 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -24,14 +24,14 @@ jobs: --repo "${GITHUB_REPOSITORY}" \ --workflow "${GITHUB_WORKFLOW}" \ --status in_progress \ - --json status \ - | jq 'length') + --json name \ + | jq '[.[] | select(.name=="build")] | length') # Use `-le` because this job itself counts as one. if [ "$running" -le 2 ]; then echo "Allowed to run" break fi - echo "$running workflows running. Waiting..." + echo "$running workflows running in build step. Waiting..." gh run list \ --repo "${GITHUB_REPOSITORY}" \ --workflow "${GITHUB_WORKFLOW}" \ From 84c9b46ef5fe3c923a233c1748d151c3e4e7a52b Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:08:08 -0700 Subject: [PATCH 21/30] [bfops/unity-test-tweaks]: fix? --- .github/workflows/csharp-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 700aaf43199..82c93bab478 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -25,7 +25,7 @@ jobs: --workflow "${GITHUB_WORKFLOW}" \ --status in_progress \ --json name \ - | jq '[.[] | select(.name=="build")] | length') + | jq '[.[] | select(.name=="unity-testsuite")] | length') # Use `-le` because this job itself counts as one. if [ "$running" -le 2 ]; then echo "Allowed to run" From b3527360d28f99e1541bf2b4f1f041ace8d22396 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:08:39 -0700 Subject: [PATCH 22/30] [bfops/unity-test-tweaks]: empty commit to bump CI From 4e5d87645158680bcf1fe9f0c982ab0e5ac10e53 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:08:46 -0700 Subject: [PATCH 23/30] [bfops/unity-test-tweaks]: empty commit to bump CI From 06bd036570eb24b54229307dd75c27d903e8c0ac Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:09:51 -0700 Subject: [PATCH 24/30] [bfops/unity-test-tweaks]: temp change to test --- .github/workflows/csharp-test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 82c93bab478..17df4314288 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -44,9 +44,9 @@ jobs: needs: gate runs-on: ubuntu-latest # Cancel any previous testsuites running on the same PR and/or ref. - concurrency: - group: ci-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true +# concurrency: +# group: ci-${{ github.event.pull_request.number || github.ref }} +# cancel-in-progress: true steps: - name: Checkout repository uses: actions/checkout@v4 From 46e62019c3750c3eba78b6035a196904ea6b2a36 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:10:04 -0700 Subject: [PATCH 25/30] [bfops/unity-test-tweaks]: empty commit to bump CI From 8f53ae26de48635f8392b49d540285cec201c469 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:10:14 -0700 Subject: [PATCH 26/30] [bfops/unity-test-tweaks]: empty commit to bump CI From b950829ceebd480b5a6c6f91a157bb8fd4cc96d7 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:11:00 -0700 Subject: [PATCH 27/30] [bfops/unity-test-tweaks]: empty commit to bump CI From 0582bf86b0fc6f69c4235815dc3c236fd4e0edf3 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:21:23 -0700 Subject: [PATCH 28/30] [bfops/unity-test-tweaks]: now does it work? --- .github/workflows/csharp-test.yml | 45 ++++++------------------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 17df4314288..b67a527d30d 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -6,47 +6,18 @@ on: - master pull_request: -jobs: - # The unity testsuite will fail if we try to run too many at once, due to the limited number of license seats. - # This job "gates" our testsuite runs by waiting until there's room to run. - gate: - # This prevents more than one gate check from running at once, to prevent potential race conditions. - concurrency: - group: unity-test-workflow-gate - cancel-in-progress: false - runs-on: ubuntu-latest - steps: - - name: Wait until <2 workflows running - run: | - while true; do - sleep 10 - running=$(gh run list \ - --repo "${GITHUB_REPOSITORY}" \ - --workflow "${GITHUB_WORKFLOW}" \ - --status in_progress \ - --json name \ - | jq '[.[] | select(.name=="unity-testsuite")] | length') - # Use `-le` because this job itself counts as one. - if [ "$running" -le 2 ]; then - echo "Allowed to run" - break - fi - echo "$running workflows running in build step. Waiting..." - gh run list \ - --repo "${GITHUB_REPOSITORY}" \ - --workflow "${GITHUB_WORKFLOW}" \ - --status in_progress - done - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# Only allow one instance of this workflow to run at once, due to limited Unity license seats. +concurrency: + group: ci-global + cancel-in-progress: false +jobs: unity-testsuite: - needs: gate runs-on: ubuntu-latest # Cancel any previous testsuites running on the same PR and/or ref. -# concurrency: -# group: ci-${{ github.event.pull_request.number || github.ref }} -# cancel-in-progress: true + concurrency: + group: ci-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true steps: - name: Checkout repository uses: actions/checkout@v4 From 2845c12b44341a479ca3bf93c1b88a81d60a0227 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:22:13 -0700 Subject: [PATCH 29/30] [bfops/unity-test-tweaks]: okay I guess this for now --- .github/workflows/csharp-test.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index b67a527d30d..c596ffbf8df 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -6,11 +6,6 @@ on: - master pull_request: -# Only allow one instance of this workflow to run at once, due to limited Unity license seats. -concurrency: - group: ci-global - cancel-in-progress: false - jobs: unity-testsuite: runs-on: ubuntu-latest From 9516aaeee15b8752bc8f25ff9e1d1c78fc8b8edd Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Tue, 29 Jul 2025 11:23:23 -0700 Subject: [PATCH 30/30] [bfops/unity-test-tweaks]: tweak --- .github/workflows/csharp-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index c596ffbf8df..2018c6754e6 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest # Cancel any previous testsuites running on the same PR and/or ref. concurrency: - group: ci-${{ github.event.pull_request.number || github.ref }} + group: unity-test-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true steps: - name: Checkout repository