Skip to content

Commit

Permalink
chore(CI): Always compile the entire workspace for CI tests (#2028)
Browse files Browse the repository at this point in the history
* chore(CI): Always compile the entire workspace for CI tests

* remove changes from udeps

* Remove check for empty changes

* Try fromJson

* remove accidental command

* echo

* temp

* quotes for echo

* try building and eval

* try quotes

* fix exprs

* Update mysticeti workflow too

* temp2

* Revert "temp"

This reverts commit 372e552.

* Revert "temp2"

This reverts commit 5b3933e.

---------

Co-authored-by: Thibault Martinez <[email protected]>
  • Loading branch information
DaughterOfMars and thibault-martinez authored Aug 27, 2024
1 parent 288cb5b commit 380cc10
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 85 deletions.
2 changes: 2 additions & 0 deletions .github/crates-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ iota-rosetta:
- "crates/iota-rosetta/**"
iota-rpc-loadgen:
- "crates/iota-rpc-loadgen/**"
iota-sdk:
- "crates/iota-sdk/**"
iota-simulator:
- "crates/iota-simulator/**"
iota-single-node-benchmark:
Expand Down
48 changes: 30 additions & 18 deletions .github/workflows/_external_rust_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,45 +25,57 @@ jobs:
filters: .github/external-crates-filters.yml

test:
name: Test ${{ matrix.components }}
name: Test external crates
needs: changes
if: always() && inputs.isRust && needs.changes.outputs.components != '[]'
if: always() && inputs.isRust
env:
# Tests written with #[sim_test] are often flaky if run as #[tokio::test] - this var
# causes #[sim_test] to only run under the deterministic `simtest` job, and not the
# non-deterministic `test` job.
IOTA_SKIP_SIMTESTS: 1
strategy:
matrix:
components: ${{ fromJson(needs.changes.outputs.components) }}
fail-fast: false
runs-on: [self-hosted]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: taiki-e/install-action@nextest
- name: Install python dependencies
run: pip install pyopenssl --upgrade --break-system-packages
- name: cargo test
run: >
cargo nextest run
--config-file .config/nextest.toml
--manifest-path external-crates/move/Cargo.toml
-E '!test(prove) and !test(run_all::simple_build_with_docs/args.txt) and !test(run_test::nested_deps_bad_parent/Move.toml) and rdeps(${{matrix.components}})'
-p ${{matrix.components}}
--profile ci
run: |
array=(${{ join(fromJson(needs.changes.outputs.components), ' ') }})
result=""
for item in "${array[@]}"; do
mapped_item="-E 'rdeps(${item})'"
if [ -z "$result" ]; then
result="$mapped_item"
else
result="$result $mapped_item"
fi
done
command="cargo nextest run \
--config-file .config/nextest.toml \
--manifest-path external-crates/move/Cargo.toml \
-E '!test(prove) and !test(run_all::simple_build_with_docs/args.txt) and !test(run_test::nested_deps_bad_parent/Move.toml)' \
$result \
--profile ci"
echo "$command"
eval ${command}
check-unused-deps:
name: Check Unused Dependencies of ${{ matrix.components }} (${{ matrix.flags }})
if: always() && inputs.isRust && needs.changes.outputs.components != '[]'
name: Check Unused Dependencies (${{ matrix.flags }})
if: always() && inputs.isRust
strategy:
matrix:
components: ${{ fromJson(needs.changes.outputs.components) }}
flags: ["--all-features", "--no-default-features"]
fail-fast: false
runs-on: [self-hosted]
needs: changes

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
- name: Run Cargo Udeps
run: cargo +nightly ci-udeps-external -p ${{matrix.components}} ${{ matrix.flags }}
run: cargo +nightly ci-udeps-external ${{ matrix.flags }}
28 changes: 21 additions & 7 deletions .github/workflows/_mysticeti_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,39 @@ jobs:
filters: .github/crates-filters.yml

test:
name: Test ${{ matrix.components }}
if: needs.changes.outputs.components != '[]'
name: Test Mysticeti
timeout-minutes: 45
env:
# Tests written with #[sim_test] are often flaky if run as #[tokio::test] - this var
# causes #[sim_test] to only run under the deterministic `simtest` job, and not the
# non-deterministic `test` job.
IOTA_SKIP_SIMTESTS: 1
strategy:
matrix:
components: ${{ fromJson(needs.changes.outputs.components) }}
fail-fast: false
runs-on: [self-hosted]
needs: changes
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: taiki-e/install-action@nextest
- name: cargo test
run: cargo nextest run --profile ci -E 'rdeps(${{matrix.components}})' -p ${{matrix.components}}
run: |
array=(${{ join(fromJson(needs.changes.outputs.components), ' ') }})
result=""
for item in "${array[@]}"; do
mapped_item="-E 'rdeps(${item})'"
if [ -z "$result" ]; then
result="$mapped_item"
else
result="$result $mapped_item"
fi
done
command="cargo nextest run --profile ci $result"
echo "$command"
eval ${command}
test-extra:
timeout-minutes: 45
Expand Down
83 changes: 23 additions & 60 deletions .github/workflows/_rust_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,90 +25,53 @@ jobs:
filters: .github/crates-filters.yml

test:
name: Test ${{ matrix.components }}
name: Test rust crates
needs: changes
if: always() && inputs.isRust && needs.changes.outputs.components != '[]'
if: always() && inputs.isRust
env:
# Tests written with #[sim_test] are often flaky if run as #[tokio::test] - this var
# causes #[sim_test] to only run under the deterministic `simtest` job, and not the
# non-deterministic `test` job.
IOTA_SKIP_SIMTESTS: 1
strategy:
matrix:
components: ${{ fromJson(needs.changes.outputs.components) }}
fail-fast: false
runs-on: [self-hosted]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: taiki-e/install-action@nextest
- name: cargo test
run: cargo nextest run --profile ci -E 'rdeps(${{matrix.components}})' -p ${{matrix.components}}
run: |
array=(${{ join(fromJson(needs.changes.outputs.components), ' ') }})
iota-sdk-changes:
if: inputs.isRust
runs-on: [self-hosted]
outputs:
changed: ${{ steps.filter.outputs.iota-sdk }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
iota-sdk:
- "crates/iota-sdk/**"
result=""
test-iota-sdk:
name: Test iota-sdk
if: always() && inputs.isRust && needs.iota-sdk-changes.outputs.changed == 'true'
env:
# Tests written with #[sim_test] are often flaky if run as #[tokio::test] - this var
# causes #[sim_test] to only run under the deterministic `simtest` job, and not the
# non-deterministic `test` job.
IOTA_SKIP_SIMTESTS: 1
runs-on: [self-hosted]
needs: iota-sdk-changes
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: taiki-e/install-action@nextest
- name: cargo test
# iota-sdk version needs to be explicitly defined here due to this bug
# https://github.com/rust-lang/cargo/issues/12891
# (we have the stardust iota-sdk package as a dependency)
run: cargo nextest run --profile ci -E 'rdeps(iota-sdk)' -p [email protected]
for item in "${array[@]}"; do
mapped_item="-E 'rdeps(${item})'"
if [ -z "$result" ]; then
result="$mapped_item"
else
result="$result $mapped_item"
fi
done
command="cargo nextest run --profile ci $result"
echo "$command"
eval ${command}
check-unused-deps:
name: Check Unused Dependencies of ${{ matrix.components }} (${{ matrix.flags }})
if: always() && inputs.isRust && needs.changes.outputs.components != '[]'
name: Check Unused Dependencies (${{ matrix.flags }})
if: always() && inputs.isRust
strategy:
matrix:
components: ${{ fromJson(needs.changes.outputs.components) }}
flags: ["--all-features", "--no-default-features"]
fail-fast: false
runs-on: [self-hosted]
needs: changes

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
- name: Run Cargo Udeps
run: cargo +nightly ci-udeps -p ${{matrix.components}} ${{ matrix.flags }}

check-unused-deps-iota-sdk:
name: Check Unused Dependencies of iota-sdk (${{ matrix.flags }})
if: always() && inputs.isRust && needs.iota-sdk-changes.outputs.changed == 'true'
runs-on: [self-hosted]
needs: iota-sdk-changes
strategy:
matrix:
flags: ["--all-features", "--no-default-features"]

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
# iota-sdk version needs to be explicitly defined here due to this bug
# https://github.com/rust-lang/cargo/issues/12891
# (we have the stardust iota-sdk package as a dependency)
- name: Run Cargo Udeps
run: cargo +nightly ci-udeps -p [email protected] ${{ matrix.flags }}
run: cargo +nightly ci-udeps ${{ matrix.flags }}

test-extra:
env:
Expand Down

0 comments on commit 380cc10

Please sign in to comment.