chore: update ndk to r26d #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
use-cache: | |
type: boolean | |
default: true | |
description: Use binary cache | |
jobs: | |
build-maadeps: | |
strategy: | |
matrix: | |
os: [ubuntu, windows, macos] | |
arch: [x64, arm64] | |
include: | |
- os: ubuntu | |
arch: arm64-android | |
- os: ubuntu | |
arch: arm-android | |
- os: ubuntu | |
arch: arm-neon-android | |
# clang-17: error: unsupported argument 'i686' to option '-march=' | |
# https://github.com/MaaAssistantArknights/MaaDeps/actions/runs/7285060481/job/19851366697 | |
# - os: ubuntu | |
# arch: x64-android | |
fail-fast: false | |
defaults: | |
run: | |
shell: bash | |
runs-on: ${{ matrix.os }}-latest | |
timeout-minutes: 720 | |
steps: | |
- name: Windows runner hack | |
if: runner.os == 'Windows' | |
shell: cmd | |
run: | | |
dir d:\a | |
cd .. | |
mkdir C:\MaaDeps | |
rmdir MaaDeps | |
mklink /j MaaDeps C:\MaaDeps | |
dism /Online /Disable-Feature /FeatureName:Windows-Defender /Remove /NoRestart /Quiet | |
cd . | |
- name: Windows runner hack (2) | |
if: runner.os == 'Windows' | |
uses: al-cheb/[email protected] | |
with: | |
minimum-size: 16GB | |
maximum-size: 16GB | |
disk-root: "D:" | |
- uses: actions/checkout@v3 | |
with: | |
submodules: "recursive" | |
- name: Install Packages on Linux | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y ninja-build python3-pyelftools elfutils patchelf nasm | |
- name: Install Cross-Compiler for Linux | |
if: runner.os == 'Linux' && matrix.arch == 'arm64' | |
run: | | |
sudo apt install crossbuild-essential-arm64 | |
- uses: nttld/setup-ndk@v1 | |
if: contains(matrix.arch, 'android') | |
id: setup-ndk | |
with: | |
ndk-version: r26d | |
add-to-path: false | |
# # https://github.com/microsoft/vcpkg/issues/31332 | |
# - name: Fix Android LDFLAGS error | |
# if: contains(matrix.arch, 'android') | |
# run: | | |
# git -C vcpkg apply ../vcpkg-overlay/scripts/remove_avoid-version.patch | |
- name: Install Packages on MacOS | |
if: runner.os == 'macOS' | |
run: | | |
brew update | |
brew install ccache ninja pkg-config nasm bison | |
brew install bash gnu-sed gnu-tar | |
echo "$(brew --prefix)/opt/gnu-sed/libexec/gnubin" >> $GITHUB_PATH | |
echo "$(brew --prefix)/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH | |
brew unlink python | |
brew link --overwrite python | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
vcpkg/downloads/ | |
key: cache-downloads-${{ matrix.os }}-${{ matrix.arch }}-${{ hashfiles('vcpkg-overlay', 'vcpkg*.json') }} | |
# no symbols if installed from binary archive | |
# - uses: actions/cache/restore@v3 | |
# if: github.event.inputs.use-cache | |
# with: | |
# path: | | |
# vcpkg/archives/ | |
# key: cache-${{ matrix.os }}-${{ matrix.arch }}-${{ hashfiles('vcpkg-overlay') }} | |
# # this should work on both bash and pwsh, and giving native path on windows | |
# - run: | | |
# mkdir -p vcpkg/archives | |
# echo "VCPKG_DEFAULT_BINARY_CACHE=$PWD/vcpkg/archives" >> $GITHUB_ENV | |
- uses: ilammy/msvc-dev-cmd@v1 | |
if: matrix.os == 'windows' | |
id: msvc-env | |
with: | |
arch: amd64${{ matrix.arch != 'x64' && format('_{0}', matrix.arch) || '' }} | |
- name: Setup MSVC environment | |
if: matrix.os == 'windows' | |
run: | | |
echo "CC=cl" >> $GITHUB_ENV | |
echo "CXX=cl" >> $GITHUB_ENV | |
- name: Setup ccache | |
uses: Chocobo1/setup-ccache-action@v1 | |
with: | |
windows_compile_environment: msvc | |
# vcpkg will clean environment so that ccache is not used anyway | |
# - name: post-setup cache (windows) | |
# if: runner.os == 'Windows' | |
# shell: cmd | |
# run: | | |
# echo "PATH=%ccache_symlinks_path%;%PATH%" >> %GITHUB_ENV% | |
# - name: enable NTFS compression (windows) | |
# if: runner.os == 'Windows' | |
# shell: cmd | |
# run: | | |
# compact /c /q vcpkg | |
- name: Set target | |
run: | | |
lower() { printf '%s\n' "${1,,}"; } | |
if [[ "${{matrix.arch}}" == *"android"* ]]; then | |
echo "TARGET=${{ matrix.arch }}" >> $GITHUB_ENV | |
else | |
export RUNNER_OS=$(lower ${{runner.os}}) | |
export OS=$(echo $RUNNER_OS | sed 's/macOS/osx/I') | |
echo "TARGET=${{ matrix.arch }}-${OS}" >> $GITHUB_ENV | |
fi | |
- name: Set OBJCOPY for arm64-linux | |
if: matrix.arch == 'arm64' && matrix.os == 'ubuntu' | |
run: | | |
echo "OBJCOPY=aarch64-linux-gnu-objcopy" >> $GITHUB_ENV | |
- name: Build MaaDeps | |
env: | |
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
run: | | |
for attempt in 1 2 3 | |
do | |
python3 build.py --tarball --target maa-$TARGET -- $MAA_CMAKE_ARGS && break | |
# delete object and archive files (of already installed packages) and retry | |
shopt -s globstar nullglob | |
df -lh | |
rm -f vcpkg/buildtrees/**/*.{o,obj,a,lib} | |
df -lh | |
du -sh vcpkg/buildtrees/* | |
[[ $attempt != 3 ]] # fail on last attempt | |
done | |
- name: Collect Logs | |
if: always() | |
run: | | |
shopt -s globstar | |
tar caf logs.tar --ignore-failed-read vcpkg/buildtrees/**/*.log | |
- name: Upload Logs | |
uses: actions/[email protected] | |
if: always() | |
with: | |
name: logs-${{ env.TARGET }} | |
path: logs.tar | |
- name: Upload Artifact | |
uses: actions/[email protected] | |
with: | |
name: tarball-${{ env.TARGET }} | |
path: tarball | |
- name: release | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAG_NAME: ${{ github.ref_name }} | |
shell: bash | |
run: | | |
gh release create "$TAG_NAME" --prerelease || true # accept existing release | |
gh release upload "$TAG_NAME" tarball/* | |
# - name: cache binary archives | |
# uses: actions/cache/save@v3 | |
# if: github.event.inputs.use-cache | |
# with: | |
# path: | | |
# vcpkg/archives/ | |
# key: cache-${{ matrix.os }}-${{ matrix.arch }}-${{ hashfiles('vcpkg-overlay') }} |