diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57a299f7a5..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: @@ -56,15 +48,26 @@ 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: 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 $(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 }}]' 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