@@ -598,51 +598,34 @@ jobs:
598598 matrix.target != 'wasm32-unknown-unknown' &&
599599 env.ZC_SKIP_CARGO_SEMVER_CHECKS != '1'
600600
601- # TODO(#453): Doing this as a matrix step is a hack that allows us to depend
602- # on the fact that toolchains have already been installed. We currently only
603- # run this on a single matrix combination, but doing it outside of the
604- # matrix would require us to replicate the toolchain resolution and
605- # installation logic. We should either:
606- # - Figure out how to factor out the toolchain resolution and installation
607- # logic (see #1275) for an attempt
608- # - Support multiple matrix combinations (which we intend to do as part of
609- # #453 eventually anyway) so that this location is justified
610- - name : Generate code coverage
611- env :
612- TOOLCHAIN : ${{ matrix.toolchain }}
613- CRATE : ${{ matrix.crate }}
614- TARGET : ${{ matrix.target }}
615- FEATURES : ${{ matrix.features }}
616- run : |
617- set -eo pipefail
618- ./cargo.sh +nightly install cargo-llvm-cov
619-
620- ./cargo.sh +$TOOLCHAIN llvm-cov \
621- --package $CRATE \
622- --target $TARGET \
623- $FEATURES \
624- --doctests \
625- --lcov \
626- --output-path lcov.info \
627- --verbose \
628- -- \
629- --skip ui
630- if : |
631- matrix.crate == 'zerocopy' &&
632- matrix.features == '--all-features' &&
633- matrix.toolchain == 'nightly' &&
634- matrix.target == 'x86_64-unknown-linux-gnu'
635-
636- - name : Upload coverage to Codecov
637- uses : codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
638- with :
639- token : ${{ secrets.CODECOV_TOKEN }}
640- files : lcov.info
641- if : |
642- matrix.crate == 'zerocopy' &&
643- matrix.features == '--all-features' &&
644- matrix.toolchain == 'nightly' &&
645- matrix.target == 'x86_64-unknown-linux-gnu'
601+ coverage :
602+ runs-on : ubuntu-latest
603+ name : Generate code coverage
604+ needs : generate_cache
605+ steps :
606+ - uses : actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
607+ with :
608+ persist-credentials : false
609+ - name : Populate cache
610+ uses : ./.github/actions/cache
611+ - name : Generate code coverage
612+ run : |
613+ set -eo pipefail
614+ ./cargo.sh +nightly install cargo-llvm-cov
615+ ./cargo.sh +nightly llvm-cov \
616+ --package zerocopy \
617+ --target x86_64-unknown-linux-gnu \
618+ --all-features \
619+ --doctests \
620+ --lcov \
621+ --output-path lcov.info \
622+ --verbose \
623+ -- --skip ui
624+ - name : Upload coverage to Codecov
625+ uses : codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
626+ with :
627+ token : ${{ secrets.CODECOV_TOKEN }}
628+ files : lcov.info
646629
647630 kani :
648631 runs-on : ubuntu-latest
@@ -832,47 +815,49 @@ jobs:
832815 with :
833816 persist-credentials : false
834817
835- - id : populate- cache
818+ - name : Populate cache
836819 uses : ./.github/actions/cache
837-
838- - name : Download dependencies
839- if : steps.populate-cache.outputs.cache-hit != 'true'
840- run : |
841- # Ensure all dependencies are downloaded - both for our crates and for
842- # tools we use in CI. We don't care about these tools succeeding for
843- # two reasons: First, this entire job is best-effort since it's just a
844- # performance optimization. Second, there may be failures due to
845- # issues other than failing to download dependencies (e.g., `cargo
846- # metadata` called with a malformed `Cargo.toml`, build failure in our
847- # own crate or in dependencies, etc). For those reasons, we discard
848- # stderr and ignore status codes.
849- #
850- # For downloading our crates' dependencies in particular, note that
851- # there is no support for doing this directly [1], so we just check
852- # all crates using --tests.
853- #
854- # We background all jobs and then wait for them so that they can run
855- # in parallel.
856- #
857- # [1] https://stackoverflow.com/a/42139535/836390
858-
859- # See comment on "Pin syn dependency" job for why we do this. It needs
860- # to happen before the subsequent `cargo check`, so we don't
861- # background it.
862- #
863- # TODO(#1595): Debug why this step is still necessary after #1564 and
864- # maybe remove it.
865- cargo add -p zerocopy-derive 'syn@=2.0.46' &> /dev/null
866-
867- cargo check --workspace --tests &> /dev/null &
868- cargo metadata &> /dev/null &
869- cargo install cargo-readme --version 3.2.0 &> /dev/null &
870- cargo install --locked action-validator --version 0.8.0 &> /dev/null &
871- cargo install --locked kani-verifier &> /dev/null &
872- cargo install cargo-nextest &> /dev/null &
873- cargo kani setup &> /dev/null &
874-
875- wait
820+ with :
821+ mode : generate
822+ run : |
823+ # Ensure all dependencies are downloaded - both for our crates and for
824+ # tools we use in CI. We don't care about these tools succeeding for
825+ # two reasons: First, this entire job is best-effort since it's just a
826+ # performance optimization. Second, there may be failures due to
827+ # issues other than failing to download dependencies (e.g., `cargo
828+ # metadata` called with a malformed `Cargo.toml`, build failure in our
829+ # own crate or in dependencies, etc). For those reasons, we discard
830+ # stderr and ignore status codes.
831+ #
832+ # For downloading our crates' dependencies in particular, note that
833+ # there is no support for doing this directly [1], so we just check
834+ # all crates using --tests.
835+ #
836+ # We background all jobs and then wait for them so that they can run
837+ # in parallel.
838+ #
839+ # [1] https://stackoverflow.com/a/42139535/836390
840+
841+ # See comment on "Pin syn dependency" job for why we do this. It needs
842+ # to happen before the subsequent `cargo check`, so we don't
843+ # background it.
844+ #
845+ # TODO(#1595): Debug why this step is still necessary after #1564 and
846+ # maybe remove it.
847+ cargo add -p zerocopy-derive 'syn@=2.0.46' &> /dev/null
848+
849+ cargo check --workspace --tests &> /dev/null &
850+ # On our MSRV toolchain, updating the Cargo index takes a long time, so
851+ # it is worth specifically caching the MSRV index.
852+ ./cargo.sh +msrv check --workspace --tests &> /dev/null &
853+ cargo metadata &> /dev/null &
854+ cargo install cargo-readme --version 3.2.0 &> /dev/null &
855+ cargo install --locked action-validator --version 0.8.0 &> /dev/null &
856+ cargo install --locked kani-verifier &> /dev/null &
857+ cargo install cargo-nextest &> /dev/null &
858+ cargo kani setup &> /dev/null &
859+
860+ wait
876861
877862 check-all-toolchains-tested :
878863 runs-on : ubuntu-latest
@@ -966,7 +951,7 @@ jobs:
966951 # https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
967952 if : failure()
968953 runs-on : ubuntu-latest
969- needs : [build_test, kani, check_be_aarch64, check_avr_atmega, check_fmt, check_actions, check_readme, check_versions, check_msrv_is_minimal, generate_cache, check-all-toolchains-tested, check-job-dependencies, check-todo, run-git-hooks, zizmor]
954+ needs : [build_test, coverage, kani, check_be_aarch64, check_avr_atmega, check_fmt, check_actions, check_readme, check_versions, check_msrv_is_minimal, generate_cache, check-all-toolchains-tested, check-job-dependencies, check-todo, run-git-hooks, zizmor]
970955 steps :
971956 - name : Mark the job as failed
972957 run : exit 1
0 commit comments