From d2263fa93846e9248ff6a00d3218c3ec89164c06 Mon Sep 17 00:00:00 2001 From: Sun Seng David TAN Date: Tue, 12 Dec 2023 11:17:28 +0100 Subject: [PATCH] ci: Implement GitHub Action for building native artifacts on PR builds Signed-off-by: Sun Seng David TAN --- .github/workflows/pr-build-native.yml | 68 +++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/pr-build-native.yml diff --git a/.github/workflows/pr-build-native.yml b/.github/workflows/pr-build-native.yml new file mode 100644 index 0000000..1fb3cfc --- /dev/null +++ b/.github/workflows/pr-build-native.yml @@ -0,0 +1,68 @@ +name: "[PR] Build native binaries" +on: + pull_request: + branches: + - main + types: [opened, synchronize] +jobs: + build: + name: Build kubectl-kport and kport-ide-server native binaries on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest,windows-latest,ubuntu-latest] + steps: + - uses: actions/checkout@v3 + + - uses: graalvm/setup-graalvm@v1 + with: + version: '22.3.2' + java-version: '17' + components: "native-image" + github-token: ${{ github.token }} + native-image-job-reports: 'false' + + - name: Build All on ${{ matrix.os }} + run: | + mvn clean install -DskipTests -Dnative + + - name: Upload kubectl for Windows + if: matrix.os == 'windows-latest' + uses: actions/upload-artifact@v2 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + name: kubectl-kport-${{ runner.os }}.exe + path: kubectl-kport/target/kubectl-kport.exe + retention-days: 1 + + - name: Upload kport-ide-server for Windows + if: matrix.os == 'windows-latest' + uses: actions/upload-artifact@v2 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + name: kport-ide-server-${{ runner.os }}.exe + path: kport-ide-server/target/kport-ide-server.exe + retention-days: 1 + + - name: Upload kubectl + if: matrix.os != 'windows-latest' + uses: actions/upload-artifact@v2 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + name: kubectl-kport-${{ runner.os }} + path: kubectl-kport/target/kubectl-kport + retention-days: 1 + + - name: Upload kport-ide-server + if: matrix.os != 'windows-latest' + uses: actions/upload-artifact@v2 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + name: kport-ide-server-${{ runner.os }} + path: kport-ide-server/target/kport-ide-server + retention-days: 1 +