CI #642
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: | |
branches: [main] | |
paths-ignore: ['*.adoc', 'docs/**'] | |
schedule: | |
- cron: '0 3 * * MON' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
activate: | |
if: | | |
(github.event_name == 'schedule' && github.repository_owner == 'asciidoctor') || | |
(github.event_name == 'push') || | |
(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.3, '2.3', '2.7', '3.1'] | |
exclude: | |
# remove 3.1 on ubuntu-latest to mark as primary | |
- os: ubuntu-latest | |
ruby: '3.1' | |
include: | |
- os: ubuntu-latest | |
ruby: jruby-9.2 | |
- os: ubuntu-latest | |
ruby: truffleruby | |
- os: macos-latest | |
ruby: '3.1' | |
- os: ubuntu-latest | |
ruby: '3.1' | |
primary: primary | |
runs-on: ${{ matrix.os }} | |
env: | |
BUNDLE_WITHOUT: coverage:docs:lint | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Enable lint and coverage (primary only) | |
if: matrix.primary | |
run: | | |
echo 'BUNDLE_WITHOUT=' >> $GITHUB_ENV | |
echo 'COVERAGE=deep' >> $GITHUB_ENV | |
- name: Install Ruby (uses cached dependencies for non-scheduled build) | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
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: Run tests | |
run: bundle exec ruby -w $(bundle exec ruby -e 'print File.join Gem.bindir, %q(rake)') spec |