mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 12:37:49 +00:00
maint/CICD ~ (GHA) normalize setup sub-step ordering
This commit is contained in:
parent
f07a1749a1
commit
39a6e6c75b
1 changed files with 68 additions and 35 deletions
103
.github/workflows/CICD.yml
vendored
103
.github/workflows/CICD.yml
vendored
|
@ -37,8 +37,6 @@ jobs:
|
||||||
- { os: windows-latest , features: feat_os_windows }
|
- { os: windows-latest , features: feat_os_windows }
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
## note: requires 'nightly' toolchain b/c `cargo-udeps` uses the `rustc` '-Z save-analysis' option
|
|
||||||
## * ... ref: <https://github.com/est31/cargo-udeps/issues/73>
|
|
||||||
- name: Initialize workflow variables
|
- name: Initialize workflow variables
|
||||||
id: vars
|
id: vars
|
||||||
shell: bash
|
shell: bash
|
||||||
|
@ -56,6 +54,8 @@ jobs:
|
||||||
CARGO_FEATURES_OPTION='' ;
|
CARGO_FEATURES_OPTION='' ;
|
||||||
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi
|
if [ -n "${{ matrix.job.features }}" ]; then CARGO_FEATURES_OPTION='--features "${{ matrix.job.features }}"' ; fi
|
||||||
outputs CARGO_FEATURES_OPTION
|
outputs CARGO_FEATURES_OPTION
|
||||||
|
## note: requires 'nightly' toolchain b/c `cargo-udeps` uses the `rustc` '-Z save-analysis' option
|
||||||
|
## * ... ref: <https://github.com/est31/cargo-udeps/issues/73>
|
||||||
- name: Install `rust` toolchain
|
- name: Install `rust` toolchain
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
|
@ -351,17 +351,17 @@ jobs:
|
||||||
- { os: ubuntu-latest , features: feat_os_unix }
|
- { os: ubuntu-latest , features: feat_os_unix }
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install/setup prerequisites
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
## Install/setup prerequisites
|
||||||
|
sudo apt-get -y update ; sudo apt-get -y install python3-sphinx ;
|
||||||
- name: Install `rust` toolchain
|
- name: Install `rust` toolchain
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
default: true
|
default: true
|
||||||
profile: minimal # minimal component installation (ie, no documentation)
|
profile: minimal # minimal component installation (ie, no documentation)
|
||||||
- name: Install/setup prerequisites
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
## Install/setup prerequisites
|
|
||||||
sudo apt-get -y update ; sudo apt-get -y install python3-sphinx ;
|
|
||||||
- name: "`make build`"
|
- name: "`make build`"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
@ -502,6 +502,17 @@ jobs:
|
||||||
mkdir -p '${{ steps.vars.outputs.STAGING }}'
|
mkdir -p '${{ steps.vars.outputs.STAGING }}'
|
||||||
mkdir -p '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}'
|
mkdir -p '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}'
|
||||||
mkdir -p '${{ steps.vars.outputs.STAGING }}/dpkg'
|
mkdir -p '${{ steps.vars.outputs.STAGING }}/dpkg'
|
||||||
|
- name: Install/setup prerequisites
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
## Install/setup prerequisites
|
||||||
|
case '${{ matrix.job.target }}' in
|
||||||
|
arm-unknown-linux-gnueabihf) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
|
||||||
|
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
|
||||||
|
esac
|
||||||
|
case '${{ matrix.job.os }}' in
|
||||||
|
macos-latest) brew install coreutils ;; # needed for testing
|
||||||
|
esac
|
||||||
- name: rust toolchain ~ install
|
- name: rust toolchain ~ install
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
# env:
|
# env:
|
||||||
|
@ -632,16 +643,17 @@ jobs:
|
||||||
- { os: ubuntu-latest }
|
- { os: ubuntu-latest }
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install/setup prerequisites
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
## Install/setup prerequisites
|
||||||
|
make prepare-busytest
|
||||||
- name: Install `rust` toolchain
|
- name: Install `rust` toolchain
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
default: true
|
default: true
|
||||||
profile: minimal # minimal component installation (ie, no documentation)
|
profile: minimal # minimal component installation (ie, no documentation)
|
||||||
- name: Install/setup prerequisites
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
make prepare-busytest
|
|
||||||
- name: "Run BusyBox test suite"
|
- name: "Run BusyBox test suite"
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
@ -654,48 +666,69 @@ jobs:
|
||||||
if [ $n_fails -gt 0 ] ; then echo "::warning ::${n_fails}+ test failures" ; fi
|
if [ $n_fails -gt 0 ] ; then echo "::warning ::${n_fails}+ test failures" ; fi
|
||||||
|
|
||||||
test_freebsd:
|
test_freebsd:
|
||||||
runs-on: macos-10.15
|
|
||||||
name: Tests/FreeBSD test suite
|
name: Tests/FreeBSD test suite
|
||||||
|
runs-on: ${{ matrix.job.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
job:
|
||||||
|
- { os: macos-10.15 , 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:
|
env:
|
||||||
mem: 2048
|
mem: 2048
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Prepare, build and test
|
- name: Prepare, build and test
|
||||||
id: test
|
## spell-checker:ignore (ToDO) sshfs usesh vmactions
|
||||||
uses: vmactions/freebsd-vm@v0.1.5
|
uses: vmactions/freebsd-vm@v0.1.5
|
||||||
with:
|
with:
|
||||||
usesh: true
|
usesh: true
|
||||||
|
# sync: sshfs
|
||||||
prepare: pkg install -y curl gmake sudo
|
prepare: pkg install -y curl gmake sudo
|
||||||
run: |
|
run: |
|
||||||
# Need to be run in the same block. Otherwise, we are back on the mac host.
|
## 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
|
set -e
|
||||||
pw adduser -n cuuser -d /root/ -g wheel -c "Coreutils user to build" -w random
|
#
|
||||||
chown -R cuuser:wheel /root/ /Users/runner/work/coreutils/
|
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
|
whoami
|
||||||
|
#
|
||||||
# Needs to be done in a sudo as we are changing users
|
# Further work needs to be done in a sudo as we are changing users
|
||||||
sudo -i -u cuuser sh << EOF
|
sudo -i -u ${TEST_USER} sh << EOF
|
||||||
set -e
|
set -e
|
||||||
whoami
|
whoami
|
||||||
curl https://sh.rustup.rs -sSf --output rustup.sh
|
curl https://sh.rustup.rs -sSf --output rustup.sh
|
||||||
sh rustup.sh -y --profile=minimal
|
sh rustup.sh -y --profile=minimal
|
||||||
|
. $HOME/.cargo/env
|
||||||
## Info
|
## Info
|
||||||
# environment
|
# environment
|
||||||
echo "## environment"
|
echo "## environment"
|
||||||
echo "CI='${CI}'"
|
echo "CI='${CI}'"
|
||||||
# tooling info display
|
echo "REPO_NAME='${REPO_NAME}'"
|
||||||
echo "## tooling"
|
echo "TEST_USER='${TEST_USER}'"
|
||||||
. $HOME/.cargo/env
|
echo "WORKSPACE_PARENT='${WORKSPACE_PARENT}'"
|
||||||
|
echo "WORKSPACE='${WORKSPACE}'"
|
||||||
|
env | sort
|
||||||
|
# tooling info
|
||||||
|
echo "## tooling info"
|
||||||
cargo -V
|
cargo -V
|
||||||
rustc -V
|
rustc -V
|
||||||
env
|
#
|
||||||
|
cd "${WORKSPACE}"
|
||||||
# where the files are resynced
|
unset FAULT
|
||||||
cd /Users/runner/work/coreutils/coreutils/
|
cargo build || FAULT=1
|
||||||
cargo build
|
cargo test --features "${{ matrix.job.features }}" || FAULT=1
|
||||||
cargo test --features feat_os_unix -p uucore -p coreutils
|
cargo test --features "${{ matrix.job.features }}" -p uucore || FAULT=1
|
||||||
# Clean to avoid to rsync back the files
|
# Clean to avoid to rsync back the files
|
||||||
cargo clean
|
cargo clean
|
||||||
|
if (test -n "$FAULT"); then exit 1 ; fi
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
|
@ -711,13 +744,6 @@ jobs:
|
||||||
- { os: windows-latest , features: windows }
|
- { os: windows-latest , features: windows }
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Install/setup prerequisites
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
## Install/setup prerequisites
|
|
||||||
case '${{ matrix.job.os }}' in
|
|
||||||
macos-latest) brew install coreutils ;; # needed for testing
|
|
||||||
esac
|
|
||||||
# - name: Reattach HEAD ## may be needed for accurate code coverage info
|
# - name: Reattach HEAD ## may be needed for accurate code coverage info
|
||||||
# run: git checkout ${{ github.head_ref }}
|
# run: git checkout ${{ github.head_ref }}
|
||||||
- name: Initialize workflow variables
|
- name: Initialize workflow variables
|
||||||
|
@ -744,6 +770,13 @@ jobs:
|
||||||
# * CODECOV_FLAGS
|
# * CODECOV_FLAGS
|
||||||
CODECOV_FLAGS=$( echo "${{ matrix.job.os }}" | sed 's/[^[:alnum:]]/_/g' )
|
CODECOV_FLAGS=$( echo "${{ matrix.job.os }}" | sed 's/[^[:alnum:]]/_/g' )
|
||||||
outputs CODECOV_FLAGS
|
outputs CODECOV_FLAGS
|
||||||
|
- name: Install/setup prerequisites
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
## Install/setup prerequisites
|
||||||
|
case '${{ matrix.job.os }}' in
|
||||||
|
macos-latest) brew install coreutils ;; # needed for testing
|
||||||
|
esac
|
||||||
- name: rust toolchain ~ install
|
- name: rust toolchain ~ install
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue