summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: b9e87d6212c30f9170c41ef539c35343e1c558b3 (plain)
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
name: CI
on: [push, pull_request]
permissions:
  contents: read

jobs:
  system-libffi:
    # Run on latest MRI with explicit selection of system or builtin libffi
    strategy:
      fail-fast: false
      matrix:
        os: [ ubuntu, macos, windows ]
        extconfopts: [ --disable-system-libffi, --enable-system-libffi ]
        extconfopts2: [ --disable-libffi-alloc, --enable-libffi-alloc ]
    runs-on: ${{ matrix.os }}-latest
    steps:
    - uses: actions/checkout@v2
    - uses: ruby/setup-ruby@v1
      with:
        ruby-version: 2.7

    - if: matrix.os == 'macos'
      run: brew install automake libffi pkg-config

    - if: matrix.os == 'windows' && matrix.extconfopts == '--enable-system-libffi'
      shell: cmd
      run: ridk exec sh -c "pacman --sync --refresh --needed --noconfirm  ${MINGW_PACKAGE_PREFIX}-libffi"

    - run: bundle install
    - run: bundle exec rake libffi
    - run: bundle exec rake compile -- ${{ matrix.extconfopts }} ${{ matrix.extconfopts2 }}
      env:
        # work around misconfiguration of libffi on MacOS with homebrew
        PKG_CONFIG_PATH: ${{ env.PKG_CONFIG_PATH }}:/usr/local/opt/libffi/lib/pkgconfig
    - run: bundle exec rake test
    - run: bundle exec rake types_conf && git --no-pager diff

  specs:
    # Run all specs on all ruby implementations
    # Use automatic libffi selection on MRI
    strategy:
      fail-fast: false
      matrix:
        os: [ ubuntu, macos, windows ]
        ruby: [ 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, ruby-head, truffleruby-head, jruby-head ]
        exclude:
        - os: windows
          ruby: truffleruby-head
    runs-on: ${{ matrix.os }}-latest
    steps:
    - uses: actions/checkout@v2
    - uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby }}

    - run: brew install automake
      if: matrix.os == 'macos'

    - run: bundle install
    - run: bundle exec rake libffi
    - run: bundle exec rake compile

    - run: bundle exec rake test

    - run: bundle exec rake bench:all
      if: ${{ matrix.ruby != 'truffleruby-head' && matrix.ruby != 'jruby-head' }}
      env:
        ITER: 10