From 7ca96c1b9128c3289f2c7391fb804d7d6cd44576 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 15 Jul 2023 21:56:44 -0700 Subject: [PATCH] Add round-trip tests for precompiled gems Closes #69 --- .github/workflows/precompiled.yml | 343 ++++++++++++++++++++++++++++++ 1 file changed, 343 insertions(+) create mode 100644 .github/workflows/precompiled.yml diff --git a/.github/workflows/precompiled.yml b/.github/workflows/precompiled.yml new file mode 100644 index 0000000..090a740 --- /dev/null +++ b/.github/workflows/precompiled.yml @@ -0,0 +1,343 @@ +name: precompiled +concurrency: + group: "${{github.workflow}}-${{github.ref}}" + cancel-in-progress: true +on: + workflow_dispatch: + schedule: + - cron: "0 8 * * 3" # At 08:00 on Wednesday # https://crontab.guru/#0_8_*_*_3 + push: + branches: + - main + - v*.*.x + tags: + - v*.*.* + pull_request: + types: [opened, synchronize] + branches: + - '*' + +jobs: + precompiled: + strategy: + fail-fast: false + matrix: + runs-on: ["ubuntu-latest", "macos-latest"] + ruby: ["2.7", "3.0", "3.1", "3.2"] + include: + - ruby: "2.7" + runs-on: "windows-2019" + - ruby: "3.0" + runs-on: "windows-2019" + - ruby: "3.1" + runs-on: "windows-2022" + - ruby: "3.2" + runs-on: "windows-2022" + runs-on: ${{matrix.runs-on}} + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + working-directory: precompiled + ruby-version: ${{matrix.ruby}} + bundler-cache: true + - uses: actions/cache@v2 + with: + path: precompiled/ports + key: precompiled-ports-${{matrix.runs-on}}-${{hashFiles('precompiled/ext/precompiled/extconf.rb')}} + - run: bundle exec rake compile test + working-directory: precompiled + + cruby-package: + runs-on: "ubuntu-latest" + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: precompiled/ports/archives + key: archives-ubuntu-${{hashFiles('ext/re2/extconf.rb')}} + - uses: ruby/setup-ruby@v1 + with: + working-directory: precompiled + ruby-version: "3.2" + bundler-cache: true + - run: ./bin/test-gem-build gems ruby + working-directory: precompiled + - uses: actions/upload-artifact@v2 + with: + name: cruby-gem + path: precompiled/gems + retention-days: 1 + + cruby-linux-install: + needs: ["cruby-package"] + strategy: + fail-fast: false + matrix: + ruby: ["2.7", "3.0", "3.1", "3.2"] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + working-directory: precompiled + ruby-version: "${{matrix.ruby}}" + - uses: actions/download-artifact@v2 + with: + name: cruby-gem + path: precompiled/gems + - run: ./bin/test-gem-install gems + working-directory: precompiled + + cruby-osx-install: + needs: ["cruby-package"] + strategy: + fail-fast: false + matrix: + ruby: ["3.2"] + sys: ["enable", "disable"] + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + working-directory: precompiled + ruby-version: "${{matrix.ruby}}" + - uses: actions/download-artifact@v2 + with: + name: cruby-gem + path: precompiled/gems + - run: ./bin/test-gem-install gems + working-directory: precompiled + + cruby-windows-install: + needs: ["cruby-package"] + strategy: + fail-fast: false + matrix: + ruby: ["3.0"] + sys: ["enable", "disable"] + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + working-directory: precompiled + ruby-version: "3.0" + - uses: actions/download-artifact@v2 + with: + name: cruby-gem + path: precompiled/gems + - run: | + gem install --verbose --no-document gems/*.gem + gem list -d rcee_precompiled + ruby -r rcee/precompiled -e 'puts ::RCEE::Precompiled::Extension.do_something' + working-directory: precompiled + + cruby-windows-install-ucrt: + needs: ["cruby-package"] + strategy: + fail-fast: false + matrix: + ruby: ["3.2"] + sys: ["enable", "disable"] + runs-on: windows-2022 + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + working-directory: precompiled + ruby-version: "3.0" + - uses: actions/download-artifact@v2 + with: + name: cruby-gem + path: precompiled/gems + - run: | + gem install --verbose --no-document gems/*.gem + gem list -d rcee_precompiled + ruby -r rcee/precompiled -e 'puts ::RCEE::Precompiled::Extension.do_something' + working-directory: precompiled + + cruby-native-package: + strategy: + fail-fast: false + matrix: + plat: + - "aarch64-linux" + - "arm-linux" + # - "arm64-darwin" # omitted until github actions supports it + - "x64-mingw-ucrt" + - "x64-mingw32" + - "x86-linux" + - "x86_64-darwin" + - "x86_64-linux" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: precompiled/ports/archives + key: archives-ubuntu-${{hashFiles('ext/re2/extconf.rb')}} + - run: | + docker run --rm -v "$(pwd):/re2" -w /re2 \ + larskanis/rake-compiler-dock-mri-${{matrix.plat}}:1.2.0 \ + ./bin/test-gem-build gems ${{matrix.plat}} + - uses: actions/upload-artifact@v2 + with: + name: "cruby-${{matrix.plat}}-gem" + path: precompiled/gems + retention-days: 1 + + cruby-x86_64-linux-install: + needs: ["cruby-native-package"] + strategy: + fail-fast: false + matrix: + ruby: ["2.7", "3.0", "3.1", "3.2"] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "${{matrix.ruby}}" + - uses: actions/download-artifact@v2 + with: + name: cruby-x86_64-linux-gem + path: precompiled/gems + - run: ./bin/test-gem-install gems + + cruby-x86-linux-install: + needs: ["cruby-native-package"] + strategy: + fail-fast: false + matrix: + ruby: ["2.7", "3.0", "3.1", "3.2"] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/download-artifact@v2 + with: + name: cruby-x86-linux-gem + path: precompiled/gems + - run: | + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + docker run --rm -v "$(pwd):/re2" -w /re2 \ + --platform=linux/386 \ + ruby:${{matrix.ruby}} \ + ./bin/test-gem-install ./gems + + cruby-aarch64-linux-install: + needs: ["cruby-native-package"] + strategy: + fail-fast: false + matrix: + ruby: ["2.7", "3.0", "3.1", "3.2"] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/download-artifact@v2 + with: + name: cruby-aarch64-linux-gem + path: precompiled/gems + - run: | + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + docker run --rm -v "$(pwd):/re2" -w /re2 \ + --platform=linux/arm64/v8 \ + ruby:${{matrix.ruby}} \ + ./bin/test-gem-install ./gems + + cruby-arm-linux-install: + needs: ["cruby-native-package"] + strategy: + fail-fast: false + matrix: + ruby: ["2.7", "3.0", "3.1", "3.2"] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/download-artifact@v2 + with: + name: cruby-arm-linux-gem + path: precompiled/gems + - run: | + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + docker run --rm -v "$(pwd):/re2" -w /re2 \ + --platform=linux/arm/v7 \ + ruby:${{matrix.ruby}} \ + ./bin/test-gem-install ./gems + + cruby-x86_64-musl-install: + needs: ["cruby-native-package"] + strategy: + fail-fast: false + matrix: + ruby: ["2.7", "3.0", "3.1", "3.2"] + runs-on: ubuntu-latest + container: + image: "ruby:${{matrix.ruby}}-alpine" + steps: + - uses: actions/checkout@v2 + - uses: actions/download-artifact@v2 + with: + name: cruby-x86_64-linux-gem + path: precompiled/gems + - run: apk add bash + - run: ./bin/test-gem-install gems + + cruby-x86_64-darwin-install: + needs: ["cruby-native-package"] + strategy: + fail-fast: false + matrix: + ruby: ["2.7", "3.0", "3.1", "3.2"] + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "${{matrix.ruby}}" + - uses: actions/download-artifact@v2 + with: + name: cruby-x86_64-darwin-gem + path: precompiled/gems + - run: ./bin/test-gem-install gems + +## arm64-darwin installation testing is omitted until github actions supports it +# cruby-arm64-darwin-install: +# ... + + cruby-x64-mingw32-install: + needs: ["cruby-native-package"] + strategy: + fail-fast: false + matrix: + ruby: ["2.7", "3.0", "3.1", "3.2"] + runs-on: windows-2019 + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "${{matrix.ruby}}" + - uses: actions/download-artifact@v2 + with: + name: cruby-x64-mingw32-gem + path: precompiled/gems + - run: ./bin/test-gem-install gems + + cruby-x64-mingw-ucrt-install: + needs: ["cruby-native-package"] + strategy: + fail-fast: false + matrix: + ruby: ["3.2"] + runs-on: windows-2022 + steps: + - uses: actions/checkout@v2 + - uses: MSP-Greg/setup-ruby-pkgs@v1 + with: + ruby-version: "${{matrix.ruby}}" + - uses: actions/download-artifact@v2 + with: + name: cruby-x64-mingw-ucrt-gem + path: precompiled/gems + - run: ./bin/test-gem-install gems