|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +name: Collector Native Release |
| 19 | + |
| 20 | +run-name: Native collector release build (${{ github.ref_name }}) |
| 21 | + |
| 22 | +on: |
| 23 | + workflow_dispatch: |
| 24 | + |
| 25 | +jobs: |
| 26 | + build-native-collector: |
| 27 | + name: Native collector (${{ matrix.platform }}) |
| 28 | + permissions: |
| 29 | + contents: read |
| 30 | + timeout-minutes: 120 |
| 31 | + runs-on: ${{ matrix.runner }} |
| 32 | + strategy: |
| 33 | + fail-fast: false |
| 34 | + matrix: |
| 35 | + include: |
| 36 | + - platform: linux-amd64 |
| 37 | + runner: ubuntu-24.04 |
| 38 | + archive_ext: tar.gz |
| 39 | + - platform: linux-arm64 |
| 40 | + runner: ubuntu-24.04-arm |
| 41 | + archive_ext: tar.gz |
| 42 | + - platform: macos-amd64 |
| 43 | + runner: macos-13 |
| 44 | + archive_ext: tar.gz |
| 45 | + - platform: macos-arm64 |
| 46 | + runner: macos-14 |
| 47 | + archive_ext: tar.gz |
| 48 | + - platform: windows-amd64 |
| 49 | + runner: windows-latest |
| 50 | + archive_ext: zip |
| 51 | + |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v4 |
| 54 | + |
| 55 | + - name: Set up GraalVM JDK 25 |
| 56 | + uses: graalvm/setup-graalvm@v1 |
| 57 | + with: |
| 58 | + distribution: graalvm-community |
| 59 | + java-version: '25' |
| 60 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + cache: maven |
| 62 | + native-image-job-reports: 'true' |
| 63 | + |
| 64 | + - name: Verify toolchain |
| 65 | + shell: pwsh |
| 66 | + run: | |
| 67 | + java -version |
| 68 | + native-image --version |
| 69 | + mvn -version |
| 70 | +
|
| 71 | + - name: Build native collector package |
| 72 | + run: mvn -B -pl hertzbeat-collector/hertzbeat-collector-collector -am -Pnative -DskipTests package |
| 73 | + |
| 74 | + - name: Locate native collector package |
| 75 | + id: package |
| 76 | + shell: pwsh |
| 77 | + run: | |
| 78 | + $package = Get-ChildItem -Path "dist/apache-hertzbeat-collector-native-*-${{ matrix.platform }}-bin.${{ matrix.archive_ext }}" | Select-Object -First 1 |
| 79 | + if (-not $package) { |
| 80 | + throw "Native collector package not found for ${{ matrix.platform }}" |
| 81 | + } |
| 82 | + "archive=$($package.FullName)" >> $env:GITHUB_OUTPUT |
| 83 | +
|
| 84 | + - name: Upload native collector package |
| 85 | + uses: actions/upload-artifact@v4 |
| 86 | + with: |
| 87 | + name: apache-hertzbeat-collector-native-${{ matrix.platform }} |
| 88 | + path: ${{ steps.package.outputs.archive }} |
| 89 | + retention-days: 14 |
0 commit comments