CI #4197
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: ['**'] | |
paths-ignore: ['*.adoc', 'docs/**'] | |
pull_request: | |
paths-ignore: ['*.adoc', 'docs/**'] | |
schedule: | |
- cron: '0 2 * * *' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: read-all | |
jobs: | |
activate: | |
if: | | |
(github.event_name == 'schedule' && github.repository_owner == 'asciidoctor') || | |
github.event_name == 'push' || github.event_name == 'workflow_dispatch' || | |
(github.event_name == 'pull_request' && !startsWith(github.head_ref, 'docs/')) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Proceed | |
run: echo ok go | |
lint: | |
needs: activate | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.3' | |
- name: Configure Bundler | |
run: | | |
bundle config --local path .bundle/gems | |
bundle config --local without coverage docs | |
- name: Install dependencies | |
run: bundle --jobs 3 --retry 3 | |
- name: Run linter | |
run: bundle exec rake lint | |
build: | |
needs: lint | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
ruby: [jruby-9.2.21.0, jruby-9.4.2.0, '2.7', '3.3'] | |
asciidoctor-version: [~] | |
asciidoctor-diagram-version: ['~> 2.2'] | |
asciidoctor-kroki-version: [~] | |
rouge-version: [~] | |
upstream: [~] | |
exclude: | |
# remove 3.3 on ubuntu-latest to mark as primary | |
- os: ubuntu-latest | |
ruby: '3.3' | |
include: | |
# test oldest Ruby 3 to ensure compatibility across full range of Ruby 3 versions | |
- os: ubuntu-latest | |
ruby: '3.0' | |
- os: macos-12 | |
ruby: '3.3' | |
# test oldest permitted versions of dependencies | |
- os: ubuntu-latest | |
ruby: '2.7' | |
asciidoctor-version: '2.0.10' | |
rouge-version: '~> 2.0.0' | |
- os: windows-latest | |
ruby: '3.3' | |
asciidoctor-diagram-version: ~ | |
asciidoctor-kroki-version: '0.10.0' | |
# NOTE: enable once Asciidoctor 2.1.0 is released | |
#- os: ubuntu-latest | |
# ruby: '3.3' | |
# asciidoctor-version: '~> 2.0.0' | |
- os: ubuntu-latest | |
ruby: '3.3' | |
upstream: upstream | |
- os: ubuntu-latest | |
ruby: '3.3' | |
rouge-version: '~> 4.0.0' | |
primary: primary | |
runs-on: ${{ matrix.os }} | |
env: | |
PYGMENTS_VERSION: '~> 2.0' | |
RGHOST_VERSION: '0.9.7' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 5 | |
- name: Install Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
- name: Configure Bundler | |
run: | | |
bundle config --local path .bundle/gems | |
bundle config --local without coverage docs lint | |
- name: Enable coverage | |
if: matrix.primary | |
run: | | |
bundle config unset --local without | |
bundle config --local without docs lint | |
echo 'COVERAGE=deep' >> $GITHUB_ENV | |
- name: Install Ghostscript and Poppler (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install ghostscript poppler-utils | |
- name: Install Ghostscript and Poppler (macOS) | |
if: matrix.os == 'macos-12' | |
run: | | |
brew unlink ghostscript | |
# ghostscript 10.02.1 | |
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/0e594be417b7947dcf7d6eb63293fcf652b7e3ae/Formula/g/ghostscript.rb | |
brew install --formula ./ghostscript.rb | |
brew link ghostscript || true | |
brew install poppler | |
- name: Install Ghostscript and Poppler and set GS env var (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
choco install --no-progress poppler --version=0.89.0 | |
choco install --no-progress ghostscript --version=10.0.0.20230317 | |
echo "GS=$(& where.exe /R 'C:\Program Files\gs' gswin64c.exe)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Set Prawn Gmagick version / Install GraphicsMagick (Linux) | |
if: matrix.primary | |
run: | | |
echo 'PRAWN_GMAGICK_VERSION=0.0.9' >> $GITHUB_ENV | |
sudo apt-get install libgraphicsmagick1-dev | |
#- name: Set Prawn Gmagick version / Install GraphicsMagick (macOS) | |
# if: matrix.os == 'macos-12' | |
# run: | | |
# echo 'PRAWN_GMAGICK_VERSION=0.0.9' >> $GITHUB_ENV | |
# brew install GraphicsMagick | |
- name: Set ffi-icu version (Linux) | |
if: matrix.primary | |
run: | | |
echo 'FFI_ICU_VERSION=0.5.0' >> $GITHUB_ENV | |
- name: Set Asciidoctor version | |
if: matrix.asciidoctor-version | |
run: | | |
echo 'ASCIIDOCTOR_VERSION=${{ matrix.asciidoctor-version }}' >> $GITHUB_ENV | |
- name: Set Asciidoctor Diagram version | |
if: matrix.asciidoctor-diagram-version | |
run: | | |
echo 'ASCIIDOCTOR_DIAGRAM_VERSION=${{ matrix.asciidoctor-diagram-version }}' >> $GITHUB_ENV | |
- name: Set Asciidoctor Kroki version | |
if: matrix.asciidoctor-kroki-version | |
run: | | |
echo 'ASCIIDOCTOR_KROKI_VERSION=${{ matrix.asciidoctor-kroki-version }}' >> $GITHUB_ENV | |
- name: Set Rouge version | |
if: matrix.rouge-version | |
run: echo 'ROUGE_VERSION=${{ matrix.rouge-version }}' >> $GITHUB_ENV | |
- name: Install dependencies | |
run: bundle --jobs 3 --retry 3 | |
- name: Switch to upstream dependencies | |
if: matrix.upstream | |
run: | | |
bundle exec ruby scripts/switch-to-asciidoctor-head.rb | |
#bundle exec ruby scripts/switch-to-prawn-head.rb | |
rm -f Gemfile.lock | |
bundle config --local clean true | |
bundle --jobs 3 --retry 3 | |
- name: Run tests | |
run: bundle exec ruby -w $(bundle exec ruby -e 'print File.join Gem.bindir, %q(rake)') spec |