diff --git a/.github/workflows/gem.yml b/.github/workflows/gem.yml new file mode 100644 index 0000000..30aed6a --- /dev/null +++ b/.github/workflows/gem.yml @@ -0,0 +1,133 @@ +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: + - name: Checkout code + uses: actions/checkout@v4 + + # https://bundler.io/blog/2018/01/17/making-gem-development-a-little-better.html + - name: Remove bundler lockfile + run: rm Gemfile.lock + + - name: Install Ruby and gems + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.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.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 rodiff executable'" + + linux-install: + needs: [package] + runs-on: ubuntu-latest + steps: + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.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.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.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.3 + - uses: actions/download-artifact@v4 + with: + name: gem-x64-mingw-ucrt + path: pkg + - run: "gem install pkg/rodiff-*.gem" + - run: "rodiff --help" \ No newline at end of file