Update Rust to 1.81 following CVE #707
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 quick (each platform) | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * *" | |
pull_request: | |
branches: | |
- "**" | |
push: | |
branches: | |
- main | |
env: | |
DEBUG: 1 | |
ANDROID_NDK_VERSION: "27.0.12077973" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-14] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 80 | |
steps: | |
- name: Liberate disk space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
if: contains(matrix.os, 'ubuntu') | |
with: | |
tool-cache: false | |
android: false | |
dotnet: true | |
haskell: true | |
large-packages: false | |
docker-images: true | |
swap-storage: false | |
- uses: actions/checkout@v4 | |
- name: Enable KVM group perms (Ubuntu) | |
if: contains(matrix.os, 'ubuntu') | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Fetch submodules | |
run: git submodule update --init | |
- name: Install/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) | |
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 | |
- name: Configure JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: "21" # matches Anki-Android | |
- name: Restore Rust Cache (Windows) | |
uses: actions/cache/restore@v4 | |
if: contains(matrix.os, 'windows') | |
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@v4 | |
if: contains(matrix.os, 'windows') == false | |
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 N2 | |
run: bash ./anki/tools/install-n2 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
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) | |
# Ubuntu currently requires multiple build attempts before it succeeds - it builds a little further each time then works | |
# This happens the same way every time in CI so far, and is reproducible locally if you have an Ubuntu system | |
# This needs a root-cause analysis (see #373) but we will use a retry hack for Ubuntu only to unblock PRs until that is done | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 30 | |
max_attempts: ${{ contains(matrix.os, 'ubuntu') == true && 5 || 1 }} | |
retry_wait_seconds: 0 | |
retry_on: error | |
command: cargo run -p build_rust | |
- name: Check Rust (Unix) | |
if: contains(matrix.os, 'windows') == false | |
run: ./check-rust.sh | |
- name: Check Rust (Windows) | |
if: contains(matrix.os, 'windows') | |
run: ./check-rust.bat | |
- name: Run tests (Unit) | |
uses: gradle/gradle-build-action@v3 | |
with: | |
arguments: test rsdroid:lint --daemon | |
- name: Run tests (Emulator) | |
uses: reactivecircus/android-emulator-runner@v2 | |
if: contains(matrix.os, 'ubuntu') | |
timeout-minutes: 30 | |
with: | |
api-level: 23 | |
target: default | |
arch: x86_64 | |
profile: Nexus 6 | |
script: ./gradlew rsdroid-instrumented:connectedCheck | |
- name: Upload rsdroid AAR as artifact | |
uses: actions/upload-artifact@v4 | |
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@v4 | |
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@v4 | |
if: contains(matrix.os, 'windows') && 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@v4 | |
if: contains(matrix.os, 'windows') == false && 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') }} |