Skip to content

Commit e59dfeb

Browse files
Fixed: Install GNU tools on macos runner for GitHub build action
1 parent e6c86dd commit e59dfeb

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

.github/workflows/debug_build.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,39 @@ jobs:
2020
- name: Clone repository
2121
uses: actions/checkout@v4
2222

23+
- name: Install GNU tools on macos runner
24+
if: runner.os == 'macOS'
25+
run: |
26+
# macOS runner ships with bash v3, and BSD grep and sed which dont support the required options.
27+
brew update
28+
brew install bash
29+
brew install grep
30+
brew install gnu-sed
31+
32+
echo "/opt/homebrew/opt/grep/libexec/gnubin:/opt/homebrew/opt/gnu-sed/libexec/gnubin" >> "$GITHUB_PATH"
33+
2334
- name: Build APKs
2435
shell: bash {0}
2536
env:
2637
PACKAGE_VARIANT: ${{ matrix.package_variant }}
2738
run: |
2839
exit_on_error() { echo "$1"; exit 1; }
2940
41+
if [ -n "$JAVA_HOME_17_X64" ]; then
42+
JAVA_HOME_17="$JAVA_HOME_17_X64"
43+
elif [ -n "$JAVA_HOME_17_arm64" ]; then
44+
JAVA_HOME_17="$JAVA_HOME_17_arm64"
45+
else
46+
exit_on_error "jdk-17 not set in '\$JAVA_HOME_17_X64\' or '\$JAVA_HOME_17_arm64\'."
47+
fi
48+
49+
if [ ! -f "$JAVA_HOME_17/bin/javac" ] || [ ! -x "$JAVA_HOME_17/bin/javac" ]; then
50+
exit_on_error "jdk-17 binary not found at path '$JAVA_HOME_17/bin/javac' or is not executable."
51+
fi
52+
53+
3054
echo "Setting vars"
55+
echo "PATH=$PATH"
3156
3257
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
3358
GITHUB_SHA="${{ github.event.pull_request.head.sha }}" # Do not use last merge commit set in GITHUB_SHA
@@ -54,6 +79,7 @@ jobs:
5479
export TERMUX_APP_VERSION_NAME="${RELEASE_VERSION_NAME/v/}" # Used by app/build.gradle
5580
export TERMUX_APK_VERSION_TAG="$APK_VERSION_TAG" # Used by app/build.gradle
5681
export TERMUX_PACKAGE_VARIANT="${{ env.PACKAGE_VARIANT }}" # Used by app/build.gradle
82+
export GRADLE_OPTS="-Dorg.gradle.java.home=$JAVA_HOME_17"
5783
if ! ./gradlew assembleDebug; then
5884
exit_on_error "Build failed for '$APK_VERSION_TAG' build."
5985
fi

0 commit comments

Comments
 (0)