Skip to content

Commit

Permalink
Merge branch 'main' into missing-stdout-flush
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvestre authored May 21, 2024
2 parents 0eff718 + a816960 commit d9f0ad3
Show file tree
Hide file tree
Showing 427 changed files with 21,466 additions and 6,540 deletions.
2 changes: 1 addition & 1 deletion .cargo/config → .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[target.x86_64-unknown-redox]
linker = "x86_64-unknown-redox-gcc"

[target.'cfg(feature = "cargo-clippy")']
[target.'cfg(clippy)']
rustflags = [
"-Wclippy::use_self",
"-Wclippy::needless_pass_by_value",
Expand Down
2 changes: 1 addition & 1 deletion .clippy.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
msrv = "1.70.0"
cognitive-complexity-threshold = 10
cognitive-complexity-threshold = 24
108 changes: 68 additions & 40 deletions .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ env:
on:
pull_request:
push:
tags:
- '*'
branches:
- main

Expand Down Expand Up @@ -110,7 +112,7 @@ jobs:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/[email protected].3
uses: mozilla-actions/[email protected].4
- name: Initialize workflow variables
id: vars
shell: bash
Expand All @@ -137,7 +139,7 @@ jobs:
shell: bash
run: |
RUSTDOCFLAGS="-Dwarnings" cargo doc ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --no-deps --workspace --document-private-items
- uses: DavidAnson/markdownlint-cli2-action@v14
- uses: DavidAnson/markdownlint-cli2-action@v16
with:
fix: "true"
globs: |
Expand All @@ -164,7 +166,7 @@ jobs:
- uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/[email protected].3
uses: mozilla-actions/[email protected].4
- name: Initialize workflow variables
id: vars
shell: bash
Expand Down Expand Up @@ -252,7 +254,7 @@ jobs:
- uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/[email protected].3
uses: mozilla-actions/[email protected].4
- name: "`make build`"
shell: bash
run: |
Expand Down Expand Up @@ -306,9 +308,9 @@ jobs:
- uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/[email protected].3
uses: mozilla-actions/[email protected].4
- name: Test
run: cargo nextest run --hide-progress-bar --profile ci ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }}
run: cargo nextest run --hide-progress-bar --profile ci --features ${{ matrix.job.features }}
env:
RUST_BACKTRACE: "1"

Expand All @@ -333,9 +335,9 @@ jobs:
- uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/[email protected].3
uses: mozilla-actions/[email protected].4
- name: Test
run: cargo nextest run --hide-progress-bar --profile ci ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }}
run: cargo nextest run --hide-progress-bar --profile ci --features ${{ matrix.job.features }}
env:
RUST_BACKTRACE: "1"

Expand All @@ -356,7 +358,7 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/[email protected].3
uses: mozilla-actions/[email protected].4
- name: Install dependencies
shell: bash
run: |
Expand Down Expand Up @@ -466,16 +468,16 @@ jobs:
matrix:
job:
# - { os , target , cargo-options , features , use-cross , toolchain, skip-tests }
- { os: ubuntu-latest , target: arm-unknown-linux-gnueabihf, features: feat_os_unix_gnueabihf, use-cross: use-cross, }
- { os: ubuntu-latest , target: aarch64-unknown-linux-gnu , features: feat_os_unix_gnueabihf , use-cross: use-cross }
- { os: ubuntu-latest , target: aarch64-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross }
- { os: ubuntu-latest , target: arm-unknown-linux-gnueabihf, features: feat_os_unix_gnueabihf, use-cross: use-cross, skip-tests: true }
- { os: ubuntu-latest , target: aarch64-unknown-linux-gnu , features: feat_os_unix_gnueabihf , use-cross: use-cross , skip-tests: true }
- { os: ubuntu-latest , target: aarch64-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross , skip-tests: true }
# - { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: feat_selinux , use-cross: use-cross }
- { os: ubuntu-latest , target: i686-unknown-linux-gnu , features: feat_os_unix , use-cross: use-cross }
- { os: ubuntu-latest , target: i686-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross }
- { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: feat_os_unix , use-cross: use-cross }
- { os: ubuntu-latest , target: x86_64-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross }
- { os: ubuntu-latest , target: x86_64-unknown-redox , features: feat_os_unix_redox , use-cross: redoxer , skip-tests: true }
- { os: macos-latest , target: aarch64-apple-darwin , features: feat_os_macos , use-cross: use-cross, skip-tests: true} # Hopefully github provides free M1 runners soon...
- { os: ubuntu-latest , target: x86_64-unknown-redox , features: feat_os_unix_redox , use-cross: redoxer , skip-tests: true }
- { os: macos-14 , target: aarch64-apple-darwin , features: feat_os_macos } # M1 CPU
- { os: macos-latest , target: x86_64-apple-darwin , features: feat_os_macos }
- { os: windows-latest , target: i686-pc-windows-msvc , features: feat_os_windows }
- { os: windows-latest , target: x86_64-pc-windows-gnu , features: feat_os_windows }
Expand All @@ -490,7 +492,7 @@ jobs:
with:
key: "${{ matrix.job.os }}_${{ matrix.job.target }}"
- name: Run sccache-cache
uses: mozilla-actions/[email protected].3
uses: mozilla-actions/[email protected].4
- name: Initialize workflow variables
id: vars
shell: bash
Expand Down Expand Up @@ -585,9 +587,6 @@ jobs:
if [ "${CARGO_CMD}" = 'cross' ] && [ ! -e "Cross.toml" ] ; then
printf "[build.env]\npassthrough = [\"CI\", \"RUST_BACKTRACE\", \"CARGO_TERM_COLOR\"]\n" > Cross.toml
fi
# * test only library and/or binaries for arm-type targets
unset CARGO_TEST_OPTIONS ; case '${{ matrix.job.target }}' in aarch64-* | arm-*) CARGO_TEST_OPTIONS="--bins" ;; esac;
outputs CARGO_TEST_OPTIONS
# * executable for `strip`?
STRIP="strip"
case ${{ matrix.job.target }} in
Expand All @@ -612,9 +611,23 @@ jobs:
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-*) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;;
*-redox*) sudo apt-get -y update ; sudo apt-get -y install fuse3 libfuse-dev ;;
arm-unknown-linux-gnueabihf)
sudo apt-get -y update
sudo apt-get -y install gcc-arm-linux-gnueabihf
;;
aarch64-unknown-linux-*)
sudo apt-get -y update
sudo apt-get -y install gcc-aarch64-linux-gnu
;;
*-redox*)
sudo apt-get -y update
sudo apt-get -y install fuse3 libfuse-dev
;;
# Update binutils if MinGW due to https://github.com/rust-lang/rust/issues/112368
x86_64-pc-windows-gnu)
C:/msys64/usr/bin/pacman.exe -Sy --needed mingw-w64-x86_64-gcc --noconfirm
echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
;;
esac
case '${{ matrix.job.os }}' in
macos-latest) brew install coreutils ;; # needed for testing
Expand Down Expand Up @@ -693,7 +706,7 @@ jobs:
run: |
## Test individual utilities
${{ steps.vars.outputs.CARGO_CMD }} ${{ steps.vars.outputs.CARGO_CMD_OPTIONS }} test --target=${{ matrix.job.target }} \
${{ steps.vars.outputs.CARGO_TEST_OPTIONS}} ${{ matrix.job.cargo-options }} ${{ steps.dep_vars.outputs.CARGO_UTILITY_LIST_OPTIONS }}
${{ matrix.job.cargo-options }} ${{ steps.dep_vars.outputs.CARGO_UTILITY_LIST_OPTIONS }}
env:
RUST_BACKTRACE: "1"
- name: Archive executable artifacts
Expand Down Expand Up @@ -736,7 +749,7 @@ jobs:
fakeroot dpkg-deb --build "${DPKG_DIR}" "${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.DPKG_NAME }}"
fi
- name: Publish
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: steps.vars.outputs.DEPLOY
with:
files: |
Expand Down Expand Up @@ -767,7 +780,7 @@ jobs:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/[email protected].3
uses: mozilla-actions/[email protected].4
- name: Install/setup prerequisites
shell: bash
run: |
Expand Down Expand Up @@ -851,7 +864,7 @@ jobs:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/[email protected].3
uses: mozilla-actions/[email protected].4
- name: Build coreutils as multiple binaries
shell: bash
run: |
Expand Down Expand Up @@ -935,7 +948,7 @@ jobs:
- uses: taiki-e/install-action@grcov
- uses: Swatinem/rust-cache@v2
- name: Run sccache-cache
uses: mozilla-actions/[email protected].3
uses: mozilla-actions/[email protected].4
# - name: Reattach HEAD ## may be needed for accurate code coverage info
# run: git checkout ${{ github.head_ref }}
- name: Initialize workflow variables
Expand Down Expand Up @@ -984,6 +997,10 @@ jobs:
echo "foo" > /home/runner/.plan
;;
esac
case '${{ matrix.job.os }}' in
# Update binutils if MinGW due to https://github.com/rust-lang/rust/issues/112368
windows-latest) C:/msys64/usr/bin/pacman.exe -Sy --needed mingw-w64-x86_64-gcc --noconfirm ; echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH ;;
esac
- name: Initialize toolchain-dependent workflow variables
id: dep_vars
shell: bash
Expand All @@ -994,16 +1011,8 @@ jobs:
UTILITY_LIST="$(./util/show-utils.sh ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }})"
CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo -n "-puu_${u} "; done;)"
outputs CARGO_UTILITY_LIST_OPTIONS
- name: Test uucore
run: cargo nextest run --profile ci --hide-progress-bar -p uucore
env:
RUSTC_WRAPPER: ""
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
RUSTDOCFLAGS: "-Cpanic=abort"
RUST_BACKTRACE: "1"
# RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }}
- name: Test
run: cargo nextest run --profile ci --hide-progress-bar ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }}
run: cargo nextest run --profile ci --hide-progress-bar ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} -p uucore -p coreutils
env:
RUSTC_WRAPPER: ""
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
Expand All @@ -1029,17 +1038,36 @@ jobs:
# GRCOV_EXCLUDE_OPTION='--excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()"' ## `grcov` ignores these params when passed as an environment variable (why?)
mkdir -p "${COVERAGE_REPORT_DIR}"
# display coverage files
~/.cargo/bin/grcov . --output-type files --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()" | sort --unique
grcov . --output-type files --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()" | sort --unique
# generate coverage report
~/.cargo/bin/grcov . --output-type lcov --output-path "${COVERAGE_REPORT_FILE}" --branch --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()"
grcov . --output-type lcov --output-path "${COVERAGE_REPORT_FILE}" --branch --ignore build.rs --ignore "vendor/*" --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()"
echo "report=${COVERAGE_REPORT_FILE}" >> $GITHUB_OUTPUT
- name: Upload coverage results (to Codecov.io)
uses: codecov/codecov-action@v3
# if: steps.vars.outputs.HAS_CODECOV_TOKEN
uses: codecov/codecov-action@v4
with:
# token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
file: ${{ steps.coverage.outputs.report }}
## flags: IntegrationTests, UnitTests, ${{ steps.vars.outputs.CODECOV_FLAGS }}
flags: ${{ steps.vars.outputs.CODECOV_FLAGS }}
name: codecov-umbrella
fail_ci_if_error: false

test_separately:
name: Separate Builds
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: build and test all programs individually
shell: bash
run: |
for f in $(util/show-utils.sh)
do
echo "Building and testing $f"
cargo test -p "uu_$f" || exit 1
done
Loading

0 comments on commit d9f0ad3

Please sign in to comment.