ryancyq/rodiff

View on GitHub
.github/workflows/gem.yml

Summary

Maintainability
Test Coverage
name: Gem Installation
concurrency:
  group: "${{ github.workflow }}-${{ github.ref }}"
  cancel-in-progress: true
on:
  workflow_dispatch:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  package:
    name: "Package for ${{ matrix.platform }}"
    strategy:
      fail-fast: false
      matrix:
        platform:
          - arm64-darwin
          - ruby
          - x64-mingw-ucrt
          - x64-mingw32
          - x86_64-darwin
          - x86_64-linux
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

        # https://bundler.io/blog/2018/01/17/making-gem-development-a-little-better.html
      - run: rm Gemfile.lock

      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: "3"
          bundler: latest
          bundler-cache: true

      - run: "bundle exec rake gem:${{ matrix.platform }}"

      - uses: actions/upload-artifact@v4
        with:
          name: "gem-${{matrix.platform}}"
          path: pkg
          retention-days: 1

  vanilla-install:
    needs: [package]
    runs-on: ubuntu-latest
    steps:
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: "3"
      - uses: actions/download-artifact@v4
        with:
          name: gem-ruby
          path: pkg
      - run: "gem install pkg/rodiff-*.gem"
      - run: "rodiff 2>&1 | fgrep 'ERROR: Cannot find the odiff executable'"

  linux-install:
    needs: [package]
    runs-on: ubuntu-latest
    steps:
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: "3"
      - uses: actions/download-artifact@v4
        with:
          name: gem-x86_64-linux
          path: pkg
      - run: "gem install pkg/rodiff-*.gem"
      - run: "rodiff --help"

  darwin-x86_64-install:
    needs: [package]
    runs-on: macos-13
    steps:
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: "3"
      - uses: actions/download-artifact@v4
        with:
          name: gem-x86_64-darwin
          path: pkg
      - run: "gem install pkg/rodiff-*.gem"
      - run: "rodiff --help"

  darwin-arm64-install:
    needs: [package]
    runs-on: macos-14
    steps:
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: "3"
      - uses: actions/download-artifact@v4
        with:
          name: gem-arm64-darwin
          path: pkg
      - run: "gem install pkg/rodiff-*.gem"
      - run: "rodiff --help"

  windows-install:
    needs: [package]
    runs-on: windows-latest
    steps:
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: "3.0"
      - uses: actions/download-artifact@v4
        with:
          name: gem-x64-mingw32
          path: pkg
      - run: "gem install pkg/rodiff-*.gem"
      - run: "rodiff --help"

  windows-ucrt-install:
    needs: [package]
    runs-on: windows-latest
    steps:
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: "3"
      - uses: actions/download-artifact@v4
        with:
          name: gem-x64-mingw-ucrt
          path: pkg
      - run: "gem install pkg/rodiff-*.gem"
      - run: "rodiff --help"