Skip to content

Clean Linux-x86_64 between builds [nociy] #61

Clean Linux-x86_64 between builds [nociy]

Clean Linux-x86_64 between builds [nociy] #61

name: Build [Linux arm64]
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
jobs:
build-spms:
runs-on: ubuntu-22.04
container: ubuntu:23.04
if: ${{ github.event.pull_request.draft == false && (github.event_name == 'workflow_dispatch' || !contains(github.event.head_commit.message, 'noci')) }}
env:
TOOLCHAIN_VERSION: aarch64-unknown-linux-gnu-gcc-8.3.0-glibc-2.25-kernel-4.9-2
JAVA_HOME: /usr/lib/jvm/java-17-openjdk/
steps:
- 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 libc6-dev-i386
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Get cached libzmq
id: cache-libzmq
uses: actions/cache@v4
with:
path: libzmq
key: libzmq-arm64
- 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
# http://wiki.zeromq.org/build:arm
run: |
LDFLAGS="-lgcc -lgcc_s" \
CC=$TOOLCHAIN/bin/aarch64-unknown-linux-gnu-gcc \
CXX=$TOOLCHAIN/bin/aarch64-unknown-linux-gnu-g++ \
./configure \
--host=arm-none-linux-gnueabi \
--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/linux-arm64
run: mkdir -p src/nativeInterop/linux-arm64 && cp -r libzmq/* src/nativeInterop/linux-arm64
- name: Add arm64 architecture to dpkg
run: dpkg --add-architecture arm64
- name: Add arm64 apt sources
run: |
cat > /etc/apt/sources.list.d/arm64-sources.list <<EOF
deb [arch=arm64] http://ports.ubuntu.com/ lunar main restricted
deb [arch=arm64] http://ports.ubuntu.com/ lunar-updates main restricted
deb [arch=arm64] http://ports.ubuntu.com/ lunar universe
deb [arch=arm64] http://ports.ubuntu.com/ lunar-updates universe
deb [arch=arm64] http://ports.ubuntu.com/ lunar multiverse
deb [arch=arm64] http://ports.ubuntu.com/ lunar-updates multiverse
deb [arch=arm64] http://ports.ubuntu.com/ lunar-backports main restricted universe multiverse
EOF
- name: Restrict main apt sources to amd64
run: |
cat > /etc/apt/sources.list <<EOF
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ lunar main restricted
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ lunar-updates main restricted
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ lunar universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ lunar-updates universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ lunar multiverse
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ lunar-updates multiverse
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ lunar-backports main restricted universe multiverse
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ lunar-security main restricted
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ lunar-security universe
deb [arch=amd64] http://security.ubuntu.com/ubuntu/ lunar-security multiverse
EOF
- name: Install arm64 development libraries
run: |
apt update
apt install -y libmpv-dev:arm64 libappindicator3-dev:arm64
- name: Set up Gradle
uses: gradle/gradle-build-action@v3
- name: Grant execute permission for gradlew
run: chmod +x gradle
- name: Build linux-arm64 binaries
run: ./gradlew linux-arm64Binaries -PLINK_STATIC
- name: Strip release binary
run: $TOOLCHAIN/bin/aarch64-unknown-linux-gnu-strip build/bin/linux-arm64/releaseExecutable/*.kexe
- name: Upload debug binary
uses: actions/upload-artifact@v3
with:
name: spms-linux-arm64-debug
path: build/bin/linux-arm64/debugExecutable/*.kexe
- name: Upload release binary
uses: actions/upload-artifact@v3
with:
name: spms-linux-arm64-release
path: build/bin/linux-arm64/releaseExecutable/*.kexe
- name: Build linux-arm64 binaries without mpv
run: ./gradlew linux-arm64Binaries -PLINK_STATIC -PDISABLE_MPV
- name: Strip release binary
run: $TOOLCHAIN/bin/aarch64-unknown-linux-gnu-strip build/bin/linux-arm64/releaseExecutable/*.kexe
- name: Upload debug binary
uses: actions/upload-artifact@v3
with:
name: spms-nompv-linux-arm64-debug
path: build/bin/linux-arm64/debugExecutable/*.kexe
- name: Upload release binary
uses: actions/upload-artifact@v3
with:
name: spms-nompv-linux-arm64-release
path: build/bin/linux-arm64/releaseExecutable/*.kexe