From 175091a0d651ae2811a8c8b3237a3c6868b10778 Mon Sep 17 00:00:00 2001 From: Windymelt Date: Sun, 9 Aug 2026 23:25:41 +0900 Subject: [PATCH 1/4] Bump Scala version to 3.8.2 --- comport.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comport.scala b/comport.scala index d6e0f60..c0a8724 100644 --- a/comport.scala +++ b/comport.scala @@ -1,5 +1,5 @@ //> using platform native -//> using scala 3.3 +//> using scala 3.8.2 //> using options -no-indent -rewrite //> using dep com.lihaoyi::mainargs::0.7.8 //> using dep com.lihaoyi::os-lib::0.11.8 From 4d8ecb750d732d067bd9960c7e2c2e327ad45705 Mon Sep 17 00:00:00 2001 From: Windymelt Date: Sun, 9 Aug 2026 23:30:07 +0900 Subject: [PATCH 2/4] build binary on pull request, not only merge --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index babeeec..0eaa704 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - run: scala-cli compile . build-linux: - if: github.event_name == 'push' + if: github.event_name == 'push' || github.event_name == 'pull_request' needs: compile strategy: matrix: @@ -48,7 +48,7 @@ jobs: path: comport build-macos: - if: github.event_name == 'push' + if: github.event_name == 'push' || github.event_name == 'pull_request' needs: compile strategy: matrix: From 5c320b55d82ea50ae7f5db5a93ac56bbde4f8d1d Mon Sep 17 00:00:00 2001 From: Windymelt Date: Mon, 10 Aug 2026 00:51:57 +0900 Subject: [PATCH 3/4] fix build script --- .github/workflows/ci.yml | 16 ++-------------- Dockerfile | 8 ++++++++ build-with-container.sh | 7 +++++++ build.sh | 16 ++++++++++++++++ 4 files changed, 33 insertions(+), 14 deletions(-) create mode 100644 Dockerfile create mode 100755 build-with-container.sh create mode 100755 build.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0eaa704..c6b2ea4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,16 +30,7 @@ jobs: - name: Build in Alpine container run: | - docker run --rm -v "$PWD":/work -w /work alpine:latest sh -c ' - apk add --no-cache bash curl clang lld musl-dev openjdk17-jre-headless && - curl -fLo /usr/local/bin/coursier https://github.com/coursier/launchers/raw/master/coursier.jar && - chmod +x /usr/local/bin/coursier && - coursier launch scala-cli -- --power package . -o comport -f \ - --native-mode release-fast \ - --native-lto thin \ - --native-gc commix \ - --native-linking "-static" - ' + ./build-with-container.sh - name: Upload artifact uses: actions/upload-artifact@v4 @@ -64,10 +55,7 @@ jobs: - name: Build native binary run: | - scala-cli --power package . -o comport -f \ - --native-mode release-fast \ - --native-lto full \ - --native-gc commix + ./build.sh - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0456b4d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM alpine:latest + +# libc++-dev is for exception handling +RUN apk add --no-cache bash curl clang libc++-dev alpine-sdk lld musl-dev openjdk17-jre-headless +RUN curl -fLo /usr/local/bin/coursier https://github.com/coursier/launchers/raw/master/coursier.jar && chmod +x /usr/local/bin/coursier +RUN coursier launch scala-cli +ENV PATH="$PATH:/root/.local/share/coursier/bin" +WORKDIR /work diff --git a/build-with-container.sh b/build-with-container.sh new file mode 100755 index 0000000..175a718 --- /dev/null +++ b/build-with-container.sh @@ -0,0 +1,7 @@ +#!/bin/env sh + +set -eux +set pipefail + +docker build -t comport-builder . +docker run --rm -v "$PWD":/work --rm -e SCALA_CLI_LAUNCH='coursier launch scala-cli --' -e LINKFLAGS=-static comport-builder:latest sh /work/build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..cea1ad7 --- /dev/null +++ b/build.sh @@ -0,0 +1,16 @@ +#!/bin/env sh + +# Build script using scala-cli. Overwrites `./comport` if exists. + +set -eux +set pipefail + +LINKFLAGS=${LINKFLAGS:-} +COURSIER=${COURSIER:-cs} +SCALA_CLI_LAUNCH=${SCALA_CLI_LAUNCH:-scala-cli} + +${SCALA_CLI_LAUNCH} --power package . -o comport -f \ + --native-mode release-fast \ + --native-lto full \ + --native-gc commix \ + --native-linking "${LINKFLAGS}" From 0ceb95996e1fc2c5e4688fc67f028671a6a5be23 Mon Sep 17 00:00:00 2001 From: Windymelt Date: Mon, 10 Aug 2026 03:05:48 +0900 Subject: [PATCH 4/4] fixed shellbang --- build-with-container.sh | 2 +- build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build-with-container.sh b/build-with-container.sh index 175a718..42924f8 100755 --- a/build-with-container.sh +++ b/build-with-container.sh @@ -1,4 +1,4 @@ -#!/bin/env sh +#!/bin/sh set -eux set pipefail diff --git a/build.sh b/build.sh index cea1ad7..8627f65 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ -#!/bin/env sh +#!/bin/sh # Build script using scala-cli. Overwrites `./comport` if exists.