Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .github/scripts/install_ndk.bat

This file was deleted.

8 changes: 0 additions & 8 deletions .github/scripts/install_ndk.sh

This file was deleted.

24 changes: 18 additions & 6 deletions .github/workflows/build-quick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,23 +193,35 @@ jobs:
run: |
cargo install toml-cli
ANDROID_NDK_VERSION=$(toml get gradle/libs.versions.toml versions.ndk --raw)
ANDROID_NDK_MAJOR_VERSION=$(echo $ANDROID_NDK_VERSION | cut -f1 -d.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: Is it possible to extract this block to a script. I held myself back from saying when I saw it twice, but 4 times feels like a maintenance burden

Copy link
Member Author

@mikehardy mikehardy Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've gone back and forth on "workflows that use scripts" and "workflows that have everything contained in the workflow"

The scripts way has the obvious benefit of DRY, which is nice, but on balance I'm so used to copy-paste in workflows at this point (almost the whole workflow is copy paste...) that I'm not bothered by DRY in workflows much anymore, so having it all in one spot is currently winning since I end up looking at it more frequently and grooming it more often than I would if it were tucked away separate

it's a slight preference so if you feel strongly, sure as it is obviously repetition, but if you don't feel strongly I'll leave it personally.

Where I definitely use scripts is if I can abstract something needed for devs and ci, but if it's ci-specific....meh

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No strong feelings, let's get this in

https://youtu.be/ussCHoQttyQ

ANDROID_NDK_MINOR_VERSION=$(echo $ANDROID_NDK_VERSION | cut -f2 -d.)
ANDROID_NDK_MARKETING_VERSION="r${ANDROID_NDK_MAJOR_VERSION}"
if ! [ "$ANDROID_NDK_MINOR_VERSION" == "0" ]; then
alphabet="abcdefghijklmnopqrstuvwxyz"
ANDROID_NDK_MARKETING_MINOR_VERSION=$(echo ${alphabet:$ANDROID_NDK_MINOR_VERSION:1})
ANDROID_NDK_MARKETING_VERSION="${ANDROID_NDK_MARKETING_VERSION}${ANDROID_NDK_MARKETING_MINOR_VERSION}"
fi
echo "ANDROID_NDK_VERSION=$ANDROID_NDK_VERSION" >> $GITHUB_ENV
echo "ANDROID_NDK_MARKETING_VERSION=$ANDROID_NDK_MARKETING_VERSION" >> $GITHUB_ENV
shell: bash

- name: Install/Set NDK version (Unix)
- name: Setup Android NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: ${{ env.ANDROID_NDK_MARKETING_VERSION }}
add-to-path: false
link-to-sdk: true

- name: Set NDK version (Unix)
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
run: |
export PATH="$PATH:$ANDROID_HOME/cmdline-tools/latest/bin"
./.github/scripts/install_ndk.sh ${ANDROID_NDK_VERSION}
export ANDROID_NDK_LATEST_HOME="${ANDROID_SDK_ROOT}/ndk/${ANDROID_NDK_VERSION}"
echo "ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME" >> $GITHUB_ENV
echo "ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME" >> $GITHUB_ENV

- name: Install/Set NDK version (Windows)
- name: Set NDK version (Windows)
if: contains(matrix.os, 'windows')
run: |
$env:PATH = "$env:PATH;$env:ANDROID_HOME\cmdline-tools\latest\bin"
./.github/scripts/install_ndk.bat $env:ANDROID_NDK_VERSION
$env:ANDROID_NDK_LATEST_HOME = "$env:ANDROID_SDK_ROOT\ndk\$env:ANDROID_NDK_VERSION"
Add-Content -Path $env:GITHUB_ENV -Value ANDROID_NDK_HOME=$env:ANDROID_NDK_LATEST_HOME
Add-Content -Path $env:GITHUB_ENV -Value ANDROID_NDK_ROOT=$env:ANDROID_NDK_LATEST_HOME
Expand Down
20 changes: 17 additions & 3 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,27 @@ jobs:
run: |
cargo install toml-cli
ANDROID_NDK_VERSION=$(toml get gradle/libs.versions.toml versions.ndk --raw)
ANDROID_NDK_MAJOR_VERSION=$(echo $ANDROID_NDK_VERSION | cut -f1 -d.)
ANDROID_NDK_MINOR_VERSION=$(echo $ANDROID_NDK_VERSION | cut -f2 -d.)
ANDROID_NDK_MARKETING_VERSION="r${ANDROID_NDK_MAJOR_VERSION}"
if ! [ "$ANDROID_NDK_MINOR_VERSION" == "0" ]; then
alphabet="abcdefghijklmnopqrstuvwxyz"
ANDROID_NDK_MARKETING_MINOR_VERSION=$(echo ${alphabet:$ANDROID_NDK_MINOR_VERSION:1})
ANDROID_NDK_MARKETING_VERSION="${ANDROID_NDK_MARKETING_VERSION}${ANDROID_NDK_MARKETING_MINOR_VERSION}"
fi
echo "ANDROID_NDK_VERSION=$ANDROID_NDK_VERSION" >> $GITHUB_ENV
echo "ANDROID_NDK_MARKETING_VERSION=$ANDROID_NDK_MARKETING_VERSION" >> $GITHUB_ENV
shell: bash

- name: Install/Set NDK version
- name: Setup Android NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: ${{ env.ANDROID_NDK_MARKETING_VERSION }}
add-to-path: false
link-to-sdk: true

- name: Set NDK version
run: |
export PATH="$PATH:$ANDROID_HOME/cmdline-tools/latest/bin"
./.github/scripts/install_ndk.sh ${ANDROID_NDK_VERSION}
./.github/scripts/purge_ndk.sh ${ANDROID_NDK_VERSION}
export ANDROID_NDK_LATEST_HOME="${ANDROID_SDK_ROOT}/ndk/${ANDROID_NDK_VERSION}"
echo "ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME" >> $GITHUB_ENV
Expand Down
34 changes: 30 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ jobs:
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
# CodeQL runs on Ubuntu which is a little tight on space
- name: Liberate disk space
uses: jlumbroso/free-disk-space@main
if: contains(runner.environment, 'github-hosted') && contains(runner.os, 'Linux')
with:
tool-cache: false
android: false
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: false

- name: Checkout repository
uses: actions/checkout@v6

Expand Down Expand Up @@ -100,15 +113,28 @@ jobs:
run: |
cargo install toml-cli
ANDROID_NDK_VERSION=$(toml get gradle/libs.versions.toml versions.ndk --raw)
ANDROID_NDK_MAJOR_VERSION=$(echo $ANDROID_NDK_VERSION | cut -f1 -d.)
ANDROID_NDK_MINOR_VERSION=$(echo $ANDROID_NDK_VERSION | cut -f2 -d.)
ANDROID_NDK_MARKETING_VERSION="r${ANDROID_NDK_MAJOR_VERSION}"
if ! [ "$ANDROID_NDK_MINOR_VERSION" == "0" ]; then
alphabet="abcdefghijklmnopqrstuvwxyz"
ANDROID_NDK_MARKETING_MINOR_VERSION=$(echo ${alphabet:$ANDROID_NDK_MINOR_VERSION:1})
ANDROID_NDK_MARKETING_VERSION="${ANDROID_NDK_MARKETING_VERSION}${ANDROID_NDK_MARKETING_MINOR_VERSION}"
fi
echo "ANDROID_NDK_VERSION=$ANDROID_NDK_VERSION" >> $GITHUB_ENV
echo "ANDROID_NDK_MARKETING_VERSION=$ANDROID_NDK_MARKETING_VERSION" >> $GITHUB_ENV
shell: bash

- name: Install/Set NDK version
- name: Setup Android NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: ${{ env.ANDROID_NDK_MARKETING_VERSION }}
add-to-path: false
link-to-sdk: true

- name: Set NDK version
if: matrix.build-mode == 'manual'
run: |
export PATH="$PATH:$ANDROID_HOME/cmdline-tools/latest/bin"
./.github/scripts/install_ndk.sh ${ANDROID_NDK_VERSION}
./.github/scripts/purge_ndk.sh ${ANDROID_NDK_VERSION}
export ANDROID_NDK_LATEST_HOME="${ANDROID_SDK_ROOT}/ndk/${ANDROID_NDK_VERSION}"
echo "ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME" >> $GITHUB_ENV
echo "ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME" >> $GITHUB_ENV
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/update_gradle_wrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,24 @@ jobs:
run: |
cargo install toml-cli
ANDROID_NDK_VERSION=$(toml get gradle/libs.versions.toml versions.ndk --raw)
ANDROID_NDK_MAJOR_VERSION=$(echo $ANDROID_NDK_VERSION | cut -f1 -d.)
ANDROID_NDK_MINOR_VERSION=$(echo $ANDROID_NDK_VERSION | cut -f2 -d.)
ANDROID_NDK_MARKETING_VERSION="r${ANDROID_NDK_MAJOR_VERSION}"
if ! [ "$ANDROID_NDK_MINOR_VERSION" == "0" ]; then
alphabet="abcdefghijklmnopqrstuvwxyz"
ANDROID_NDK_MARKETING_MINOR_VERSION=$(echo ${alphabet:$ANDROID_NDK_MINOR_VERSION:1})
ANDROID_NDK_MARKETING_VERSION="${ANDROID_NDK_MARKETING_VERSION}${ANDROID_NDK_MARKETING_MINOR_VERSION}"
fi
echo "ANDROID_NDK_VERSION=$ANDROID_NDK_VERSION" >> $GITHUB_ENV
echo "ANDROID_NDK_MARKETING_VERSION=$ANDROID_NDK_MARKETING_VERSION" >> $GITHUB_ENV
shell: bash

# COULD_BE_BETTER: Consider turning this into a GitHub action - help the wider community
# NDK install (unzipping) is really noisy - silence the log spam with grep, while keeping errors
- name: Install NDK (silent)
run: .github/scripts/install_ndk.sh $ANDROID_NDK_VERSION
- name: Setup Android NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: ${{ env.ANDROID_NDK_MARKETING_VERSION }}
add-to-path: false
link-to-sdk: true

- name: Update Gradle Wrapper
uses: gradle-update/update-gradle-wrapper-action@v2
Expand Down