Skip to content

Commit 166f81b

Browse files
committed
ci: fix macos builds
1 parent de1461d commit 166f81b

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

.github/workflows/build.yml

+19-17
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ defaults:
4040

4141
env:
4242
JAVA_VERSION: 17
43-
RELEASE_NAME: "snapshot"
43+
RELEASE_NAME: "latest"
4444

4545

4646
jobs:
@@ -193,11 +193,12 @@ jobs:
193193

194194
- arch: "darwin-arm64"
195195
os: "macos-latest" # ARM
196+
# using newer graalvm release because 21.3.3.1 is not available for ARM
196197
graal_version: 23.0.1 # https://github.com/graalvm/graalvm-ce-builds/releases/tag/jdk-23.0.1
197198
graal_install_root: "graalvm"
198199

199200
- arch: "darwin-amd64"
200-
os: "macos-12" # x64 -> TODO not using macos-13 because of https://github.com/upx/upx/issues/612
201+
os: "macos-13" # x64
201202
# not using newer graalvm release which produces considerably larger binaries
202203
graal_version: 21.3.3.1 # https://github.com/graalvm/graalvm-ce-builds/releases/tag/vm-21.3.3.1
203204
graal_install_root: "graalvm"
@@ -387,14 +388,10 @@ jobs:
387388
esac
388389
389390
390-
- name: "Install: MacPorts"
391-
uses: melusina-org/setup-macports@v1
392-
if: runner.os == 'macOS'
393-
394-
395391
- name: "Install: UPX"
396392
env:
397393
GITHUB_TOKEN: ${{ github.token }}
394+
if: runner.os != 'macOS' # https://github.com/upx/upx/issues/612
398395
run: |
399396
case "${{ matrix.arch }}" in
400397
linux-amd64)
@@ -416,9 +413,8 @@ jobs:
416413
fi
417414
;;
418415
darwin-*)
419-
# TODO https://github.com/upx/upx/issues/612 https://github.com/Homebrew/homebrew-core/pull/183634
420-
# brew install upx
421-
sudo port install upx
416+
# https://github.com/Homebrew/homebrew-core/pull/183634
417+
brew install upx
422418
;;
423419
windows-amd64)
424420
# first choco install in a build takes 3+ minutes
@@ -549,6 +545,7 @@ jobs:
549545
550546
551547
- name: "Compress executable"
548+
if: runner.os != 'macOS' # https://github.com/upx/upx/issues/612
552549
run: |
553550
set -eu
554551
case "${{ matrix.arch }}" in
@@ -565,8 +562,7 @@ jobs:
565562
darwin-*)
566563
# https://www.unix.com/man-page/osx/1/strip/
567564
strip copycat-${{ matrix.arch }}
568-
cp copycat-${{ matrix.arch }} copycat-${{ matrix.arch }}-upx
569-
upx -v -9 --force-macos --no-progress copycat-${{ matrix.arch }}-upx
565+
upx -v -9 --force-macos --no-progress copycat-${{ matrix.arch }}
570566
;;
571567
windows-amd64)
572568
cp copycat-${{ matrix.arch }}.exe copycat-${{ matrix.arch }}-upx.exe
@@ -576,7 +572,7 @@ jobs:
576572
577573
578574
- name: "Test compressed executable"
579-
if: ${{ matrix.arch != 'darwin-arm64' }} # TODO compressed files not working on MacOS 13+ https://github.com/upx/upx/issues/612
575+
if: runner.os != 'macOS' # https://github.com/upx/upx/issues/612
580576
run: |
581577
case "${{ matrix.arch }}" in
582578
linux-arm64)
@@ -588,12 +584,19 @@ jobs:
588584
./copycat-${{ matrix.arch }} watch --help
589585
"
590586
;;
587+
windows-*)
588+
chmod u+x copycat-${{ matrix.arch }}-upx
589+
./copycat-${{ matrix.arch }}-upx --version
590+
./copycat-${{ matrix.arch }}-upx --help
591+
./copycat-${{ matrix.arch }}-upx sync --help
592+
./copycat-${{ matrix.arch }}-upx watch --help
593+
;;
591594
*)
592595
chmod u+x copycat-${{ matrix.arch }}
593596
./copycat-${{ matrix.arch }} --version
594597
./copycat-${{ matrix.arch }} --help
595598
./copycat-${{ matrix.arch }} sync --help
596-
./copycat-${{ matrix.arch }} --help
599+
./copycat-${{ matrix.arch }} watch --help
597600
;;
598601
esac
599602
@@ -627,7 +630,7 @@ jobs:
627630

628631

629632
- name: "Delete previous '${{ env.RELEASE_NAME }}' release"
630-
if: env.RELEASE_NAME == 'snapshot'
633+
if: env.RELEASE_NAME == 'latest'
631634
env:
632635
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
633636
# https://cli.github.com/manual/gh_release_delete
@@ -642,6 +645,7 @@ jobs:
642645
run: |
643646
GH_DEBUG=1 gh release create "$RELEASE_NAME" \
644647
--latest \
648+
--title "$RELEASE_NAME" \
645649
--notes "${{ github.event.head_commit.message }}" \
646650
--target "${{ github.sha }}" \
647651
artifacts/copycat-fat.jar#copycat-${{ env.RELEASE_NAME }}-fat.jar \
@@ -650,8 +654,6 @@ jobs:
650654
artifacts/copycat-linux-arm64#copycat-${{ env.RELEASE_NAME }}-linux-arm64 \
651655
artifacts/copycat-darwin-amd64#copycat-${{ env.RELEASE_NAME }}-darwin-amd64 \
652656
artifacts/copycat-darwin-arm64#copycat-${{ env.RELEASE_NAME }}-darwin-arm64 \
653-
artifacts/copycat-darwin-amd64-upx#copycat-${{ env.RELEASE_NAME }}-darwin-amd64-upx \
654-
artifacts/copycat-darwin-arm64-upx#copycat-${{ env.RELEASE_NAME }}-darwin-arm64-upx \
655657
artifacts/copycat-windows-amd64.exe#copycat-${{ env.RELEASE_NAME }}-windows-amd64.exe \
656658
artifacts/copycat-windows-amd64-upx.exe#copycat-${{ env.RELEASE_NAME }}-windows-amd64-upx.exe
657659

0 commit comments

Comments
 (0)