name: rake on: push: branches: [ master, main ] pull_request: jobs: rake: name: test on ruby-${{ matrix.ruby }} ${{ matrix.os }} runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.experimental }} strategy: fail-fast: false matrix: ruby: [ '3.1', '3.0', '2.7' ] os: [ ubuntu-latest, windows-latest, macos-latest ] experimental: [ false ] include: - ruby: 'head' os: 'ubuntu-latest' experimental: true - ruby: 'head' os: 'windows-latest' experimental: true - ruby: 'head' os: 'macos-latest' experimental: true steps: - name: Checkout uses: actions/checkout@v2 with: submodules: recursive - name: Setup packages if: startsWith(matrix.os, 'macos') run: brew install autoconf automake libtool - name: Install Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - name: Process cache uses: actions/cache@v2 id: cache with: path: lib/expressir/express/express_parser.* key: v4-${{ runner.os }}-${{ matrix.ruby }}-${{ hashFiles('ext/express-parser/extconf.rb', 'ext/express-parser/antlrgen/**', 'ext/express-parser/express_parser.cpp', '.git/modules/ext/express-parser/antlr4-upstream/HEAD') }} - name: Build native extension if: steps.cache.outputs.cache-hit != 'true' run: bundle exec rake compile - name: Run tests run: bundle exec rake # test release workflow pack: runs-on: ubuntu-latest strategy: fail-fast: false matrix: host: [ linux, windows, darwin ] steps: - name: Checkout uses: actions/checkout@v2 with: submodules: recursive - name: Setup Ruby uses: ruby/setup-ruby@v1 with: ruby-version: '3.0' # bundler-cache: true important to not use cache because it leads to "cannot find -lrice" # more info https://github.com/lutaml/expressir/runs/2097658383?check_suite_focus=true#step:7:2126 - name: Bundle run: bundle install --jobs 4 --retry 3 - name: Build gem without native extension if: matrix.host == 'linux' run: gem build expressir.gemspec - name: Package gem without native extension if: matrix.host == 'linux' uses: actions/upload-artifact@v2 with: name: pkg-ruby path: expressir-*.gem - name: Enable swap run: | sudo fallocate -l 15g /compile.swap sudo chmod 600 /compile.swap sudo mkswap /compile.swap sudo swapon /compile.swap sudo swapon --all --verbose - name: Build gem with native extension run: bundle exec rake gem:${{ matrix.host }} - name: Package gem with native extension uses: actions/upload-artifact@v2 with: name: pkg-${{ matrix.host }} path: pkg/*.gem