|
| 1 | +name: Ruby Package |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - 'pyroscope_ffi/ruby/**' |
| 7 | + - '.github/workflows/ruby.yml' |
| 8 | + pull_request: |
| 9 | + paths: |
| 10 | + - 'pyroscope_ffi/ruby/**' |
| 11 | + - '.github/workflows/ruby.yml' |
| 12 | + |
| 13 | +jobs: |
| 14 | + linux: |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + build-arch: |
| 19 | + - x86_64 |
| 20 | + - aarch64 |
| 21 | + |
| 22 | + name: Linux - ${{ matrix.build-arch }} |
| 23 | + runs-on: ubuntu-latest |
| 24 | + |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v2 |
| 27 | + |
| 28 | + - if: matrix.build-arch == 'aarch64' |
| 29 | + uses: docker/setup-qemu-action@v1 |
| 30 | + with: |
| 31 | + platforms: arm64 |
| 32 | + |
| 33 | + - uses: ruby/setup-ruby@v1 |
| 34 | + with: |
| 35 | + ruby-version: '3.1' |
| 36 | + |
| 37 | + - name: Install bundles |
| 38 | + run: bundle |
| 39 | + working-directory: pyroscope_ffi/ruby |
| 40 | + |
| 41 | + - name: Build native extensions |
| 42 | + run: rake rbspy_install |
| 43 | + working-directory: pyroscope_ffi/ruby |
| 44 | + |
| 45 | + - name: Build native extensions |
| 46 | + run: rake thread_id_install |
| 47 | + working-directory: pyroscope_ffi/ruby |
| 48 | + |
| 49 | + - if: matrix.build-arch == 'x86_64' |
| 50 | + name: Build linux gem |
| 51 | + run: rake x86_64_linux:gem |
| 52 | + working-directory: pyroscope_ffi/ruby |
| 53 | + |
| 54 | + - if: matrix.build-arch == 'aarch64' |
| 55 | + name: Build linux gem |
| 56 | + run: rake aarch64_linux:gem |
| 57 | + working-directory: pyroscope_ffi/ruby |
| 58 | + |
| 59 | + - uses: actions/upload-artifact@v2 |
| 60 | + with: |
| 61 | + name: ${{ github.sha }} |
| 62 | + path: pyroscope_ffi/ruby/pkg/*.gem |
| 63 | + |
| 64 | + macos: |
| 65 | + strategy: |
| 66 | + fail-fast: false |
| 67 | + matrix: |
| 68 | + include: |
| 69 | + - macos-version: "10.15" |
| 70 | + target: x86_64-apple-darwin |
| 71 | + py-platform: macosx-10_15_x86_64 |
| 72 | + - macos-version: "11.0" |
| 73 | + target: aarch64-apple-darwin |
| 74 | + py-platform: macosx-11_0_arm64 |
| 75 | + |
| 76 | + name: macOS - ${{ matrix.platform }} |
| 77 | + runs-on: macos-${{ matrix.macos-version }} |
| 78 | + |
| 79 | + steps: |
| 80 | + - uses: actions/checkout@v2 |
| 81 | + |
| 82 | + - uses: actions-rs/toolchain@v1 |
| 83 | + with: |
| 84 | + toolchain: stable |
| 85 | + target: ${{ matrix.target }} |
| 86 | + profile: minimal |
| 87 | + override: true |
| 88 | + |
| 89 | + - uses: ruby/setup-ruby@v1 |
| 90 | + with: |
| 91 | + ruby-version: '3.1' |
| 92 | + |
| 93 | + - name: Install bundles |
| 94 | + run: bundle |
| 95 | + working-directory: pyroscope_ffi/ruby |
| 96 | + |
| 97 | + - name: Build native extensions |
| 98 | + run: rake rbspy_install |
| 99 | + working-directory: pyroscope_ffi/ruby |
| 100 | + |
| 101 | + - name: Build native extensions |
| 102 | + run: rake thread_id_install |
| 103 | + working-directory: pyroscope_ffi/ruby |
| 104 | + |
| 105 | + - if: matrix.target == 'x86_64-apple-darwin' |
| 106 | + name: Build macos gem |
| 107 | + run: rake x86_64_darwin:gem |
| 108 | + working-directory: pyroscope_ffi/ruby |
| 109 | + |
| 110 | + - if: matrix.target == 'aarch64-apple-darwin' |
| 111 | + name: Build macos gem |
| 112 | + run: rake arm64_darwin:gem |
| 113 | + working-directory: pyroscope_ffi/ruby |
| 114 | + |
| 115 | + - uses: actions/upload-artifact@v2 |
| 116 | + with: |
| 117 | + name: ${{ github.sha }} |
| 118 | + path: pyroscope_ffi/ruby/pkg/*.gem |
| 119 | + |
| 120 | + source: |
| 121 | + name: source |
| 122 | + runs-on: ubuntu-latest |
| 123 | + |
| 124 | + steps: |
| 125 | + - uses: actions/checkout@v2 |
| 126 | + |
| 127 | + - uses: ruby/setup-ruby@v1 |
| 128 | + with: |
| 129 | + ruby-version: '3.1' |
| 130 | + |
| 131 | + - name: Install bundles |
| 132 | + run: bundle |
| 133 | + working-directory: pyroscope_ffi/ruby |
| 134 | + |
| 135 | + - name: Build source gem |
| 136 | + run: rake source:gem |
| 137 | + working-directory: pyroscope_ffi/ruby |
| 138 | + |
| 139 | + - uses: actions/upload-artifact@v2 |
| 140 | + with: |
| 141 | + name: ${{ github.sha }} |
| 142 | + path: pyroscope_ffi/ruby/pkg/*.gem |
0 commit comments