From 350717211a7b890e165e355893315af1e9e38f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Z=C3=B8rn?= <63373006+baldm@users.noreply.github.com> Date: Fri, 19 Jul 2024 12:30:58 +0200 Subject: [PATCH] fix: Revert workflow changes and let native compiler handle arm64 functionallity (#71) * Let build target support host arch * Revert changes in publish file as the native client should support arm --- .github/workflows/publish.yaml | 28 +++++++++++----------------- build.gradle.kts | 5 +++-- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 6ed38c3..f1c093a 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -10,10 +10,7 @@ permissions: jobs: build: - strategy: - matrix: - machine: [ubuntu-latest, self-hosted-arm64] - runs-on: ${{ matrix.machine }} + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up JDK @@ -28,24 +25,21 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('**/build.gradle.kts') }} - name: Install dependencies run: | - sudo apt -y update - sudo apt -y install libcurl4-openssl-dev + sudo apt update + sudo apt install libcurl4-openssl-dev - name: Build with Gradle run: ./gradlew commonBinaries - name: Move and apply correct permissions to binary run: | - cp build/bin/common/releaseExecutable/slack-notifier-cli.kexe ./slack-notifier-cli-${{ runner.arch }} - chmod +x ./slack-notifier-cli-${{ runner.arch }} + cp build/bin/common/releaseExecutable/slack-notifier-cli.kexe ./slack-notifier-cli + chmod +x ./slack-notifier-cli - name: Upload executable uses: actions/upload-artifact@v4 with: - name: slack-notifier-cli-${{ runner.arch }} - path: slack-notifier-cli-${{ runner.arch }} + name: slack-notifier-cli + path: slack-notifier-cli change-log: - strategy: - matrix: - machine: [ubuntu-latest, self-hosted-arm64] - runs-on: ${{ matrix.machine }} + runs-on: ubuntu-latest needs: build timeout-minutes: 5 steps: @@ -67,12 +61,12 @@ jobs: - name: Download a single artifact uses: actions/download-artifact@v4 with: - name: slack-notifier-cli-${{ runner.arch }} + name: slack-notifier-cli - name: Upload binaries to release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: slack-notifier-cli-${{ runner.arch }} - asset_name: slack-notifier-cli-${{ runner.arch }} + file: slack-notifier-cli + asset_name: slack-notifier-cli tag: ${{ github.ref }} overwrite: true diff --git a/build.gradle.kts b/build.gradle.kts index f16d4b4..b461071 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,12 +17,13 @@ defaultTasks("commonBinaries") kotlin { val hostOs = System.getProperty("os.name") + val hostArch = System.getProperty("os.arch") // Cross Compilation - val commonTarget = when { hostOs == "Mac OS X" -> macosArm64("common") - hostOs == "Linux" -> linuxX64("common") + hostOs == "Linux" && hostArch == "aarch64" -> linuxArm64("common") + hostOs == "Linux" && hostArch == "amd64" -> linuxX64("common") hostOs.startsWith("Windows") -> mingwX64("common") else -> throw GradleException("Host OS is not supported in Kotlin/Native.") }