From eec49aaafadffe58f70a4ec1e4c1e37db3e8a43f Mon Sep 17 00:00:00 2001 From: toshimaru Date: Sun, 24 Nov 2024 11:32:07 +0900 Subject: [PATCH 1/4] feat: Accept argument for `build_multi` task Sample command: ``` rake 'build_multi[7.0,7.1]' ``` --- Rakefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Rakefile b/Rakefile index 03586ad7b9..bd5d6f60f4 100644 --- a/Rakefile +++ b/Rakefile @@ -21,9 +21,13 @@ task :switch_default_rails do end desc 'Generate and build documentation for older versions of Rails' -task :build_multi do - # WORKAROUND: use `reverse_each` instead of `each` to avoid nokogiri installation error - config['rails_versions'].reverse_each do |version, detail| +task :build_multi, [:versions] do |_t, args| + rails_versions = config['rails_versions'].reverse_each.to_h # Versions from oldest to newest + unless args[:versions].nil? + versions = args[:versions].split(',') + rails_versions.select! { |version, _| versions.include?(version) } + end + rails_versions.each do |version, detail| if detail['latest'] puts "=== Skip Rails v#{version} because it's latest version ===" next @@ -39,7 +43,7 @@ task :build_multi do generate_rails_rdoc generate_src(target_version: version) end - puts + puts "=== Build Jekyll site ===" sh 'bundle exec jekyll build' end From 1fe00a45bb371c6ba218fb720aa7d3ebff1f5830 Mon Sep 17 00:00:00 2001 From: toshimaru Date: Sun, 24 Nov 2024 12:31:26 +0900 Subject: [PATCH 2/4] refactor: Fetch rails tags inside the loop --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57a299f7a5..29897a77f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,11 @@ jobs: with: submodules: true - name: fetch Rails tags - run: cd rails && git fetch --depth=1 origin refs/tags/v7*:refs/tags/v7* refs/tags/v6*:refs/tags/v6* refs/tags/v5*:refs/tags/v5* + working-directory: rails + run: | + for version in v7 v6 v5.2; do + git fetch --depth=1 origin refs/tags/${version}*:refs/tags/${version}* + done - uses: ruby/setup-ruby@v1 with: ruby-version: 2.7 From c728139e5bcc2c1da786e70e6032f8549188971a Mon Sep 17 00:00:00 2001 From: toshimaru Date: Sun, 24 Nov 2024 12:31:38 +0900 Subject: [PATCH 3/4] cI: Build build_multi matrix - refactor: Loop versions in bash script --- .github/workflows/ci.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29897a77f1..112b14edc2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,6 +56,13 @@ jobs: doc-build-others: runs-on: ubuntu-latest name: Rails Doc Build (older versions) + strategy: + matrix: + include: + - ruby-version: 2.7 + build-rails-versions: "5.2,6.0,6.1" + - ruby-version: 3.3 + build-rails-versions: "7.0,7.1,7.2" steps: - uses: actions/checkout@v4 with: @@ -63,12 +70,12 @@ jobs: - name: fetch Rails tags working-directory: rails run: | - for version in v7 v6 v5.2; do - git fetch --depth=1 origin refs/tags/${version}*:refs/tags/${version}* + for version in $(echo "${{ matrix.build-rails-versions }}" | tr ',' ' '); do + git fetch --depth=1 origin refs/tags/v${version}*:refs/tags/v${version}* done - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 + ruby-version: ${{ matrix.ruby-version }} bundler-cache: true - name: Doc Build - run: rake build_multi + run: rake 'build_multi[${{ matrix.build-rails-versions }}]' From 1f4f780c9094e5b5a60ad971e9a543b33575c53e Mon Sep 17 00:00:00 2001 From: toshimaru Date: Sun, 24 Nov 2024 14:32:32 +0900 Subject: [PATCH 4/4] ci: Build YJIT enabled matrix - Remove `doc-build-latest-with-yjit` since it's covered by matrix - switch YJIT using `RUBY_YJIT_ENABLE` --- .github/workflows/ci.yml | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 112b14edc2..3985bf1d9b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,12 @@ on: jobs: jekyll-build: runs-on: ubuntu-latest - name: Jekyll Build + name: Jekyll Build (YJIT_ENABLED ${{ matrix.yjit-enabled }}) + strategy: + matrix: + yjit-enabled: [0, 1] + env: + RUBY_YJIT_ENABLE: ${{ matrix.yjit-enabled }} steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 @@ -21,25 +26,12 @@ jobs: doc-build-latest: runs-on: ubuntu-latest - name: Rails Doc Build (latest) - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - name: fetch Rails tags - run: cd rails && git fetch --depth=1 origin refs/tags/v7*:refs/tags/v7* - - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.3 - bundler-cache: true - - name: Doc Build - run: rake build - - doc-build-latest-with-yjit: - runs-on: ubuntu-latest - name: Rails Doc Build (latest, with YJIT enabled) + name: Rails Doc Build (latest, YJIT_ENABLED ${{ matrix.yjit-enabled }}) + strategy: + matrix: + yjit-enabled: [0, 1] env: - RUBY_YJIT_ENABLE: true + RUBY_YJIT_ENABLE: ${{ matrix.yjit-enabled }} steps: - uses: actions/checkout@v4 with: