From 86ed48c1c03afee0e45bac1500171179db57d556 Mon Sep 17 00:00:00 2001 From: ASuciuX Date: Thu, 15 Feb 2024 00:29:22 +0200 Subject: [PATCH 1/4] feat: update workflow to include optimisations 1. split big packages into `stackslib` and `stacks-node` 2. update cargo mutants to use specific version from github in order to include a timeout multiplier feature 3. add a specific run case for `stacks-signer` --- .github/workflows/pr-differences-mutants.yml | 106 +++++++++++++++---- 1 file changed, 88 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pr-differences-mutants.yml b/.github/workflows/pr-differences-mutants.yml index 041db9759..a79591722 100644 --- a/.github/workflows/pr-differences-mutants.yml +++ b/.github/workflows/pr-differences-mutants.yml @@ -23,10 +23,13 @@ jobs: runs-on: ubuntu-latest outputs: - run_big_packages: ${{ steps.check_packages_and_shards.outputs.run_big_packages }} - big_packages_with_shards: ${{ steps.check_packages_and_shards.outputs.big_packages_with_shards }} + run_stackslib: ${{ steps.check_packages_and_shards.outputs.run_stackslib }} + stackslib_with_shards: ${{ steps.check_packages_and_shards.outputs.stackslib_with_shards }} + run_stacks_node: ${{ steps.check_packages_and_shards.outputs.run_stacks_node }} + stacks_node_with_shards: ${{ steps.check_packages_and_shards.outputs.stacks_node_with_shards }} run_small_packages: ${{ steps.check_packages_and_shards.outputs.run_small_packages }} small_packages_with_shards: ${{ steps.check_packages_and_shards.outputs.small_packages_with_shards }} + run_stacks_signer: ${{ steps.check_packages_and_shards.outputs.run_stacks_signer }} steps: - id: check_packages_and_shards @@ -46,7 +49,7 @@ jobs: - name: Run mutants on diffs uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main with: - package-dimension: "small" + package: "small" # Mutation testing - Execute on PR on small packages that have functions modified (run with strategy matrix shards) pr-differences-mutants-small-shards: @@ -68,15 +71,15 @@ jobs: uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main with: shard: ${{ matrix.shard }} - package-dimension: "small" + package: "small" - # Mutation testing - Execute on PR on big packages that have functions modified (normal run, no shards) - pr-differences-mutants-big-normal: - name: Mutation Testing - Normal, Big + # Mutation testing - Execute on PR on stackslib package (normal run, no shards) + pr-differences-mutants-stackslib-normal: + name: Mutation Testing - Normal, Stackslib needs: check-big-packages-and-shards - if: ${{ needs.check-big-packages-and-shards.outputs.run_big_packages == 'true' && needs.check-big-packages-and-shards.outputs.big_packages_with_shards == 'false' }} + if: ${{ needs.check-big-packages-and-shards.outputs.run_stackslib == 'true' && needs.check-big-packages-and-shards.outputs.stackslib_with_shards == 'false' }} runs-on: ubuntu-latest @@ -87,15 +90,15 @@ jobs: RUST_BACKTRACE: full uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main with: - package-dimension: "big" + package: "stackslib" - # Mutation testing - Execute on PR on big packages that have functions modified (run with strategy matrix shards) - pr-differences-mutants-big-shards: - name: Mutation Testing - Shards, Big + # Mutation testing - Execute on PR on stackslib package (run with strategy matrix shards) + pr-differences-mutants-stackslib-shards: + name: Mutation Testing - Shards, Stackslib needs: check-big-packages-and-shards - if: ${{ needs.check-big-packages-and-shards.outputs.run_big_packages == 'true' && needs.check-big-packages-and-shards.outputs.big_packages_with_shards == 'true' }} + if: ${{ needs.check-big-packages-and-shards.outputs.run_stackslib == 'true' && needs.check-big-packages-and-shards.outputs.stackslib_with_shards == 'true' }} runs-on: ubuntu-latest @@ -112,7 +115,67 @@ jobs: uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main with: shard: ${{ matrix.shard }} - package-dimension: "big" + package: "stackslib" + + # Mutation testing - Execute on PR on stacks-node package (normal run, no shards) + pr-differences-mutants-stacks-node-normal: + name: Mutation Testing - Normal, Stacks Node + + needs: check-big-packages-and-shards + + if: ${{ needs.check-big-packages-and-shards.outputs.run_stacks_node == 'true' && needs.check-big-packages-and-shards.outputs.stacks_node_with_shards == 'false' }} + + runs-on: ubuntu-latest + + steps: + - name: Run Run mutants on diffs + env: + BITCOIND_TEST: 1 + RUST_BACKTRACE: full + uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main + with: + package: "stacks-node" + + # Mutation testing - Execute on PR on stacks-node package (run with strategy matrix shards) + pr-differences-mutants-stacks-node-shards: + name: Mutation Testing - Shards, Stacks Node + + needs: check-big-packages-and-shards + + if: ${{ needs.check-big-packages-and-shards.outputs.run_stacks_node == 'true' && needs.check-big-packages-and-shards.outputs.stacks_node_with_shards == 'true' }} + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + shard: [0, 1, 2, 3] + + steps: + - name: Run mutants on diffs + env: + BITCOIND_TEST: 1 + RUST_BACKTRACE: full + uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main + with: + shard: ${{ matrix.shard }} + package: "stacks-node" + + # Mutation testing - Execute on PR on stacks-signer package (normal run, no shards) + pr-differences-mutants-stacks-signer-normal: + name: Mutation Testing - Normal, Stacks Signer + + needs: check-big-packages-and-shards + + if: ${{ needs.check-big-packages-and-shards.outputs.run_stacks_signer == 'true' }} + + runs-on: ubuntu-latest + + steps: + - name: Run Run mutants on diffs + uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main + with: + package: "stacks-signer" # Output the mutants and fail the workflow if there are missed/timeout/unviable mutants output-mutants: @@ -120,20 +183,27 @@ jobs: runs-on: ubuntu-latest + if: always() needs: [ check-big-packages-and-shards, pr-differences-mutants-small-normal, pr-differences-mutants-small-shards, - pr-differences-mutants-big-normal, - pr-differences-mutants-big-shards, + pr-differences-mutants-stackslib-normal, + pr-differences-mutants-stackslib-shards, + pr-differences-mutants-stacks-node-normal, + pr-differences-mutants-stacks-node-shards, + pr-differences-mutants-stacks-signer-normal, ] steps: - name: Output Mutants uses: stacks-network/actions/stacks-core/mutation-testing/output-pr-mutants@main with: - big_packages: ${{ needs.check-big-packages-and-shards.outputs.run_big_packages }} - shards_for_big_packages: ${{ needs.check-big-packages-and-shards.outputs.big_packages_with_shards }} + stackslib_package: ${{ needs.check-big-packages-and-shards.outputs.run_stackslib }} + shards_for_stackslib_package: ${{ needs.check-big-packages-and-shards.outputs.stackslib_with_shards }} + stacks_node_package: ${{ needs.check-big-packages-and-shards.outputs.run_stacks_node }} + shards_for_stacks_node_package: ${{ needs.check-big-packages-and-shards.outputs.stacks_node_with_shards }} small_packages: ${{ needs.check-big-packages-and-shards.outputs.run_small_packages }} shards_for_small_packages: ${{ needs.check-big-packages-and-shards.outputs.small_packages_with_shards }} + stacks_signer: ${{ needs.check-big-packages-and-shards.outputs.run_stacks_signer }} From 5444cc4f06adc424047b28989a0b44020cdad0a7 Mon Sep 17 00:00:00 2001 From: ASuciuX Date: Wed, 21 Feb 2024 17:36:14 +0200 Subject: [PATCH 2/4] feat: multi-line 'if' statements for readability --- .github/workflows/pr-differences-mutants.yml | 27 +++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr-differences-mutants.yml b/.github/workflows/pr-differences-mutants.yml index a79591722..7e02c7e13 100644 --- a/.github/workflows/pr-differences-mutants.yml +++ b/.github/workflows/pr-differences-mutants.yml @@ -41,7 +41,9 @@ jobs: needs: check-big-packages-and-shards - if: ${{ needs.check-big-packages-and-shards.outputs.run_small_packages == 'true' && needs.check-big-packages-and-shards.outputs.small_packages_with_shards == 'false' }} + if: | + ${{ needs.check-big-packages-and-shards.outputs.run_small_packages == 'true' && + needs.check-big-packages-and-shards.outputs.small_packages_with_shards == 'false' }} runs-on: ubuntu-latest @@ -57,7 +59,9 @@ jobs: needs: check-big-packages-and-shards - if: ${{ needs.check-big-packages-and-shards.outputs.run_small_packages == 'true' && needs.check-big-packages-and-shards.outputs.small_packages_with_shards == 'true' }} + if: | + ${{ needs.check-big-packages-and-shards.outputs.run_small_packages == 'true' && + needs.check-big-packages-and-shards.outputs.small_packages_with_shards == 'true' }} runs-on: ubuntu-latest @@ -79,7 +83,9 @@ jobs: needs: check-big-packages-and-shards - if: ${{ needs.check-big-packages-and-shards.outputs.run_stackslib == 'true' && needs.check-big-packages-and-shards.outputs.stackslib_with_shards == 'false' }} + if: | + ${{ needs.check-big-packages-and-shards.outputs.run_stackslib == 'true' && + needs.check-big-packages-and-shards.outputs.stackslib_with_shards == 'false' }} runs-on: ubuntu-latest @@ -98,7 +104,9 @@ jobs: needs: check-big-packages-and-shards - if: ${{ needs.check-big-packages-and-shards.outputs.run_stackslib == 'true' && needs.check-big-packages-and-shards.outputs.stackslib_with_shards == 'true' }} + if: | + ${{ needs.check-big-packages-and-shards.outputs.run_stackslib == 'true' && + needs.check-big-packages-and-shards.outputs.stackslib_with_shards == 'true' }} runs-on: ubuntu-latest @@ -123,7 +131,9 @@ jobs: needs: check-big-packages-and-shards - if: ${{ needs.check-big-packages-and-shards.outputs.run_stacks_node == 'true' && needs.check-big-packages-and-shards.outputs.stacks_node_with_shards == 'false' }} + if: | + ${{ needs.check-big-packages-and-shards.outputs.run_stacks_node == 'true' && + needs.check-big-packages-and-shards.outputs.stacks_node_with_shards == 'false' }} runs-on: ubuntu-latest @@ -142,7 +152,9 @@ jobs: needs: check-big-packages-and-shards - if: ${{ needs.check-big-packages-and-shards.outputs.run_stacks_node == 'true' && needs.check-big-packages-and-shards.outputs.stacks_node_with_shards == 'true' }} + if: | + ${{ needs.check-big-packages-and-shards.outputs.run_stacks_node == 'true' && + needs.check-big-packages-and-shards.outputs.stacks_node_with_shards == 'true' }} runs-on: ubuntu-latest @@ -167,7 +179,8 @@ jobs: needs: check-big-packages-and-shards - if: ${{ needs.check-big-packages-and-shards.outputs.run_stacks_signer == 'true' }} + if: | + ${{ needs.check-big-packages-and-shards.outputs.run_stacks_signer == 'true' }} runs-on: ubuntu-latest From 8a4c59dd2c7e8fa69658fd53316bd5bac298d6a9 Mon Sep 17 00:00:00 2001 From: ASuciuX Date: Thu, 22 Feb 2024 20:17:22 +0200 Subject: [PATCH 3/4] feat: format yml code --- .github/workflows/pr-differences-mutants.yml | 42 ++++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pr-differences-mutants.yml b/.github/workflows/pr-differences-mutants.yml index 7e02c7e13..0e76c1c15 100644 --- a/.github/workflows/pr-differences-mutants.yml +++ b/.github/workflows/pr-differences-mutants.yml @@ -8,7 +8,7 @@ on: - synchronize - ready_for_review paths: - - "**.rs" + - '**.rs' concurrency: group: pr-differences-${{ github.head_ref || github.ref || github.run_id }} @@ -42,8 +42,8 @@ jobs: needs: check-big-packages-and-shards if: | - ${{ needs.check-big-packages-and-shards.outputs.run_small_packages == 'true' && - needs.check-big-packages-and-shards.outputs.small_packages_with_shards == 'false' }} + needs.check-big-packages-and-shards.outputs.run_small_packages == 'true' && + needs.check-big-packages-and-shards.outputs.small_packages_with_shards == 'false' runs-on: ubuntu-latest @@ -51,7 +51,7 @@ jobs: - name: Run mutants on diffs uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main with: - package: "small" + package: 'small' # Mutation testing - Execute on PR on small packages that have functions modified (run with strategy matrix shards) pr-differences-mutants-small-shards: @@ -60,8 +60,8 @@ jobs: needs: check-big-packages-and-shards if: | - ${{ needs.check-big-packages-and-shards.outputs.run_small_packages == 'true' && - needs.check-big-packages-and-shards.outputs.small_packages_with_shards == 'true' }} + needs.check-big-packages-and-shards.outputs.run_small_packages == 'true' && + needs.check-big-packages-and-shards.outputs.small_packages_with_shards == 'true' runs-on: ubuntu-latest @@ -75,7 +75,7 @@ jobs: uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main with: shard: ${{ matrix.shard }} - package: "small" + package: 'small' # Mutation testing - Execute on PR on stackslib package (normal run, no shards) pr-differences-mutants-stackslib-normal: @@ -84,8 +84,8 @@ jobs: needs: check-big-packages-and-shards if: | - ${{ needs.check-big-packages-and-shards.outputs.run_stackslib == 'true' && - needs.check-big-packages-and-shards.outputs.stackslib_with_shards == 'false' }} + needs.check-big-packages-and-shards.outputs.run_stackslib == 'true' && + needs.check-big-packages-and-shards.outputs.stackslib_with_shards == 'false' runs-on: ubuntu-latest @@ -96,7 +96,7 @@ jobs: RUST_BACKTRACE: full uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main with: - package: "stackslib" + package: 'stackslib' # Mutation testing - Execute on PR on stackslib package (run with strategy matrix shards) pr-differences-mutants-stackslib-shards: @@ -105,8 +105,8 @@ jobs: needs: check-big-packages-and-shards if: | - ${{ needs.check-big-packages-and-shards.outputs.run_stackslib == 'true' && - needs.check-big-packages-and-shards.outputs.stackslib_with_shards == 'true' }} + needs.check-big-packages-and-shards.outputs.run_stackslib == 'true' && + needs.check-big-packages-and-shards.outputs.stackslib_with_shards == 'true' runs-on: ubuntu-latest @@ -123,7 +123,7 @@ jobs: uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main with: shard: ${{ matrix.shard }} - package: "stackslib" + package: 'stackslib' # Mutation testing - Execute on PR on stacks-node package (normal run, no shards) pr-differences-mutants-stacks-node-normal: @@ -132,8 +132,8 @@ jobs: needs: check-big-packages-and-shards if: | - ${{ needs.check-big-packages-and-shards.outputs.run_stacks_node == 'true' && - needs.check-big-packages-and-shards.outputs.stacks_node_with_shards == 'false' }} + needs.check-big-packages-and-shards.outputs.run_stacks_node == 'true' && + needs.check-big-packages-and-shards.outputs.stacks_node_with_shards == 'false' runs-on: ubuntu-latest @@ -144,7 +144,7 @@ jobs: RUST_BACKTRACE: full uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main with: - package: "stacks-node" + package: 'stacks-node' # Mutation testing - Execute on PR on stacks-node package (run with strategy matrix shards) pr-differences-mutants-stacks-node-shards: @@ -153,8 +153,8 @@ jobs: needs: check-big-packages-and-shards if: | - ${{ needs.check-big-packages-and-shards.outputs.run_stacks_node == 'true' && - needs.check-big-packages-and-shards.outputs.stacks_node_with_shards == 'true' }} + needs.check-big-packages-and-shards.outputs.run_stacks_node == 'true' && + needs.check-big-packages-and-shards.outputs.stacks_node_with_shards == 'true' runs-on: ubuntu-latest @@ -171,7 +171,7 @@ jobs: uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main with: shard: ${{ matrix.shard }} - package: "stacks-node" + package: 'stacks-node' # Mutation testing - Execute on PR on stacks-signer package (normal run, no shards) pr-differences-mutants-stacks-signer-normal: @@ -180,7 +180,7 @@ jobs: needs: check-big-packages-and-shards if: | - ${{ needs.check-big-packages-and-shards.outputs.run_stacks_signer == 'true' }} + needs.check-big-packages-and-shards.outputs.run_stacks_signer == 'true' runs-on: ubuntu-latest @@ -188,7 +188,7 @@ jobs: - name: Run Run mutants on diffs uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main with: - package: "stacks-signer" + package: 'stacks-signer' # Output the mutants and fail the workflow if there are missed/timeout/unviable mutants output-mutants: From 50c1549a2171da19f867dfc6bc203a356de82e34 Mon Sep 17 00:00:00 2001 From: ASuciuX <151519329+ASuciuX@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:04:53 +0200 Subject: [PATCH 4/4] Update .github/workflows/pr-differences-mutants.yml Co-authored-by: Jeff Bencin --- .github/workflows/pr-differences-mutants.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-differences-mutants.yml b/.github/workflows/pr-differences-mutants.yml index 0e76c1c15..fc4a72568 100644 --- a/.github/workflows/pr-differences-mutants.yml +++ b/.github/workflows/pr-differences-mutants.yml @@ -185,7 +185,7 @@ jobs: runs-on: ubuntu-latest steps: - - name: Run Run mutants on diffs + - name: Run mutants on diffs uses: stacks-network/actions/stacks-core/mutation-testing/pr-differences@main with: package: 'stacks-signer'