Skip to content

Commit

Permalink
.github: CICD: add workspace test to build matrix
Browse files Browse the repository at this point in the history
Add a new Linux build that runs without `cross`, and adds
`--workspace` to the cargo test command.

From cargo test documentation, this option "tests all members in
the workspace.". For example, this includes running tests within
the `uucore` package (see #7383).

Fixes #7392.
  • Loading branch information
drinkcat committed Mar 4, 2025
1 parent 72299d3 commit 40cffa6
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -505,14 +505,15 @@ jobs:
fail-fast: false
matrix:
job:
# - { os , target , cargo-options , features , use-cross , toolchain, skip-tests }
# - { os , target , cargo-options , features , use-cross , toolchain, skip-tests, workspace-tests }
- { os: ubuntu-latest , target: arm-unknown-linux-gnueabihf , features: feat_os_unix_gnueabihf , use-cross: use-cross , skip-tests: true }
- { os: ubuntu-24.04-arm , target: aarch64-unknown-linux-gnu , features: feat_os_unix_gnueabihf }
- { 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,test_risky_names", 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,test_risky_names", use-cross: use-cross }
- { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: "feat_os_unix" , use-cross: no, workspace-tests: true }
- { 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 } # M1 CPU
Expand Down Expand Up @@ -613,9 +614,11 @@ jobs:
# * CARGO_CMD
CARGO_CMD='cross'
CARGO_CMD_OPTIONS='+${{ env.RUST_MIN_SRV }}'
ARTIFACTS_SUFFIX=''
case '${{ matrix.job.use-cross }}' in
''|0|f|false|n|no)
CARGO_CMD='cargo'
ARTIFACTS_SUFFIX='-nocross'
;;
redoxer)
CARGO_CMD='redoxer'
Expand All @@ -624,6 +627,14 @@ jobs:
esac
outputs CARGO_CMD
outputs CARGO_CMD_OPTIONS
outputs ARTIFACTS_SUFFIX
CARGO_TEST_OPTIONS=''
case '${{ matrix.job.workspace-tests }}' in
1|t|true|y|yes)
CARGO_TEST_OPTIONS='--workspace'
;;
esac
outputs CARGO_TEST_OPTIONS
# ** pass needed environment into `cross` container (iff `cross` not already configured via "Cross.toml")
if [ "${CARGO_CMD}" = 'cross' ] && [ ! -e "Cross.toml" ] ; then
printf "[build.env]\npassthrough = [\"CI\", \"RUST_BACKTRACE\", \"CARGO_TERM_COLOR\"]\n" > Cross.toml
Expand Down Expand Up @@ -675,6 +686,9 @@ jobs:
esac
case '${{ matrix.job.os }}' in
ubuntu-*)
# selinux headers needed to build tests
sudo apt-get -y update
sudo apt-get -y install libselinux1-dev
# pinky is a tool to show logged-in users from utmp, and gecos fields from /etc/passwd.
# In GitHub Action *nix VMs, no accounts log in, even the "runner" account that runs the commands. The account also has empty gecos fields.
# To work around this for pinky tests, we create a fake login entry for the GH runner account...
Expand Down Expand Up @@ -753,7 +767,7 @@ jobs:
- name: Archive executable artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.PROJECT_NAME }}-${{ matrix.job.target }}
name: ${{ env.PROJECT_NAME }}-${{ matrix.job.target }}${{ steps.vars.outputs.ARTIFACTS_SUFFIX }}
path: target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}
- name: Package
shell: bash
Expand Down

0 comments on commit 40cffa6

Please sign in to comment.