Skip to content

Commit 52a5f19

Browse files
authored
Merge pull request #7386 from drinkcat/ci
.github: CICD: add workspace test to build matrix
2 parents f85c695 + 3503783 commit 52a5f19

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

.github/workflows/CICD.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,14 +505,15 @@ jobs:
505505
fail-fast: false
506506
matrix:
507507
job:
508-
# - { os , target , cargo-options , features , use-cross , toolchain, skip-tests }
508+
# - { os , target , cargo-options , features , use-cross , toolchain, skip-tests, workspace-tests }
509509
- { os: ubuntu-latest , target: arm-unknown-linux-gnueabihf , features: feat_os_unix_gnueabihf , use-cross: use-cross , skip-tests: true }
510510
- { os: ubuntu-24.04-arm , target: aarch64-unknown-linux-gnu , features: feat_os_unix_gnueabihf }
511511
- { os: ubuntu-latest , target: aarch64-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross , skip-tests: true }
512512
# - { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: feat_selinux , use-cross: use-cross }
513513
- { os: ubuntu-latest , target: i686-unknown-linux-gnu , features: "feat_os_unix,test_risky_names", use-cross: use-cross }
514514
- { os: ubuntu-latest , target: i686-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross }
515515
- { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: "feat_os_unix,test_risky_names", use-cross: use-cross }
516+
- { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: "feat_os_unix" , use-cross: no, workspace-tests: true }
516517
- { os: ubuntu-latest , target: x86_64-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross }
517518
- { os: ubuntu-latest , target: x86_64-unknown-redox , features: feat_os_unix_redox , use-cross: redoxer , skip-tests: true }
518519
- { os: macos-latest , target: aarch64-apple-darwin , features: feat_os_macos } # M1 CPU
@@ -613,9 +614,12 @@ jobs:
613614
# * CARGO_CMD
614615
CARGO_CMD='cross'
615616
CARGO_CMD_OPTIONS='+${{ env.RUST_MIN_SRV }}'
617+
# Added suffix for artifacts, needed when multiple jobs use the same target.
618+
ARTIFACTS_SUFFIX=''
616619
case '${{ matrix.job.use-cross }}' in
617620
''|0|f|false|n|no)
618621
CARGO_CMD='cargo'
622+
ARTIFACTS_SUFFIX='-nocross'
619623
;;
620624
redoxer)
621625
CARGO_CMD='redoxer'
@@ -624,6 +628,18 @@ jobs:
624628
esac
625629
outputs CARGO_CMD
626630
outputs CARGO_CMD_OPTIONS
631+
outputs ARTIFACTS_SUFFIX
632+
CARGO_TEST_OPTIONS=''
633+
case '${{ matrix.job.workspace-tests }}' in
634+
1|t|true|y|yes)
635+
# This also runs tests in other packages in the source directory (e.g. uucore).
636+
# We cannot enable this everywhere as some platforms are currently broken, and
637+
# we cannot use `cross` as its Docker image is ancient (Ubuntu 16.04) and is
638+
# missing required system dependencies (e.g. recent libclang-dev).
639+
CARGO_TEST_OPTIONS='--workspace'
640+
;;
641+
esac
642+
outputs CARGO_TEST_OPTIONS
627643
# ** pass needed environment into `cross` container (iff `cross` not already configured via "Cross.toml")
628644
if [ "${CARGO_CMD}" = 'cross' ] && [ ! -e "Cross.toml" ] ; then
629645
printf "[build.env]\npassthrough = [\"CI\", \"RUST_BACKTRACE\", \"CARGO_TERM_COLOR\"]\n" > Cross.toml
@@ -675,6 +691,9 @@ jobs:
675691
esac
676692
case '${{ matrix.job.os }}' in
677693
ubuntu-*)
694+
# selinux headers needed to build tests
695+
sudo apt-get -y update
696+
sudo apt-get -y install libselinux1-dev
678697
# pinky is a tool to show logged-in users from utmp, and gecos fields from /etc/passwd.
679698
# In GitHub Action *nix VMs, no accounts log in, even the "runner" account that runs the commands. The account also has empty gecos fields.
680699
# To work around this for pinky tests, we create a fake login entry for the GH runner account...
@@ -753,7 +772,7 @@ jobs:
753772
- name: Archive executable artifacts
754773
uses: actions/upload-artifact@v4
755774
with:
756-
name: ${{ env.PROJECT_NAME }}-${{ matrix.job.target }}
775+
name: ${{ env.PROJECT_NAME }}-${{ matrix.job.target }}${{ steps.vars.outputs.ARTIFACTS_SUFFIX }}
757776
path: target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}
758777
- name: Package
759778
shell: bash

0 commit comments

Comments
 (0)