From 4eef2be20cb8a2315179f0cb7dd31bb9c36390cc Mon Sep 17 00:00:00 2001 From: Anders Nickelsen Date: Thu, 19 Sep 2024 12:43:12 +0200 Subject: [PATCH] Build arm on intel --- .github/workflows/build.yaml | 38 +++++++++++++++++ .github/workflows/publish.yaml | 78 ---------------------------------- build.gradle.kts | 2 +- 3 files changed, 39 insertions(+), 79 deletions(-) create mode 100644 .github/workflows/build.yaml delete mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..d2c970b --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,38 @@ +name: Build binary + +on: + push: + +jobs: + build: + strategy: + matrix: + machine: [ubuntu-latest, self-hosted-arm64] + runs-on: ${{ matrix.machine }} + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'adopt' + cache: 'gradle' + - uses: actions/cache@v4 + with: + path: "/home/runner/.konan" + key: ${{ runner.os }}-${{ hashFiles('**/build.gradle.kts') }} + - name: Install dependencies + run: | + sudo apt -y update + sudo apt -y 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 }} + - name: Upload executable + uses: actions/upload-artifact@v4 + with: + name: slack-notifier-cli-${{ runner.arch }} + path: slack-notifier-cli-${{ runner.arch }} diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index 4c5550a..0000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,78 +0,0 @@ -name: Build binary - -on: - push: - tags: - - 'v*' - -permissions: - contents: write - -jobs: - build: - strategy: - matrix: - machine: [ubuntu-latest, self-hosted-arm64] - runs-on: ${{ matrix.machine }} - steps: - - uses: actions/checkout@v4 - - name: Set up JDK - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'adopt' - cache: 'gradle' - - uses: actions/cache@v4 - with: - path: "/home/runner/.konan" - key: ${{ runner.os }}-${{ hashFiles('**/build.gradle.kts') }} - - name: Install dependencies - run: | - sudo apt -y update - sudo apt -y 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 }} - - name: Upload executable - uses: actions/upload-artifact@v4 - with: - name: slack-notifier-cli-${{ runner.arch }} - path: slack-notifier-cli-${{ runner.arch }} - publish: - strategy: - matrix: - machine: [ubuntu-latest, self-hosted-arm64] - runs-on: ${{ matrix.machine }} - needs: build - timeout-minutes: 5 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Run changelog cli action - uses: monta-app/changelog-cli-action@main - with: - service-name: "Slack Notifier Cli" - github-release: true - github-token: ${{ secrets.GITHUB_TOKEN }} - jira-app-name: "montaapp" - version-mode: "SemVer" - output: "console" - slack-token: ${{ secrets.SLACK_APP_TOKEN }} - slack-channel: "#releases" - - name: Download executable - uses: actions/download-artifact@v4 - with: - name: slack-notifier-cli-${{ runner.arch }} - - name: Publish executable as release asset - 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 }} - tag: ${{ github.ref }} - overwrite: true diff --git a/build.gradle.kts b/build.gradle.kts index b461071..698ae67 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,7 +23,7 @@ kotlin { val commonTarget = when { hostOs == "Mac OS X" -> macosArm64("common") hostOs == "Linux" && hostArch == "aarch64" -> linuxArm64("common") - hostOs == "Linux" && hostArch == "amd64" -> linuxX64("common") + hostOs == "Linux" && hostArch == "amd64" -> linuxArm64("common") hostOs.startsWith("Windows") -> mingwX64("common") else -> throw GradleException("Host OS is not supported in Kotlin/Native.") }