Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

Commit

Permalink
Merge linux-x86_64 workflow into a single job
Browse files Browse the repository at this point in the history
  • Loading branch information
toasterofbread committed Feb 12, 2024
1 parent be1fecd commit 94ae4f9
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 54 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/build-linux-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
key: libzmq-arm64

- name: Download and extract toolchain
if: steps.cache-libzmq.outputs.cache-hit != 'true'
run: |
wget https://download.jetbrains.com/kotlin/native/$TOOLCHAIN_VERSION.tar.gz -O toolchain.tar.gz
tar -xzf toolchain.tar.gz
Expand Down Expand Up @@ -128,8 +127,6 @@ jobs:
- name: Build native binaries
run: SPMS_ARCH="aarch64" ./gradlew nativeBinariesStatic

- run: ls build/bin/native/releaseExecutable

- name: Strip release binary
run: $TOOLCHAIN/bin/aarch64-unknown-linux-gnu-strip build/bin/native/releaseExecutable/*.kexe

Expand Down
106 changes: 58 additions & 48 deletions .github/workflows/build-linux-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,68 +8,78 @@ on:
workflow_dispatch:

jobs:
build-zmq:
runs-on: ubuntu-20.04
steps:
- name: Get cached libzmq
id: cache-libzmq
uses: actions/cache@v4
with:
path: libzmq
key: libzmq-x86_64

- name: Download libzmq
if: steps.cache-libzmq.outputs.cache-hit != 'true'
run: wget https://github.com/zeromq/libzmq/releases/download/v4.3.5/zeromq-4.3.5.tar.gz

- name: Extract libzmq
if: steps.cache-libzmq.outputs.cache-hit != 'true'
run: tar -xf ./zeromq-4.3.5.tar.gz

- name: Configure libzmq
if: steps.cache-libzmq.outputs.cache-hit != 'true'
working-directory: zeromq-4.3.5
run: ./configure --enable-drafts --enable-static --disable-shared --disable-libbsd --prefix=$GITHUB_WORKSPACE/libzmq

- name: Compile libzmq
if: steps.cache-libzmq.outputs.cache-hit != 'true'
working-directory: zeromq-4.3.5
run: make -j$(nproc) && make install

- name: Upload libzmq artifact
uses: actions/upload-artifact@v4
with:
name: libzmq
path: libzmq
retention-days: 1

build-spms:
runs-on: ubuntu-22.04
container: archlinux
needs: build-zmq
container: ubuntu:23.04

env:
TOOLCHAIN_VERSION: x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9-2
JAVA_HOME: /usr/lib/jvm/java-17-openjdk/

steps:
- name: Install build tools
run: pacman --noconfirm -Syu git gcc make jre17-openjdk wget pkgconf
- run: echo "TOOLCHAIN=$GITHUB_WORKSPACE/toolchain" >> $GITHUB_ENV

- run: apt update

- run: apt install -y nodejs
if: env.ACT
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Test Java
run: $JAVA_HOME/bin/java --version

- run: apt install -y --reinstall git make wget pkg-config libmpv-dev libcurl4-openssl-dev libappindicator3-dev

- uses: actions/checkout@v3
with:
submodules: recursive

- name: Download libzmq artifact
uses: actions/download-artifact@v4

- name: Move libzmq into src/nativeInterop
run: mkdir src/nativeInterop && mv libzmq/* src/nativeInterop

- name: Install dependencies
run: pacman --noconfirm -Sy mpv libappindicator-gtk3
- name: Get cached libzmq
id: cache-libzmq
uses: actions/cache@v4
with:
path: libzmq
key: libzmq-x86_64

- name: Download and extract toolchain
run: |
wget https://download.jetbrains.com/kotlin/native/$TOOLCHAIN_VERSION.tar.gz -O toolchain.tar.gz
tar -xzf toolchain.tar.gz
mv ./$TOOLCHAIN_VERSION $TOOLCHAIN
- name: Download libzmq
if: steps.cache-libzmq.outputs.cache-hit != 'true'
run: wget https://github.com/zeromq/libzmq/releases/download/v4.3.5/zeromq-4.3.5.tar.gz

- name: Extract libzmq
if: steps.cache-libzmq.outputs.cache-hit != 'true'
run: tar -xf ./zeromq-4.3.5.tar.gz

- name: Configure libzmq
if: steps.cache-libzmq.outputs.cache-hit != 'true'
working-directory: zeromq-4.3.5
run: |
LDFLAGS="-lgcc -lgcc_s" \
CC=$TOOLCHAIN/bin/x86_64-unknown-linux-gnu-gcc \
CXX=$TOOLCHAIN/bin/x86_64-unknown-linux-gnu-g++ \
./configure \
--enable-drafts \
--enable-static \
--disable-shared \
--disable-libbsd \
--prefix=$GITHUB_WORKSPACE/libzmq
- name: Compile and install libzmq
if: steps.cache-libzmq.outputs.cache-hit != 'true'
working-directory: zeromq-4.3.5
run: make -j$(nproc) && make install

- name: Copy libzmq into src/nativeInterop
run: mkdir src/nativeInterop && cp -r libzmq/* src/nativeInterop

- name: Set up Gradle
uses: gradle/gradle-build-action@v3
Expand All @@ -81,7 +91,7 @@ jobs:
run: ./gradlew nativeBinariesStatic

- name: Strip release binary
run: strip build/bin/native/releaseExecutable/*.kexe
run: $TOOLCHAIN/bin/x86_64-unknown-linux-gnu-strip build/bin/native/releaseExecutable/*.kexe

- name: Upload debug binary
uses: actions/upload-artifact@v3
Expand Down
7 changes: 5 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ kotlin {
OS.OSX_ARM -> macosArm64("native")
}

println("Building for target ${OS.target}")

native_target.apply {
compilations.getByName("main") {
cinterops {
Expand Down Expand Up @@ -278,7 +276,12 @@ tasks.register("configurePlatformSpecificFiles") {
}
}

tasks.register("printBuildTarget") {
println("Building spmp-server for target ${OS.target}")
}

tasks.getByName("compileKotlinNative") {
dependsOn("printBuildTarget")
dependsOn("bundleIcon")
dependsOn("configurePlatformSpecificFiles")
}
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
kotlin.incremental.native=true
org.gradle.jvmargs=-Xmx4g -Xms1g
org.gradle.caching=true
org.gradle.caching=true
kotlin.mpp.applyDefaultHierarchyTemplate=false

0 comments on commit 94ae4f9

Please sign in to comment.