CI: move freebsd & android jobs in separate workflows

This because they are intermittent. When reviewing,
I wish we didn't have to scroll to check that it is indeed
freebsd or android failing.
This commit is contained in:
Sylvestre Ledru 2023-03-25 10:00:52 +01:00
parent 74b54074e1
commit a141729113
3 changed files with 162 additions and 140 deletions

View file

@ -1027,146 +1027,6 @@ jobs:
name: toybox-result.json
path: ${{ steps.vars.outputs.TEST_SUMMARY_FILE }}
test_android:
name: Test Android builds
needs: [ min_version, deps ]
runs-on: macos-latest
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
api-level: [28]
target: [default]
arch: [x86] # , arm64-v8a
env:
TERMUX: v0.118.0
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.3
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/avd/*/snapshots/*
~/.android/adb*
key: avd-${{ matrix.api-level }}-${{ matrix.arch }}+termux-${{ env.TERMUX }}
- name: Create and cache emulator image
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
ram-size: 2048M
disk-size: 5120M
force-avd-creation: true
emulator-options: -no-snapshot-load -noaudio -no-boot-anim -camera-back none
script: |
wget https://github.com/termux/termux-app/releases/download/${{ env.TERMUX }}/termux-app_${{ env.TERMUX }}+github-debug_${{ matrix.arch }}.apk
util/android-commands.sh snapshot termux-app_${{ env.TERMUX }}+github-debug_${{ matrix.arch }}.apk
adb -s emulator-5554 emu avd snapshot save ${{ matrix.api-level }}-${{ matrix.arch }}+termux-${{ env.TERMUX }}
echo "Emulator image created."
pkill -9 qemu-system-x86_64
- name: Build and Test on Android
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
ram-size: 2048M
disk-size: 5120M
force-avd-creation: false
emulator-options: -no-snapshot-save -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -snapshot ${{ matrix.api-level }}-${{ matrix.arch }}+termux-${{ env.TERMUX }}
script: |
util/android-commands.sh sync
util/android-commands.sh build
util/android-commands.sh tests
test_freebsd:
name: Tests/FreeBSD test suite
needs: [ min_version, deps ]
runs-on: ${{ matrix.job.os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
job:
- { os: macos-12 , features: unix } ## GHA MacOS-11.0 VM won't have VirtualBox; refs: <https://github.com/actions/virtual-environments/issues/4060> , <https://github.com/actions/virtual-environments/pull/4010>
env:
mem: 4096
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.3
- name: Prepare, build and test
## spell-checker:ignore (ToDO) sshfs usesh vmactions
uses: vmactions/freebsd-vm@v0.3.0
with:
usesh: true
# sync: sshfs
prepare: pkg install -y curl gmake sudo
run: |
## Prepare, build, and test
# implementation modelled after ref: <https://github.com/rust-lang/rustup/pull/2783>
# * NOTE: All steps need to be run in this block, otherwise, we are operating back on the mac host
set -e
#
# We need a file-descriptor file system to test test_ls::test_ls_io_errors
mount -t fdescfs fdesc /dev/fd
#
TEST_USER=tester
REPO_NAME=${GITHUB_WORKSPACE##*/}
WORKSPACE_PARENT="/Users/runner/work/${REPO_NAME}"
WORKSPACE="${WORKSPACE_PARENT}/${REPO_NAME}"
#
pw adduser -n ${TEST_USER} -d /root/ -g wheel -c "Coreutils user to build" -w random
# chown -R ${TEST_USER}:wheel /root/ "${WORKSPACE_PARENT}"/
chown -R ${TEST_USER}:wheel /root/ "/Users/runner/work/${REPO_NAME}"/
whoami
#
# Further work needs to be done in a sudo as we are changing users
sudo -i -u ${TEST_USER} sh << EOF
set -e
whoami
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile=minimal
. $HOME/.cargo/env
## Info
# environment
echo "## environment"
echo "CI='${CI}'"
echo "REPO_NAME='${REPO_NAME}'"
echo "TEST_USER='${TEST_USER}'"
echo "WORKSPACE_PARENT='${WORKSPACE_PARENT}'"
echo "WORKSPACE='${WORKSPACE}'"
env | sort
# tooling info
echo "## tooling info"
cargo -V
rustc -V
#
# To ensure that files are cleaned up, we don't want to exit on error
set +e
cd "${WORKSPACE}"
unset FAULT
cargo build || FAULT=1
export RUST_BACKTRACE=1
if (test -z "\$FAULT"); then cargo test --features '${{ matrix.job.features }}' || FAULT=1 ; fi
if (test -z "\$FAULT"); then cargo test --all-features -p uucore || FAULT=1 ; fi
# Clean to avoid to rsync back the files
cargo clean
if (test -n "\$FAULT"); then exit 1 ; fi
EOF
coverage:
name: Code Coverage
runs-on: ${{ matrix.job.os }}

72
.github/workflows/android.yml vendored Normal file
View file

@ -0,0 +1,72 @@
name: Android
on: [push, pull_request]
permissions:
contents: read # to fetch code (actions/checkout)
# End the current execution if there is a new changeset in the PR.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
test_android:
name: Test Android builds
runs-on: macos-latest
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
api-level: [28]
target: [default]
arch: [x86] # , arm64-v8a
env:
TERMUX: v0.118.0
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.3
- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/avd/*/snapshots/*
~/.android/adb*
key: avd-${{ matrix.api-level }}-${{ matrix.arch }}+termux-${{ env.TERMUX }}
- name: Create and cache emulator image
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
ram-size: 2048M
disk-size: 5120M
force-avd-creation: true
emulator-options: -no-snapshot-load -noaudio -no-boot-anim -camera-back none
script: |
wget https://github.com/termux/termux-app/releases/download/${{ env.TERMUX }}/termux-app_${{ env.TERMUX }}+github-debug_${{ matrix.arch }}.apk
util/android-commands.sh snapshot termux-app_${{ env.TERMUX }}+github-debug_${{ matrix.arch }}.apk
adb -s emulator-5554 emu avd snapshot save ${{ matrix.api-level }}-${{ matrix.arch }}+termux-${{ env.TERMUX }}
echo "Emulator image created."
pkill -9 qemu-system-x86_64
- name: Build and Test on Android
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
ram-size: 2048M
disk-size: 5120M
force-avd-creation: false
emulator-options: -no-snapshot-save -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -snapshot ${{ matrix.api-level }}-${{ matrix.arch }}+termux-${{ env.TERMUX }}
script: |
util/android-commands.sh sync
util/android-commands.sh build
util/android-commands.sh tests

90
.github/workflows/freebsd.yml vendored Normal file
View file

@ -0,0 +1,90 @@
name: FreeBSD
on: [push, pull_request]
permissions:
contents: read # to fetch code (actions/checkout)
# End the current execution if there is a new changeset in the PR.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
test_freebsd:
name: Tests/FreeBSD test suite
runs-on: ${{ matrix.job.os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
job:
- { os: macos-12 , features: unix } ## GHA MacOS-11.0 VM won't have VirtualBox; refs: <https://github.com/actions/virtual-environments/issues/4060> , <https://github.com/actions/virtual-environments/pull/4010>
env:
mem: 4096
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.3
- name: Prepare, build and test
## spell-checker:ignore (ToDO) sshfs usesh vmactions
uses: vmactions/freebsd-vm@v0.3.0
with:
usesh: true
# sync: sshfs
prepare: pkg install -y curl gmake sudo
run: |
## Prepare, build, and test
# implementation modelled after ref: <https://github.com/rust-lang/rustup/pull/2783>
# * NOTE: All steps need to be run in this block, otherwise, we are operating back on the mac host
set -e
#
# We need a file-descriptor file system to test test_ls::test_ls_io_errors
mount -t fdescfs fdesc /dev/fd
#
TEST_USER=tester
REPO_NAME=${GITHUB_WORKSPACE##*/}
WORKSPACE_PARENT="/Users/runner/work/${REPO_NAME}"
WORKSPACE="${WORKSPACE_PARENT}/${REPO_NAME}"
#
pw adduser -n ${TEST_USER} -d /root/ -g wheel -c "Coreutils user to build" -w random
# chown -R ${TEST_USER}:wheel /root/ "${WORKSPACE_PARENT}"/
chown -R ${TEST_USER}:wheel /root/ "/Users/runner/work/${REPO_NAME}"/
whoami
#
# Further work needs to be done in a sudo as we are changing users
sudo -i -u ${TEST_USER} sh << EOF
set -e
whoami
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile=minimal
. $HOME/.cargo/env
## Info
# environment
echo "## environment"
echo "CI='${CI}'"
echo "REPO_NAME='${REPO_NAME}'"
echo "TEST_USER='${TEST_USER}'"
echo "WORKSPACE_PARENT='${WORKSPACE_PARENT}'"
echo "WORKSPACE='${WORKSPACE}'"
env | sort
# tooling info
echo "## tooling info"
cargo -V
rustc -V
#
# To ensure that files are cleaned up, we don't want to exit on error
set +e
cd "${WORKSPACE}"
unset FAULT
cargo build || FAULT=1
export RUST_BACKTRACE=1
if (test -z "\$FAULT"); then cargo test --features '${{ matrix.job.features }}' || FAULT=1 ; fi
if (test -z "\$FAULT"); then cargo test --all-features -p uucore || FAULT=1 ; fi
# Clean to avoid to rsync back the files
cargo clean
if (test -n "\$FAULT"); then exit 1 ; fi
EOF