|
| 1 | +name: Build Native Extensions |
| 2 | + |
| 3 | +on: # build when publishing a release |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build-binaries: |
| 9 | + strategy: |
| 10 | + fail-fast: true |
| 11 | + matrix: |
| 12 | + ruby: |
| 13 | + - 2.7.6 |
| 14 | + - 3.0.4 |
| 15 | + - 3.1.2 |
| 16 | + os_arch: |
| 17 | + - ubuntu-x86 |
| 18 | + - ubuntu-arm |
| 19 | + - macos-x86 |
| 20 | + - macos-arm |
| 21 | + include: |
| 22 | + - os_arch: ubuntu-x86 |
| 23 | + os: ubuntu-18.04 |
| 24 | + target: x86_64-unknown-linux-gnu |
| 25 | + - os_arch: ubuntu-arm |
| 26 | + os: ubuntu-18.04 |
| 27 | + target: aarch64-unknown-linux-gnu |
| 28 | + rustflags: '-C linker=aarch64-linux-gnu-gcc' |
| 29 | + - os_arch: macos-x86 |
| 30 | + os: macos-latest |
| 31 | + target: x86_64-apple-darwin |
| 32 | + - os_arch: macos-arm |
| 33 | + os: macos-latest |
| 34 | + target: aarch64-apple-darwin |
| 35 | + |
| 36 | + runs-on: ${{ matrix.os }} |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v2 |
| 39 | + with: |
| 40 | + submodules: recursive |
| 41 | + |
| 42 | + - uses: actions-rs/toolchain@v1 |
| 43 | + with: |
| 44 | + toolchain: stable |
| 45 | + |
| 46 | + - uses: arduino/setup-protoc@v1 |
| 47 | + with: |
| 48 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + |
| 50 | + - uses: ruby/setup-ruby@v1 |
| 51 | + with: |
| 52 | + ruby-version: ${{ matrix.ruby }} |
| 53 | + bundler-cache: true |
| 54 | + |
| 55 | + - name: Add ${{ matrix.target }} rust target |
| 56 | + run: rustup target add ${{ matrix.target }} |
| 57 | + |
| 58 | + - if: ${{ matrix.os == 'ubuntu-18.04' }} |
| 59 | + name: Print libc version |
| 60 | + run: ldd --version |
| 61 | + |
| 62 | + - if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} |
| 63 | + name: Install gcc-aarch64-linux-gnu |
| 64 | + run: sudo apt update && sudo apt install -y gcc-aarch64-linux-gnu |
| 65 | + |
| 66 | + - uses: Swatinem/rust-cache@v2 |
| 67 | + with: |
| 68 | + workspaces: bridge |
| 69 | + key: ${{ matrix.os }}-${{ matrix.ruby }}-${{ matrix.target }} |
| 70 | + |
| 71 | + - name: Install ruby gems |
| 72 | + run: bundle install --jobs 4 |
| 73 | + |
| 74 | + - name: Compile native extension |
| 75 | + id: package |
| 76 | + run: | |
| 77 | + bundle exec rake thermite:tarball |
| 78 | + echo "tarball=$(echo bridge-*.tar.gz)" >> $GITHUB_OUTPUT |
| 79 | +
|
| 80 | + - name: Upload artifacts |
| 81 | + uses: actions/upload-release-asset@v1 |
| 82 | + env: |
| 83 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 84 | + with: |
| 85 | + upload_url: ${{ github.event.release.upload_url }} |
| 86 | + asset_path: ${{ steps.package.outputs.tarball }} |
| 87 | + asset_name: ${{ steps.package.outputs.tarball }} |
| 88 | + asset_content_type: application/x-gzip |
0 commit comments