squash commit

This commit is contained in:
Ulrich Hornung
2024-02-03 17:08:39 +01:00
parent b485a480cf
commit 93d922f075
5 changed files with 483 additions and 133 deletions
+60 -13
View File
@@ -17,20 +17,55 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
TERMUX: v0.118.0
KEY_POSTFIX: nextest+rustc-hash+adb+sshd+upgrade+XGB+inc15
COMMON_EMULATOR_OPTIONS: -no-window -noaudio -no-boot-anim -camera-back none -gpu swiftshader_indirect
EMULATOR_DISK_SIZE: 12GB
EMULATOR_HEAP_SIZE: 2048M
EMULATOR_BOOT_TIMEOUT: 1200 # 20min
jobs:
test_android:
name: Test builds
runs-on: macos-latest
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] # , macos-latest
cores: [4] # , 6
ram: [4096, 8192]
api-level: [28]
target: [default]
arch: [x86, x86_64] # , arm64-v8a
exclude:
- ram: 8192
arch: x86
- ram: 4096
arch: x86_64
runs-on: ${{ matrix.os }}
env:
TERMUX: v0.118.0
EMULATOR_RAM_SIZE: ${{ matrix.ram }}
EMULATOR_CORES: ${{ matrix.cores }}
RUNNER_OS: ${{ matrix.os }}
AVD_CACHE_KEY: "set later due to limitations of github actions not able to concatenate env variables"
steps:
- name: Concatenate values to environment file
run: |
echo "AVD_CACHE_KEY=${{ matrix.os }}-${{ matrix.cores }}-${{ matrix.ram }}-${{ matrix.api-level }}-${{ matrix.target }}-${{ matrix.arch }}+termux-${{ env.TERMUX }}+${{ env.KEY_POSTFIX }}" >> $GITHUB_ENV
- name: Collect information about runner
run: |
hostname
uname -a
free -mh
df -h
cat /proc/cpuinfo
- name: Enable KVM group perms (linux hardware acceleration)
if: ${{ runner.os == 'Linux' }}
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
- uses: actions/checkout@v4
- name: Restore AVD cache
uses: actions/cache/restore@v4
@@ -41,7 +76,7 @@ jobs:
~/.android/avd/*/snapshots/*
~/.android/adb*
~/__rustc_hash__
key: avd-${{ matrix.api-level }}-${{ matrix.arch }}+termux-${{ env.TERMUX }}+nextest+rustc-hash
key: avd-${{ env.AVD_CACHE_KEY }}
- name: Delete AVD Lockfile when run from cache
if: steps.avd-cache.outputs.cache-hit == 'true'
run: |
@@ -50,15 +85,18 @@ jobs:
~/.android/avd/*/*.lock
- name: Create and cache emulator image
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
uses: reactivecircus/android-emulator-runner@v2.30.1
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
ram-size: 2048M
disk-size: 7GB
ram-size: ${{ env.EMULATOR_RAM_SIZE }}
heap-size: ${{ env.EMULATOR_HEAP_SIZE }}
disk-size: ${{ env.EMULATOR_DISK_SIZE }}
cores: ${{ env.EMULATOR_CORES }}
force-avd-creation: true
emulator-options: -no-window -no-snapshot-load -noaudio -no-boot-anim -camera-back none
emulator-options: ${{ env.COMMON_EMULATOR_OPTIONS }} -no-snapshot-load
emulator-boot-timeout: ${{ env.EMULATOR_BOOT_TIMEOUT }}
script: |
util/android-commands.sh init "${{ matrix.arch }}" "${{ matrix.api-level }}" "${{ env.TERMUX }}"
- name: Save AVD cache
@@ -70,12 +108,12 @@ jobs:
~/.android/avd/*/snapshots/*
~/.android/adb*
~/__rustc_hash__
key: avd-${{ matrix.api-level }}-${{ matrix.arch }}+termux-${{ env.TERMUX }}+nextest+rustc-hash
key: avd-${{ env.AVD_CACHE_KEY }}
- uses: juliangruber/read-file-action@v1
id: read_rustc_hash
with:
# ~ expansion didn't work
path: /Users/runner/__rustc_hash__
path: ${{ runner.os == 'Linux' && '/home/runner/__rustc_hash__' || '/Users/runner/__rustc_hash__' }}
trim: true
- name: Restore rust cache
id: rust-cache
@@ -86,15 +124,18 @@ jobs:
# the github cache during the development of this workflow
key: ${{ matrix.arch }}_${{ matrix.target}}_${{ steps.read_rustc_hash.outputs.content }}_${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}_v3
- name: Build and Test
uses: reactivecircus/android-emulator-runner@v2
uses: reactivecircus/android-emulator-runner@v2.30.1
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
ram-size: 2048M
disk-size: 7GB
ram-size: ${{ env.EMULATOR_RAM_SIZE }}
heap-size: ${{ env.EMULATOR_HEAP_SIZE }}
disk-size: ${{ env.EMULATOR_DISK_SIZE }}
cores: ${{ env.EMULATOR_CORES }}
force-avd-creation: false
emulator-options: -no-window -no-snapshot-save -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -snapshot ${{ matrix.api-level }}-${{ matrix.arch }}+termux-${{ env.TERMUX }}
emulator-options: ${{ env.COMMON_EMULATOR_OPTIONS }} -no-snapshot-save -snapshot ${{ env.AVD_CACHE_KEY }}
emulator-boot-timeout: ${{ env.EMULATOR_BOOT_TIMEOUT }}
# This is not a usual script. Every line is executed in a separate shell with `sh -c`. If
# one of the lines returns with error the whole script is failed (like running a script with
# set -e) and in consequences the other lines (shells) are not executed.
@@ -109,3 +150,9 @@ jobs:
with:
path: ~/__rust_cache__
key: ${{ matrix.arch }}_${{ matrix.target}}_${{ steps.read_rustc_hash.outputs.content }}_${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}_v3
- name: archive any output (error screenshots)
if: always()
uses: actions/upload-artifact@v4
with:
name: test_output_${{ env.AVD_CACHE_KEY }}
path: output
+8 -4
View File
@@ -664,7 +664,7 @@ impl FsMeta for StatFs {
any(
target_arch = "s390x",
target_vendor = "apple",
target_os = "android",
all(target_os = "android", target_pointer_width = "32"),
target_os = "openbsd",
not(target_pointer_width = "64")
)
@@ -675,7 +675,8 @@ impl FsMeta for StatFs {
target_os = "freebsd",
target_os = "illumos",
target_os = "solaris",
target_os = "redox"
target_os = "redox",
all(target_os = "android", target_pointer_width = "64"),
))]
return self.f_bsize.try_into().unwrap();
}
@@ -741,14 +742,17 @@ impl FsMeta for StatFs {
not(target_env = "musl"),
any(
target_vendor = "apple",
target_os = "android",
all(target_os = "android", target_pointer_width = "32"),
target_os = "freebsd",
target_arch = "s390x",
not(target_pointer_width = "64")
)
))]
return self.f_type.into();
#[cfg(target_env = "musl")]
#[cfg(any(
target_env = "musl",
all(target_os = "android", target_pointer_width = "64"),
))]
return self.f_type.try_into().unwrap();
}
#[cfg(not(any(
+354 -116
View File
File diff suppressed because it is too large Load Diff
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
# spell-checker:ignore nextest watchplus PIPESTATUS
echo "$HOME"
PATH=$HOME/.cargo/bin:$PATH
export PATH
echo "$PATH"
pwd
command -v rustc && rustc -Vv
ls -la ~/.cargo/bin
cargo --list
cargo nextest --version
+48
View File
@@ -0,0 +1,48 @@
#!/bin/bash
# spell-checker:ignore nextest watchplus PIPESTATUS
echo "PATH: $PATH"
export PATH=$HOME/.cargo/bin:$PATH
export RUST_BACKTRACE=1
export CARGO_TERM_COLOR=always
export CARGO_INCREMENTAL=0
echo "PATH: $PATH"
run_tests_in_subprocess() (
# limit virtual memory to 3GB to avoid that OS kills sshd
ulimit -v $((1024 * 1024 * 3))
watchplus() {
# call: watchplus <interval> <command>
while true; do
"${@:2}"
sleep "$1"
done
}
kill_all_background_jobs() {
jobs -p | xargs -I{} kill -- {}
}
# observe (log) every 2 seconds the system resource usage to judge if we are at a limit
watchplus 2 df -h &
watchplus 2 free -hm &
# run tests
cd ~/coreutils && \
timeout --preserve-status --verbose -k 1m 60m \
cargo nextest run --profile ci --hide-progress-bar --features feat_os_unix_android
result=$?
kill_all_background_jobs
return $result
)
# run sub-shell to be able to use ulimit without affecting the sshd
run_tests_in_subprocess