Skip to content

Switch to NDK 26; don't rely on broken runner defaults #50

Switch to NDK 26; don't rely on broken runner defaults

Switch to NDK 26; don't rely on broken runner defaults #50

Workflow file for this run

name: Build quick (each platform)
on:
workflow_dispatch:
push:
schedule:
- cron: "0 0 * * *"
pull_request:
env:
DEBUG: 1
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13]
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 80
steps:
- uses: actions/checkout@v3
- name: Fetch submodules
run: git submodule update --init
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.11.1
# The action puts a relative path on the PATH 🙄
- name: Make path absolute
if: matrix.os != 'windows-latest'
run: echo $(pwd)/ninja_bin >> $GITHUB_PATH
- name: Make path absolute
if: matrix.os == 'windows-latest'
run: |
$CurrentPath = (Get-Location).Path
$NewPath = "${CurrentPath}/ninja_bin"
Add-Content -Path $env:GITHUB_PATH -Value $NewPath
- name: Set NDK version
if: matrix.os != 'windows-latest'
run: echo "ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME" >> $GITHUB_ENV
- name: Set NDK version
if: matrix.os == 'windows-latest'
run: Add-Content -Path $env:GITHUB_ENV -Value ANDROID_NDK_HOME=$env:ANDROID_NDK_LATEST_HOME
- name: Configure JDK
uses: actions/setup-java@v3
with:
distribution: "adopt"
java-version: "17" # matches Anki-Android
- name: Restore Rust Cache (Windows)
uses: actions/cache/restore@v3
if: matrix.os == 'windows-latest'
with:
path: |
~/.cargo/registry
~/.cargo/git
target
anki/out/rust
anki/out/download
# no node_modules, as it doesn't unpack properly
key: ${{ runner.os }}-rust-debug-v7-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('anki/yarn.lock') }}
restore-keys: |
${{ runner.os }}-rust-debug-v7
- name: Restore Rust Cache (Unix)
uses: actions/cache/restore@v3
if: matrix.os != 'windows-latest'
with:
path: |
~/.cargo/registry
~/.cargo/git
target
anki/out/rust
anki/out/download
anki/out/node_modules
key: ${{ runner.os }}-rust-debug-v6-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('anki/yarn.lock') }}
restore-keys: |
${{ runner.os }}-rust-debug-v6
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
timeout-minutes: 5
with:
# Only write to the cache for builds on the 'main' branches, stops branches evicting main cache
# Builds on other branches will only read from main branch cache writes
# Comment this and the with: above out for performance testing on a branch
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
gradle-home-cache-cleanup: true
- name: Build all (current platform)
run: cargo run -p build_rust
- name: Check Rust (Linux)
if: matrix.os == 'ubuntu-latest'
run: ./check-rust.sh
- name: Run tests (Mac)
uses: reactivecircus/android-emulator-runner@v2
if: matrix.os == 'macos-13'
timeout-minutes: 30
with:
api-level: 23
target: default
arch: x86_64
profile: Nexus 6
script: ./check-droid.sh
- name: Upload rsdroid AAR as artifact
uses: actions/upload-artifact@v3
with:
name: rsdroid-aar-${{ matrix.os }}
if-no-files-found: error
path: rsdroid/build/outputs/aar
- name: Upload rsdroid-robo JAR as artifact
uses: actions/upload-artifact@v3
with:
name: rsdroid-robo-${{ matrix.os }}
if-no-files-found: error
path: rsdroid-testing/build/libs
- name: Save Rust Cache (Windows)
uses: actions/cache/save@v3
if: matrix.os == 'windows-latest' && github.ref == 'refs/heads/main'
with:
path: |
~/.cargo/registry
~/.cargo/git
target
anki/out/rust
anki/out/download
# no node_modules, as it doesn't unpack properly
key: ${{ runner.os }}-rust-debug-v7-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('anki/yarn.lock') }}
- name: Save Rust Cache (Unix)
uses: actions/cache/save@v3
if: matrix.os != 'windows-latest' && github.ref == 'refs/heads/main'
with:
path: |
~/.cargo/registry
~/.cargo/git
target
anki/out/rust
anki/out/download
anki/out/node_modules
key: ${{ runner.os }}-rust-debug-v6-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('anki/yarn.lock') }}