Skip to content

Commit

Permalink
fix: Revert workflow changes and let native compiler handle arm64 fun…
Browse files Browse the repository at this point in the history
…ctionallity (#71)

* Let build target support host arch

* Revert changes in publish file as the native client should support arm
  • Loading branch information
baldm authored Jul 19, 2024
1 parent 2f5fa3b commit 3507172
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
28 changes: 11 additions & 17 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
5 changes: 3 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
}
Expand Down

0 comments on commit 3507172

Please sign in to comment.