@@ -20,16 +20,16 @@ jobs:
2020 env :
2121 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2222
23- test :
24- name : Tests (${{ matrix.ref }}, Scarb ${{ matrix.scarb-version }} )
23+ test-stable :
24+ name : Tests (${{ matrix.ref }}, Scarb stable )
2525 needs : get-latest-release
2626 runs-on : ubuntu-latest
2727 strategy :
28+ fail-fast : false
2829 matrix :
2930 ref :
3031 - main
3132 - ${{ needs.get-latest-release.outputs.latest-tag }}
32- scarb-version : [latest, nightly]
3333 steps :
3434 - uses : actions/checkout@v6
3535 with :
@@ -39,16 +39,41 @@ jobs:
3939 - uses : hrishikesh-kadam/setup-lcov@6c1aa0cc9e1c02f9f58f01ac599f1064ccc83470 # v1.1.0
4040 - uses : software-mansion/setup-scarb@2a96b748888e3329ee44ac9ac073d930e692b3cd # v1.5.1
4141 with :
42- scarb-version : ${{ matrix.scarb-version }}
42+ scarb-version : latest
4343 - uses : foundry-rs/setup-snfoundry@16e23ddd0e2845f38727c92f4b913a7b728cda9e # v6.0.0
4444 - run : cargo test --release --features allows-excluding-macros
4545
46- notify_failed :
46+ test-nightly :
47+ name : Tests (${{ matrix.ref }}, Scarb nightly)
48+ needs : get-latest-release
49+ runs-on : ubuntu-latest
50+ strategy :
51+ fail-fast : false
52+ matrix :
53+ ref :
54+ - main
55+ - ${{ needs.get-latest-release.outputs.latest-tag }}
56+ steps :
57+ - uses : actions/checkout@v6
58+ with :
59+ ref : ${{ matrix.ref }}
60+ - uses : dtolnay/rust-toolchain@stable
61+ - uses : Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
62+ - uses : hrishikesh-kadam/setup-lcov@6c1aa0cc9e1c02f9f58f01ac599f1064ccc83470 # v1.1.0
63+ - uses : software-mansion/setup-scarb@2a96b748888e3329ee44ac9ac073d930e692b3cd # v1.5.1
64+ with :
65+ scarb-version : nightly
66+ - uses : foundry-rs/setup-snfoundry@16e23ddd0e2845f38727c92f4b913a7b728cda9e # v6.0.0
67+ - run : cargo test --release --features allows-excluding-macros
68+
69+ # Stable failures always notify — no deduplication.
70+ notify_stable_failed :
71+ name : Notify on stable failure
4772 runs-on : ubuntu-latest
48- if : always() && failure()
49- needs : [test]
73+ if : always() && needs.test-stable.result == ' failure'
74+ needs : [test-stable ]
5075 steps :
51- - name : Notifying about check fail!
76+ - name : Notifying about stable check fail!
5277 uses : slackapi/slack-github-action@v3.0.3
5378 with :
5479 webhook : ${{ secrets.SLACK_SCHEDULED_CHECK_FAILURE_WEBHOOK_URL }}
5782 {
5883 "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
5984 }
85+
86+ # Nightly failures notify only once per Scarb stable version. The cache key is
87+ # the current Scarb stable release tag, so a new stable release resets alerting
88+ # automatically (the key changes -> cache miss -> notification allowed again).
89+ notify_nightly_failed :
90+ name : Notify on nightly failure (deduped per Scarb stable)
91+ runs-on : ubuntu-latest
92+ if : always() && needs.test-nightly.result == 'failure'
93+ needs : [test-nightly]
94+ steps :
95+ - name : Get current Scarb stable version
96+ id : stable
97+ run : |
98+ VER=$(gh release list --repo software-mansion/scarb \
99+ --exclude-pre-releases --limit 1 \
100+ --json tagName -q '.[0].tagName')
101+ echo "version=$VER" >> "$GITHUB_OUTPUT"
102+ env :
103+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
104+
105+ - name : Check if already notified for this Scarb stable
106+ id : dedup
107+ uses : actions/cache/restore@v4
108+ with :
109+ path : .notified
110+ key : notified-scarb-nightly-${{ steps.stable.outputs.version }}
111+
112+ - name : Notifying about nightly check fail!
113+ if : steps.dedup.outputs.cache-hit != 'true'
114+ uses : slackapi/slack-github-action@v3.0.3
115+ with :
116+ webhook : ${{ secrets.SLACK_SCHEDULED_CHECK_FAILURE_WEBHOOK_URL }}
117+ webhook-type : webhook-trigger
118+ payload : |
119+ {
120+ "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
121+ }
122+
123+ - name : Record that we notified for this stable
124+ if : steps.dedup.outputs.cache-hit != 'true'
125+ run : mkdir -p .notified && echo "${{ github.run_id }}" > .notified/run
126+
127+ - name : Save notification marker
128+ if : steps.dedup.outputs.cache-hit != 'true'
129+ uses : actions/cache/save@v4
130+ with :
131+ path : .notified
132+ key : notified-scarb-nightly-${{ steps.stable.outputs.version }}
0 commit comments