From dd2385b7d09ad95054ced42e37e2ff82c1af82a8 Mon Sep 17 00:00:00 2001 From: Norihide Saito Date: Sun, 2 Aug 2026 21:38:20 +0900 Subject: [PATCH 1/2] Add parallel GitHub Actions CI --- .github/README.md | 25 ++++++++++++ .github/workflows/parallel-testing-ci.yml | 48 +++++++++++++++++++++++ README.md | 2 + SliceTests/SliceTests.cs | 1 + create_slicing_filter_condition.sh | 3 +- 5 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 .github/README.md create mode 100644 .github/workflows/parallel-testing-ci.yml diff --git a/.github/README.md b/.github/README.md new file mode 100644 index 0000000..148fe30 --- /dev/null +++ b/.github/README.md @@ -0,0 +1,25 @@ +# GitHub Actions overview + +`workflows/parallel-testing-ci.yml` runs the same parallel test strategy as +`azure-pipelines.yml`. + +## Triggers + +The workflow runs for pull requests and pushes targeting `master`, on a weekly +schedule at 03:00 UTC on Monday, and can also be started manually from the +GitHub Actions page. + +## Parallel test execution + +The workflow creates five Ubuntu jobs with a matrix. Each job: + +1. Checks out the repository and installs the SDK specified by `global.json`. +2. Restores dependencies and builds the project. +3. Lists NUnit tests and sources `create_slicing_filter_condition.sh`. +4. Sets the same `SYSTEM_TOTALJOBSINPHASE` and + `SYSTEM_JOBPOSITIONINPHASE` values used by Azure Pipelines, so each job runs + one fifth of the test suite. +5. Runs its selected tests with `dotnet test --no-build --filter`. + +The matrix uses `fail-fast: false`, so all five slices finish and report their +results even when one slice fails. diff --git a/.github/workflows/parallel-testing-ci.yml b/.github/workflows/parallel-testing-ci.yml new file mode 100644 index 0000000..936f09b --- /dev/null +++ b/.github/workflows/parallel-testing-ci.yml @@ -0,0 +1,48 @@ +name: Parallel Testing CI + +on: + schedule: + - cron: '0 3 * * 1' + workflow_dispatch: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + parallel-testing-ci: + name: Run tests in parallel (${{ matrix.slice }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + slice: [1, 2, 3, 4, 5] + env: + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup .NET SDK from global.json + uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + + - name: Restore + run: dotnet restore + + - name: Build + run: dotnet build --no-restore + + - name: List tests and create slicing filter + run: | + tests=($(dotnet test . --no-build --list-tests | grep Test_)) + export SYSTEM_TOTALJOBSINPHASE=5 + export SYSTEM_JOBPOSITIONINPHASE=${{ matrix.slice }} + . ./create_slicing_filter_condition.sh "${tests[@]}" + echo "targetTestsFilter=$targetTestsFilter" >> "$GITHUB_ENV" + + - name: Test + run: dotnet test ./SliceTests/SliceTests.csproj --no-build --filter "$targetTestsFilter" diff --git a/README.md b/README.md index 83661b1..68aa89d 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ This .NET 10 parallel testing sample uses `--list-tests` and `--filter` paramete This sample has the 100 tests, and slices them to 20 tests in 5 jobs. You can see the pipeline behavior result by clicking the build status badge above. +For the GitHub Actions equivalent, see the [GitHub Actions overview](.github/README.md). + ## Overview of *azure-pipelines.yml* ### Setting up parallel count diff --git a/SliceTests/SliceTests.cs b/SliceTests/SliceTests.cs index 4fc0658..31490ae 100644 --- a/SliceTests/SliceTests.cs +++ b/SliceTests/SliceTests.cs @@ -41,6 +41,7 @@ public void TearDown() } [Test] + [Retry(3)] [TestCaseSource(nameof(Words))] public void SearchTest_ByWord_WordContainsInTitle(string word) { diff --git a/create_slicing_filter_condition.sh b/create_slicing_filter_condition.sh index 0e3e7cf..fc95acd 100644 --- a/create_slicing_filter_condition.sh +++ b/create_slicing_filter_condition.sh @@ -22,4 +22,5 @@ filter+="|${filterProperty}=${targetTestName}" done filter=${filter#"|"} -echo "##vso[task.setvariable variable=targetTestsFilter]$filter" \ No newline at end of file +targetTestsFilter=$filter +echo "##vso[task.setvariable variable=targetTestsFilter]$targetTestsFilter" From bd7fb148fe03981ce7d666f77f42c8241d739e51 Mon Sep 17 00:00:00 2001 From: Norihide Saito Date: Sun, 2 Aug 2026 21:44:14 +0900 Subject: [PATCH 2/2] Update copyright year --- LICENSE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index e9a6f36..c88b9a6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018-2019 idubnori +Copyright (c) 2018-2026 idubnori Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE.