summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: ebbfee7aed06b2563511edfa5626b673e865a121 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: CI
on:
  push:
    branches:
    - '*'
    tags-ignore:
    - '*'
  pull_request:
  schedule:
  - cron: '0 2 * * *'
jobs:
  activate:
    runs-on: ubuntu-latest
    if: "!endsWith(github.event.head_commit.message, '[skip ci]')"
    steps:
    - name: Proceed
      run: echo ok go
  build:
    needs: activate
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest]
        ruby: ['2.3', '2.4', '2.5', '2.6', '2.7']
        rouge-version: [~]
        exclude:
        - os: ubuntu-latest
          ruby: '2.7'
        include:
        - os: ubuntu-latest
          ruby: truffleruby-20.2.0
        - os: ubuntu-latest
          ruby: jruby-9.1.17.0
        - os: ubuntu-latest
          ruby: jruby-9.2.13.0
        - os: macos-latest
          ruby: '2.7'
        - os: ubuntu-latest
          ruby: '2.3'
          rouge-version: '~> 2.0.0'
        - os: ubuntu-latest
          ruby: '2.7'
          primary: true
    runs-on: ${{ matrix.os }}
    env:
      COVERAGE: ${{ matrix.primary }}
      JRUBY_OPTS: '-J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -Xcompile.invokedynamic=false'
      PYGMENTS_VERSION: '~> 1.2.0'
      SOURCE_DATE_EPOCH: '1521504000'
    steps:
    - name: Checkout
      uses: actions/checkout@v2
      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 docs
    - name: Set Rouge version
      if: matrix.rouge-version
      run: echo 'ROUGE_VERSION=${{ matrix.rouge-version }}' >> $GITHUB_ENV
    - name: Set JRUBY_OPTS
      if: matrix.jruby-opts
      run: echo 'JRUBY_OPTS=${{ matrix.jruby-opts }}' >> $GITHUB_ENV
    - name: Install Nokogiri build dependencies
      if: contains(matrix.ruby, 'truffleruby')
      run: sudo apt-get install libxslt1-dev
    - name: Install dependencies
      run: bundle --jobs 3 --retry 3
    - name: Run tests
      run: bundle exec ruby -w $(bundle exec ruby -e 'print File.join Gem.bindir, %q(rake)') test:all
    - name: Build dependents
      if: matrix.primary && github.event_name != 'schedule' && github.repository == 'asciidoctor/asciidoctor' && !github.base_ref
      env:
        GITHUB_API_TOKEN: ${{ secrets._GITHUB_API_TOKEN }}
        TRAVIS_API_TOKEN: ${{ secrets.TRAVIS_API_TOKEN }}
      run: bundle exec rake build:dependents