CI #1296
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 | |
build: | |
needs: activate | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
ruby: [jruby-9.4.2.0, '2.5', '2.7', '3.0', '3.2'] | |
asciimath-version: [~] | |
haml-version: [~] | |
pygments-version: ['~> 2.3.0'] | |
rouge-version: [~] | |
exclude: | |
# remove 3.2 on ubuntu-latest to mark as primary | |
- os: ubuntu-latest | |
ruby: '3.2' | |
include: | |
- os: ubuntu-latest | |
ruby: truffleruby-22.2.0 | |
- os: ubuntu-latest | |
ruby: jruby-9.2.21.0 | |
pygments-version: ~ | |
- os: windows-latest | |
ruby: jruby-9.2.21.0 | |
pygments-version: ~ | |
- os: macos-latest | |
ruby: '3.2' | |
- os: ubuntu-latest | |
ruby: '2.5' | |
asciimath-version: '~> 1.0.0' | |
- os: ubuntu-latest | |
ruby: '2.5' | |
haml-version: '~> 5.2.0' | |
- os: ubuntu-latest | |
ruby: '2.5' | |
pygments-version: '~> 1.2.0' | |
- os: ubuntu-latest | |
ruby: '2.5' | |
rouge-version: '~> 2.0.0' | |
- os: ubuntu-latest | |
ruby: '3.2' | |
primary: primary | |
runs-on: ${{ matrix.os }} | |
env: | |
BUNDLE_WITHOUT: coverage:docs:lint | |
SOURCE_DATE_EPOCH: '1521504000' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set AsciiMath version | |
if: matrix.asciimath-version | |
run: echo 'ASCIIMATH_VERSION=${{ matrix.asciimath-version }}' >> $GITHUB_ENV | |
- name: Set Pygments version | |
if: matrix.pygments-version | |
run: echo 'PYGMENTS_VERSION=${{ matrix.pygments-version }}' >> $GITHUB_ENV | |
- name: Install prerequisites for Pygments ~> 1.2.0 (Linux) | |
if: matrix.os == 'ubuntu-latest' && matrix.pygments-version == '~> 1.2.0' | |
run: sudo apt-get install python2 | |
- name: Set Rouge version | |
if: matrix.rouge-version | |
run: echo 'ROUGE_VERSION=${{ matrix.rouge-version }}' >> $GITHUB_ENV | |
- name: Enable lint and coverage (primary only) | |
if: matrix.primary | |
run: | | |
echo 'BUNDLE_WITHOUT=docs' >> $GITHUB_ENV | |
echo 'COVERAGE=true' >> $GITHUB_ENV | |
- name: Upgrade Java (JRuby for Windows) | |
if: matrix.os == 'windows-latest' | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: '17' | |
- name: Install Ruby (uses cached dependencies for non-scheduled build) | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
bundler: ${{ matrix.os == 'windows-latest' && '2.3.22' || 'default' }} | |
bundler-cache: ${{ github.event_name != 'schedule' }} | |
- name: Install dependencies (scheduled build only) | |
if: github.event_name == 'schedule' | |
run: | | |
bundle config --local path vendor/bundle | |
bundle --jobs 3 --retry 3 | |
- name: Run linter | |
if: matrix.primary | |
run: bundle exec rake lint | |
- name: Check default stylesheet | |
if: matrix.primary | |
run: | | |
cd src/stylesheets | |
npm i --silent --no-audit --no-fund --no-package-lock --no-progress | |
npm run lint | |
npm run build | |
cd - | |
if [ -n "$(git diff --name-only -- data/stylesheets)" ]; then | |
echo 'Detected the following uncommitted changes to the default stylesheet:' | |
git --no-pager diff | |
exit 1 | |
fi | |
- name: Run tests | |
run: bundle exec ruby -w $(bundle exec ruby -e 'print File.join Gem.bindir, %q(rake)') test:all | |
build-dependents: | |
name: build:dependents | |
if: success() && github.event_name == 'push' && github.repository == 'asciidoctor/asciidoctor' | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
BUNDLE_WITHOUT: docs:lint:coverage | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.2' | |
bundler-cache: true | |
- name: Build dependents | |
env: | |
GITHUB_API_TOKEN: ${{ secrets._GITHUB_API_TOKEN }} | |
run: bundle exec rake build:dependents |