From 77807e5b389dd33ac7e4ff19c1e9e5fd334dab74 Mon Sep 17 00:00:00 2001 From: Naoki Fujita Date: Fri, 12 Sep 2025 01:32:39 +0900 Subject: [PATCH 01/15] =?UTF-8?q?feat:=20branch=20protection=E3=81=AE?= =?UTF-8?q?=E6=8C=99=E5=8B=95=E7=A2=BA=E8=AA=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rails_basics_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rails_basics_ci.yml b/.github/workflows/rails_basics_ci.yml index c16ed4c..6229d0b 100644 --- a/.github/workflows/rails_basics_ci.yml +++ b/.github/workflows/rails_basics_ci.yml @@ -114,4 +114,4 @@ jobs: group_index: [0,1] steps: - run: | - echo hello; + echo hello branch protection; From 0909de3f023776e636f7aa9435d5e6aa08ae7770 Mon Sep 17 00:00:00 2001 From: Naoki Fujita Date: Fri, 12 Sep 2025 01:39:53 +0900 Subject: [PATCH 02/15] =?UTF-8?q?feat:=20branch=20protection=E3=81=AE?= =?UTF-8?q?=E6=8C=99=E5=8B=95=E7=A2=BA=E8=AA=8D2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rails_basics_ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rails_basics_ci.yml b/.github/workflows/rails_basics_ci.yml index 6229d0b..74d0ab0 100644 --- a/.github/workflows/rails_basics_ci.yml +++ b/.github/workflows/rails_basics_ci.yml @@ -115,3 +115,4 @@ jobs: steps: - run: | echo hello branch protection; + exit 1 From 2d4169df3a40f40d9fd0c35ddab6802aa027dc4c Mon Sep 17 00:00:00 2001 From: Naoki Fujita Date: Fri, 12 Sep 2025 01:42:38 +0900 Subject: [PATCH 03/15] feat --- .github/workflows/rails_basics_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rails_basics_ci.yml b/.github/workflows/rails_basics_ci.yml index 74d0ab0..229a374 100644 --- a/.github/workflows/rails_basics_ci.yml +++ b/.github/workflows/rails_basics_ci.yml @@ -114,5 +114,5 @@ jobs: group_index: [0,1] steps: - run: | - echo hello branch protection; + echo hello branch protection3; exit 1 From 6e2570e96d34499e647830a882646444629c0de8 Mon Sep 17 00:00:00 2001 From: Naoki Fujita Date: Fri, 12 Sep 2025 01:49:24 +0900 Subject: [PATCH 04/15] feat --- .github/workflows/rails_basics_ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/rails_basics_ci.yml b/.github/workflows/rails_basics_ci.yml index 229a374..6229d0b 100644 --- a/.github/workflows/rails_basics_ci.yml +++ b/.github/workflows/rails_basics_ci.yml @@ -114,5 +114,4 @@ jobs: group_index: [0,1] steps: - run: | - echo hello branch protection3; - exit 1 + echo hello branch protection; From 7e7770643114b9f0b26c7974727fb4ca1b1e3caa Mon Sep 17 00:00:00 2001 From: Naoki Fujita Date: Fri, 12 Sep 2025 02:00:45 +0900 Subject: [PATCH 05/15] =?UTF-8?q?feat:=20TEST=5FENV=5FNUMBER=E3=82=92xml?= =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E5=90=8D=E3=81=AB=E6=8A=98?= =?UTF-8?q?=E3=82=8A=E8=BE=BC=E3=81=BF=E3=81=9F=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rails_basics_ci.yml | 11 ++++------- rails/basics/.rspec_parallel | 3 +++ 2 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 rails/basics/.rspec_parallel diff --git a/.github/workflows/rails_basics_ci.yml b/.github/workflows/rails_basics_ci.yml index 6229d0b..bdf916f 100644 --- a/.github/workflows/rails_basics_ci.yml +++ b/.github/workflows/rails_basics_ci.yml @@ -83,25 +83,22 @@ jobs: with: reports: prev_merged glob: spec/**/*_spec.rb - index: ${{ matrix.group_index }} + index: ${{ strategy.job-index }} total: ${{ strategy.job-total }} working-directory: rails/basics - - run: echo "$(seq -s, $((${{ matrix.group_index }} * $(nproc))) $((${{ matrix.group_index }} * $(nproc) + $(nproc) - 1)) | sed 's/,$//')" + - run: echo "$(seq -s, $((${{ strategy.job-index }} * $(nproc))) $((${{ strategy.job-index }} * $(nproc) + $(nproc) - 1)) | sed 's/,$//')" # インスタンス数×nproc個にテストグループを分割し、そのうち2グループ実行する - env: - GROUP_INDEX: ${{ matrix.group_index }} + GHA_JOB_INDEX: ${{ strategy.job-index }} run: bundle exec parallel_rspec \ -n $(nproc) \ - --format RspecJunitFormatter \ - --out test_reports/junit-${{ matrix.group_index }}-$TEST_ENV_NUMBER.xml \ - --format documentation \ ${{ steps.split_tests.outputs.paths }} working-directory: rails/basics - uses: actions/upload-artifact@v4 if: ${{ success() || failure() }} with: - name: test-report-${{ matrix.group_index }} + name: test-report-${{ strategy.job-index }} path: | rails/basics/test_reports/ include-hidden-files: true diff --git a/rails/basics/.rspec_parallel b/rails/basics/.rspec_parallel new file mode 100644 index 0000000..10d297b --- /dev/null +++ b/rails/basics/.rspec_parallel @@ -0,0 +1,3 @@ +--format RspecJunitFormatter +--out test_reports/junit-<%= ENV['GHA_JOB_INDEX'] %>-<%= ENV['TEST_ENV_NUMBER'] %>.xml +--format documentation From 4e1d415396b7a58a5188b04aae2a4982b48c0d90 Mon Sep 17 00:00:00 2001 From: Naoki Fujita Date: Fri, 12 Sep 2025 02:07:10 +0900 Subject: [PATCH 06/15] feat --- .github/workflows/rails_basics_ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rails_basics_ci.yml b/.github/workflows/rails_basics_ci.yml index bdf916f..9254e8a 100644 --- a/.github/workflows/rails_basics_ci.yml +++ b/.github/workflows/rails_basics_ci.yml @@ -90,10 +90,9 @@ jobs: # インスタンス数×nproc個にテストグループを分割し、そのうち2グループ実行する - env: GHA_JOB_INDEX: ${{ strategy.job-index }} - run: - bundle exec parallel_rspec \ - -n $(nproc) \ - ${{ steps.split_tests.outputs.paths }} + run: | + bundle + bundle exec parallel_rspec -n $(nproc) ${{ steps.split_tests.outputs.paths }} working-directory: rails/basics - uses: actions/upload-artifact@v4 if: ${{ success() || failure() }} From 128c580b83a3ab7d74363d209a1a88d4bbb16508 Mon Sep 17 00:00:00 2001 From: Naoki Fujita Date: Fri, 12 Sep 2025 02:12:37 +0900 Subject: [PATCH 07/15] =?UTF-8?q?feat:=20=E3=83=96=E3=83=A9=E3=83=B3?= =?UTF-8?q?=E3=83=81=E3=83=97=E3=83=AD=E3=83=86=E3=82=AF=E3=82=B7=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E8=A8=AD=E5=AE=9A=E7=94=A8=E3=81=AE=E9=9B=86=E7=B4=84?= =?UTF-8?q?=E5=88=A4=E5=AE=9A=E3=82=92=E3=81=97=E3=81=A6=E3=81=BF=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rails_basics_ci.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rails_basics_ci.yml b/.github/workflows/rails_basics_ci.yml index 9254e8a..4f77758 100644 --- a/.github/workflows/rails_basics_ci.yml +++ b/.github/workflows/rails_basics_ci.yml @@ -47,7 +47,7 @@ jobs: strategy: fail-fast: false matrix: - group_index: [0,1] + group_index: [0,1,2,3] steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 @@ -102,6 +102,15 @@ jobs: rails/basics/test_reports/ include-hidden-files: true if-no-files-found: ignore + + all-test-is-passed: + runs-on: ubuntu-latest + needs: [test] + if: always() + steps: + - run: | + test "${{ needs.test.result }}" = "success" + dummy: runs-on: ubuntu-latest strategy: From 6a52c078cfb0ab2e8a4b774d86280dabea7584fe Mon Sep 17 00:00:00 2001 From: Naoki Fujita Date: Fri, 12 Sep 2025 02:16:26 +0900 Subject: [PATCH 08/15] =?UTF-8?q?feat:=20=E7=A2=BA=E7=8E=87=E7=9A=84?= =?UTF-8?q?=E3=81=AB=E5=A4=B1=E6=95=97=E3=81=95=E3=81=9B=E3=81=A6=E8=A9=A6?= =?UTF-8?q?=E9=A8=93=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rails/basics/spec/models/foo1_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rails/basics/spec/models/foo1_spec.rb b/rails/basics/spec/models/foo1_spec.rb index 9201977..d71e59f 100644 --- a/rails/basics/spec/models/foo1_spec.rb +++ b/rails/basics/spec/models/foo1_spec.rb @@ -3,6 +3,6 @@ RSpec.describe 'foo1' do it do sleep(1) - expect(0 + 1).to eq 1 + expect([true, false].sample).to be true end end From 1d539d337d15fef36c732591ed2cf19f1274bbc0 Mon Sep 17 00:00:00 2001 From: Naoki Fujita Date: Fri, 12 Sep 2025 02:44:47 +0900 Subject: [PATCH 09/15] =?UTF-8?q?feat:=20reusable=20workflow=E3=81=AE?= =?UTF-8?q?=E6=8C=99=E5=8B=95=E6=A4=9C=E8=A8=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rails_basics_ci.yml | 5 +++++ .../workflows/reusable/dummy-in-reusable.yml | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .github/workflows/reusable/dummy-in-reusable.yml diff --git a/.github/workflows/rails_basics_ci.yml b/.github/workflows/rails_basics_ci.yml index 4f77758..b534957 100644 --- a/.github/workflows/rails_basics_ci.yml +++ b/.github/workflows/rails_basics_ci.yml @@ -120,3 +120,8 @@ jobs: steps: - run: | echo hello branch protection; + + use-reusable: + uses: ./.github/workflows/reusable/dummy-in-reusable.yml + with: + message: use-reusable diff --git a/.github/workflows/reusable/dummy-in-reusable.yml b/.github/workflows/reusable/dummy-in-reusable.yml new file mode 100644 index 0000000..e3091bc --- /dev/null +++ b/.github/workflows/reusable/dummy-in-reusable.yml @@ -0,0 +1,22 @@ +on: + workflow_call: + inputs: + message: + required: true + +jobs: + dummy-in-reusable: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + group_index: [0,1] + steps: + - run: | + echo hello branch ${{ inputs.message }}; + all-test-is-passed: + runs-on: ubuntu-latest + needs: [dummy-in-reusable] + if: always() + steps: + - run: test "${{ needs.dummy-in-reusable.result }}" = "success" From 3e7ce2ef4117f43f28b44a50cde566deb7038324 Mon Sep 17 00:00:00 2001 From: Naoki Fujita Date: Fri, 12 Sep 2025 02:46:32 +0900 Subject: [PATCH 10/15] =?UTF-8?q?fix:=20reusable=E3=81=A8=E3=81=84?= =?UTF-8?q?=E3=81=86=E3=83=87=E3=82=A3=E3=83=AC=E3=82=AF=E3=83=88=E3=83=AA?= =?UTF-8?q?=E3=81=AF=E4=BD=9C=E3=82=8C=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rails_basics_ci.yml | 2 +- .../{reusable/dummy-in-reusable.yml => reusable-dummy.yml} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{reusable/dummy-in-reusable.yml => reusable-dummy.yml} (100%) diff --git a/.github/workflows/rails_basics_ci.yml b/.github/workflows/rails_basics_ci.yml index b534957..0bb11e5 100644 --- a/.github/workflows/rails_basics_ci.yml +++ b/.github/workflows/rails_basics_ci.yml @@ -122,6 +122,6 @@ jobs: echo hello branch protection; use-reusable: - uses: ./.github/workflows/reusable/dummy-in-reusable.yml + uses: ./.github/workflows/reusable-dummy.yml with: message: use-reusable diff --git a/.github/workflows/reusable/dummy-in-reusable.yml b/.github/workflows/reusable-dummy.yml similarity index 100% rename from .github/workflows/reusable/dummy-in-reusable.yml rename to .github/workflows/reusable-dummy.yml From a111e7a88dbffcf6ca44cba2efd98d8dd727f077 Mon Sep 17 00:00:00 2001 From: Naoki Fujita Date: Fri, 12 Sep 2025 02:47:35 +0900 Subject: [PATCH 11/15] =?UTF-8?q?fix:=20type=E3=81=AF=E5=BF=85=E9=A0=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/reusable-dummy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/reusable-dummy.yml b/.github/workflows/reusable-dummy.yml index e3091bc..75b522a 100644 --- a/.github/workflows/reusable-dummy.yml +++ b/.github/workflows/reusable-dummy.yml @@ -2,6 +2,7 @@ on: workflow_call: inputs: message: + type: string required: true jobs: From 8be28bbd0e30d4c786702b8c28578770d2ec0fc1 Mon Sep 17 00:00:00 2001 From: Naoki Fujita Date: Fri, 12 Sep 2025 02:51:42 +0900 Subject: [PATCH 12/15] feat --- rails/basics/spec/models/foo1_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/rails/basics/spec/models/foo1_spec.rb b/rails/basics/spec/models/foo1_spec.rb index d71e59f..63b660d 100644 --- a/rails/basics/spec/models/foo1_spec.rb +++ b/rails/basics/spec/models/foo1_spec.rb @@ -4,5 +4,6 @@ it do sleep(1) expect([true, false].sample).to be true + expect([true, false].sample).to be false end end From 6e17fbd2250641e2cdaa6da50cd3b98b568efd88 Mon Sep 17 00:00:00 2001 From: Naoki Fujita Date: Fri, 12 Sep 2025 03:04:58 +0900 Subject: [PATCH 13/15] fix --- .github/workflows/rails_basics_ci.yml | 2 +- rails/basics/spec/models/foo1_spec.rb | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rails_basics_ci.yml b/.github/workflows/rails_basics_ci.yml index 0bb11e5..162b109 100644 --- a/.github/workflows/rails_basics_ci.yml +++ b/.github/workflows/rails_basics_ci.yml @@ -103,7 +103,7 @@ jobs: include-hidden-files: true if-no-files-found: ignore - all-test-is-passed: + all-test-are-passed: runs-on: ubuntu-latest needs: [test] if: always() diff --git a/rails/basics/spec/models/foo1_spec.rb b/rails/basics/spec/models/foo1_spec.rb index 63b660d..536c9e4 100644 --- a/rails/basics/spec/models/foo1_spec.rb +++ b/rails/basics/spec/models/foo1_spec.rb @@ -3,7 +3,6 @@ RSpec.describe 'foo1' do it do sleep(1) - expect([true, false].sample).to be true - expect([true, false].sample).to be false + expect(0+1).to eq 1 end end From fa23f8c773d86e6f5a5b0f2587ebb71749f77ace Mon Sep 17 00:00:00 2001 From: Naoki Fujita Date: Fri, 12 Sep 2025 03:06:32 +0900 Subject: [PATCH 14/15] =?UTF-8?q?fix;=20push=E3=81=A8synchronze=E3=81=A7?= =?UTF-8?q?=E8=A2=AB=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rails_basics_ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/rails_basics_ci.yml b/.github/workflows/rails_basics_ci.yml index 162b109..211e459 100644 --- a/.github/workflows/rails_basics_ci.yml +++ b/.github/workflows/rails_basics_ci.yml @@ -1,8 +1,5 @@ name: rails_basic_ci on: - push: - paths-ignore: - - '.github/**/*' pull_request: types: [opened, synchronize] workflow_dispatch: From e33645d7ba1ffd915aa1f0555b04c419c9bcbab9 Mon Sep 17 00:00:00 2001 From: Naoki Fujita Date: Fri, 12 Sep 2025 03:08:56 +0900 Subject: [PATCH 15/15] feat --- .github/workflows/reusable-dummy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-dummy.yml b/.github/workflows/reusable-dummy.yml index 75b522a..bf77963 100644 --- a/.github/workflows/reusable-dummy.yml +++ b/.github/workflows/reusable-dummy.yml @@ -15,7 +15,7 @@ jobs: steps: - run: | echo hello branch ${{ inputs.message }}; - all-test-is-passed: + all-test-are-passed: runs-on: ubuntu-latest needs: [dummy-in-reusable] if: always()