Skip to content

Build musl from src

Build musl from src #9

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Build Application
on:
workflow_dispatch:
push:
branches:
- master
concurrency:
group: build
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
architecture: [x64, aarch64]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Pre-build shell for POSIX
if: runner.os != 'Windows'
run: |
ls -al
chmod +x gradlew
./gradlew --version
- name: Pre-build shell for Linux
if: runner.os == 'Linux' || runner.os == 'Ubuntu' || runner.os == 'CentOS'
run: |
# Specify an installation directory for musl:
export MUSL_HOME=$PWD/musl-toolchain
# Download musl and zlib sources:
curl -O https://musl.libc.org/releases/musl-1.2.4.tar.gz
curl -O https://zlib.net/fossils/zlib-1.2.13.tar.gz
# Build musl from source
tar -xzvf musl-1.2.4.tar.gz
pushd musl-1.2.4
./configure --prefix=$MUSL_HOME --static
# The next operation may require privileged access to system resources, so use sudo
sudo make
sudo make install
popd
# Install a symlink for use by native-image
ln -s $MUSL_HOME/bin/musl-gcc $MUSL_HOME/bin/x86_64-linux-musl-gcc
# Extend the system path and confirm that musl is available by printing its version
export PATH="$MUSL_HOME/bin:$PATH"
x86_64-linux-musl-gcc --version
# Build zlib with musl from source and install into the MUSL_HOME directory
tar -xzvf zlib-1.2.13.tar.gz
pushd zlib-1.2.13
CC=musl-gcc ./configure --prefix=$MUSL_HOME --static
sudo make
sudo make install
popd
- name: Pre-build shell for Windows
if: runner.os == 'Windows'
run: |
ls
.\gradlew.bat --version
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
components: 'native-image'
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: '8.8'
- name: Build native image
run: ./gradlew nativeCompile
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: native-image-${{ matrix.os }}-${{ matrix.architecture }}
path: build/native/nativeCompile/SrunLogin*
if-no-files-found: error
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: Create or Update Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
draft: false
prerelease: false
overwrite: true
files: ./artifacts/**
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}