diff --git a/.github/workflows/early-access.yml b/.github/workflows/early-access.yml index b622ca4..222aa92 100644 --- a/.github/workflows/early-access.yml +++ b/.github/workflows/early-access.yml @@ -17,11 +17,13 @@ jobs: strategy: fail-fast: true matrix: - os: [ ubuntu-latest, macOS-12, macos-14, windows-latest ] + os: [ ubuntu-latest, linux-arm64, macOS-12, macos-14, windows-latest ] gu-binary: [ gu, gu.cmd ] exclude: - os: ubuntu-latest gu-binary: gu.cmd + - os: linux-arm64 + gu-binary: gu.cmd - os: macOS-12 gu-binary: gu.cmd - os: macos-14 @@ -56,14 +58,30 @@ jobs: run: | TMP_DIR=$(mktemp -d) pushd $TMP_DIR - curl -LOJ http://more.musl.cc/10/x86_64-linux-musl/x86_64-linux-musl-native.tgz - tar -xvf x86_64-linux-musl-native.tgz + case $MATRIX_OS in + ubuntu-latest) + curl -LOJ https://musl.cc/x86_64-linux-musl-native.tgz + tar -xvf x86_64-linux-musl-native.tgz + TOOLCHAIN_DIR=$TMP_DIR/x86_64-linux-musl-native + ;; + linux-arm64) + curl -LOJ https://musl.cc/aarch64-linux-musl-native.tgz + tar -xvf aarch64-linux-musl-native.tgz + TOOLCHAIN_DIR=$TMP_DIR/aarch64-linux-musl-native + # Symlink x86_64-linux-musl-gcc to aarch64-linux-musl-gcc as native-image expects the former to be present + # See https://www.graalvm.org/dev/reference-manual/native-image/guides/build-static-executables/ + ln -s $TOOLCHAIN_DIR/bin/aarch64-linux-musl-gcc $TOOLCHAIN_DIR/bin/x86_64-linux-musl-gcc + ;; + *) + echo 'Unexpected CPU architecture!' + exit 1 + ;; + esac curl -LOJ https://zlib.net/fossils/zlib-1.3.tar.gz tar -xzf zlib-1.3.tar.gz cd zlib-1.3 - TOOLCHAIN_DIR=$TMP_DIR/x86_64-linux-musl-native CC=$TOOLCHAIN_DIR/bin/gcc ./configure --prefix=$TOOLCHAIN_DIR --static @@ -71,7 +89,9 @@ jobs: make install echo "TOOLCHAIN_DIR=$TOOLCHAIN_DIR" >> $GITHUB_OUTPUT - if: matrix.os == 'ubuntu-latest' + if: matrix.os == 'ubuntu-latest' || matrix.os == 'linux-arm64' + env: + MATRIX_OS: ${{ matrix.os }} - name: Cache Maven packages id: restore-maven-package-cache @@ -86,12 +106,12 @@ jobs: PATH=${TOOLCHAIN_DIR}/bin:$PATH; mvn -B -Pnative package env: TOOLCHAIN_DIR: ${{ steps.prepare-musl.outputs.TOOLCHAIN_DIR }} - if: matrix.os == 'ubuntu-latest' + if: matrix.os == 'ubuntu-latest' || matrix.os == 'linux-arm64' - name: Build static native image for Windows / macOS run: | mvn -B -Pnative package - if: matrix.os != 'ubuntu-latest' + if: matrix.os != 'ubuntu-latest' && matrix.os != 'linux-arm64' - name: Create distribution run: mvn -B -Pdist package -DskipTests @@ -134,7 +154,7 @@ jobs: - name: Move build artifacts to correct folder run: | - targets=("ubuntu-latest" "macOS-latest" "macos-14" "windows-latest") + targets=("ubuntu-latest" "linux-arm64" "macOS-latest" "macos-14" "windows-latest") mkdir -p artifacts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca1111d..c95a5cc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -70,11 +70,13 @@ jobs: strategy: fail-fast: true matrix: - os: [ ubuntu-latest, macOS-12, macos-14, windows-latest ] + os: [ ubuntu-latest, linux-arm64, macOS-12, macos-14, windows-latest ] gu-binary: [ gu, gu.cmd ] exclude: - os: ubuntu-latest gu-binary: gu.cmd + - os: linux-arm64 + gu-binary: gu.cmd - os: macOS-12 gu-binary: gu.cmd - os: macos-14 @@ -115,14 +117,30 @@ jobs: run: | TMP_DIR=$(mktemp -d) pushd $TMP_DIR - curl -LOJ http://more.musl.cc/10/x86_64-linux-musl/x86_64-linux-musl-native.tgz - tar -xvf x86_64-linux-musl-native.tgz + case $MATRIX_OS in + ubuntu-latest) + curl -LOJ https://musl.cc/x86_64-linux-musl-native.tgz + tar -xvf x86_64-linux-musl-native.tgz + TOOLCHAIN_DIR=$TMP_DIR/x86_64-linux-musl-native + ;; + linux-arm64) + curl -LOJ https://musl.cc/aarch64-linux-musl-native.tgz + tar -xvf aarch64-linux-musl-native.tgz + TOOLCHAIN_DIR=$TMP_DIR/aarch64-linux-musl-native + # Symlink x86_64-linux-musl-gcc to aarch64-linux-musl-gcc as native-image expects the former to be present + # See https://www.graalvm.org/dev/reference-manual/native-image/guides/build-static-executables/ + ln -s $TOOLCHAIN_DIR/bin/aarch64-linux-musl-gcc $TOOLCHAIN_DIR/bin/x86_64-linux-musl-gcc + ;; + *) + echo 'Unexpected CPU architecture!' + exit 1 + ;; + esac curl -LOJ https://zlib.net/fossils/zlib-1.3.tar.gz tar -xzf zlib-1.3.tar.gz cd zlib-1.3 - TOOLCHAIN_DIR=$TMP_DIR/x86_64-linux-musl-native CC=$TOOLCHAIN_DIR/bin/gcc ./configure --prefix=$TOOLCHAIN_DIR --static @@ -130,7 +148,9 @@ jobs: make install echo "TOOLCHAIN_DIR=$TOOLCHAIN_DIR" >> $GITHUB_OUTPUT - if: matrix.os == 'ubuntu-latest' + if: matrix.os == 'ubuntu-latest' || matrix.os == 'linux-arm64' + env: + MATRIX_OS: ${{ matrix.os }} - name: Cache Maven packages uses: actions/cache@v4.0.2 @@ -144,12 +164,12 @@ jobs: PATH=${TOOLCHAIN_DIR}/bin:$PATH; mvn -B -Pnative package env: TOOLCHAIN_DIR: ${{ steps.prepare-musl.outputs.TOOLCHAIN_DIR }} - if: matrix.os == 'ubuntu-latest' + if: matrix.os == 'ubuntu-latest' || matrix.os == 'linux-arm64' - name: Build static native image for Windows / macOS run: | mvn -B -Pnative package - if: matrix.os != 'ubuntu-latest' + if: matrix.os != 'ubuntu-latest' && matrix.os != 'linux-arm64' - name: Create distribution run: mvn -B -Pdist package -DskipTests @@ -208,7 +228,7 @@ jobs: - name: Move build artifacts to correct folder run: | - targets=("ubuntu-latest" "macOS-latest" "macos-14" "windows-latest") + targets=("ubuntu-latest" "linux-arm64" "macOS-latest" "macos-14" "windows-latest") mkdir -p artifacts diff --git a/jreleaser.yml b/jreleaser.yml index 1bd272e..4cc04c1 100644 --- a/jreleaser.yml +++ b/jreleaser.yml @@ -73,8 +73,8 @@ distributions: localPlugs: - network architectures: - - buildOn: [amd64] - runOn: [amd64] + - buildOn: [amd64, arm64] + runOn: [amd64, arm64] repository: active: RELEASE name: mcs-snap @@ -91,10 +91,18 @@ distributions: platform: linux-x86_64 extraProperties: graalVMNativeImage: true + - path: ./{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-linux-arm64.zip + platform: linux-arm64 + extraProperties: + graalVMNativeImage: true - path: ./{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-linux-x86_64.tar.gz platform: linux-x86_64 extraProperties: graalVMNativeImage: true + - path: ./{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-linux-arm64.tar.gz + platform: linux-arm64 + extraProperties: + graalVMNativeImage: true - path: ./{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-windows-x86_64.zip platform: windows-x86_64 - path: ./{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-osx-x86_64.zip diff --git a/src/main/java/it/mulders/mcs/App.java b/src/main/java/it/mulders/mcs/App.java index 1715519..2333a6d 100644 --- a/src/main/java/it/mulders/mcs/App.java +++ b/src/main/java/it/mulders/mcs/App.java @@ -49,8 +49,9 @@ private static void setUpProxy() { System.setProperty("https.proxyPort", Integer.toString(uri.getPort())); } } catch (URISyntaxException e) { - System.err.println("Error while setting up proxy from environment: HTTP_PROXY=[%s], HTTPS_PROXY=[%s]" - .formatted(httpProxy, httpsProxy)); + System.err.printf( + "Error while setting up proxy from environment: HTTP_PROXY=[%s], HTTPS_PROXY=[%s]%n", + httpProxy, httpsProxy); } }