ruby-llvm/ruby-llvm

View on GitHub
.github/workflows/testing.yml

Summary

Maintainability
Test Coverage
name: Matrix Testing

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-22.04, macos-12, macos-13]
        ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
    continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
    steps:
      - name: Install LLVM on macos
        if: startsWith(matrix.os, 'macos')
        run: |
          brew update --auto-update
          brew install llvm@18
          echo "$(brew --prefix llvm@18)/bin" >> $GITHUB_PATH
          sudo mkdir -p /opt/local/
          sudo ln -s $(brew --prefix llvm@18)/lib /opt/local/lib
          # ffi will only look for files in a small set of directories, so llvm needs to be there
          # https://github.com/ffi/ffi/blob/master/lib/ffi/dynamic_library.rb#L33
          # /usr/lib /usr/local/lib /opt/local/lib /opt/homebrew/lib
          # this uses /opt/local/lib -> /usr/local/opt/llvm/lib
        env:
          HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
      - name: 'MacOS debug'
        if: startsWith(matrix.os, 'macos')
        run: |
          echo $(brew --repository)
          echo $(brew --prefix llvm@18)
          echo $(brew info llvm@18)
          echo "$PATH"
          echo $(llvm-config --ldflags)
          ls -l /usr/local/Cellar/llvm@*/*/lib/libLLVM.dylib
          ls -l $(brew --prefix llvm@18)/lib/libLLVM.dylib
          ls -l /opt/local/lib/libLLVM.dylib
      - name: Install LLVM on ubuntu
        if: startsWith(matrix.os, 'ubuntu')
        run: |
          wget https://apt.llvm.org/llvm.sh
          chmod +x llvm.sh
          sudo ./llvm.sh 18
      - name: 'Ubuntu debug'
        if: startsWith(matrix.os, 'ubuntu')
        run: |
          clang --version
          which clang
          ls -alF /usr/lib/llvm-*/include/
          dpkg -l | egrep 'c\+\+|g\+\+|gcc|llvm|build-essential'
          ls -alF /usr/include/c++/11/cstddef
          ls -alF /usr/lib/llvm-*/include/
      - uses: actions/checkout@v3
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
      - run: bundle install
      - run: cd ext/ruby-llvm-support && bundle exec rake
        name: "Build support library"
      - run: bundle exec rake
        name: "Run tests"
      - run: bundle exec rake test:samples
        name: "Run samples"