Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 113 additions & 2 deletions .github/workflows/scheduled_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,34 @@ on:
workflow_dispatch:

jobs:
test:
name: Tests (latest)
get-latest-release:
name: Get latest release tag
runs-on: ubuntu-latest
outputs:
latest-tag: ${{ steps.get-tag.outputs.tag }}
steps:
- name: Get latest release tag
id: get-tag
run: |
TAG=$(gh release list --repo ${{ github.repository }} --limit 1 --json tagName -q '.[0].tagName')
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test-stable:
name: Tests (${{ matrix.ref }}, Scarb stable)
needs: get-latest-release
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ref:
- main
- ${{ needs.get-latest-release.outputs.latest-tag }}
steps:
- uses: actions/checkout@v6
with:
ref: ${{ matrix.ref }}
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
- uses: hrishikesh-kadam/setup-lcov@6c1aa0cc9e1c02f9f58f01ac599f1064ccc83470 # v1.1.0
Expand All @@ -19,3 +42,91 @@ jobs:
scarb-version: latest
- uses: foundry-rs/setup-snfoundry@16e23ddd0e2845f38727c92f4b913a7b728cda9e # v6.0.0
- run: cargo test --release --features allows-excluding-macros

test-nightly:
name: Tests (${{ matrix.ref }}, Scarb nightly)
needs: get-latest-release
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ref:
- main
- ${{ needs.get-latest-release.outputs.latest-tag }}
steps:
- uses: actions/checkout@v6
with:
ref: ${{ matrix.ref }}
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
- uses: hrishikesh-kadam/setup-lcov@6c1aa0cc9e1c02f9f58f01ac599f1064ccc83470 # v1.1.0
- uses: software-mansion/setup-scarb@2a96b748888e3329ee44ac9ac073d930e692b3cd # v1.5.1
with:
scarb-version: nightly
- uses: foundry-rs/setup-snfoundry@16e23ddd0e2845f38727c92f4b913a7b728cda9e # v6.0.0
- run: cargo test --release --features allows-excluding-macros

# Stable failures always notify — no deduplication.
notify_stable_failed:
name: Notify on stable failure
runs-on: ubuntu-latest
if: always() && needs.test-stable.result == 'failure'
needs: [test-stable]
steps:
- name: Notifying about stable check fail!
uses: slackapi/slack-github-action@v3.0.3
with:
webhook: ${{ secrets.SLACK_SCHEDULED_CHECK_FAILURE_WEBHOOK_URL }}
webhook-type: webhook-trigger
payload: |
{
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}

# Nightly failures notify only once per Scarb stable version. The cache key is
# the current Scarb stable release tag, so a new stable release resets alerting
# automatically (the key changes -> cache miss -> notification allowed again).
notify_nightly_failed:
name: Notify on nightly failure (deduped per Scarb stable)
runs-on: ubuntu-latest
if: always() && needs.test-nightly.result == 'failure'
needs: [test-nightly]
steps:
- name: Get current Scarb stable version
id: stable
run: |
VER=$(gh release list --repo software-mansion/scarb \
--exclude-pre-releases --limit 1 \
--json tagName -q '.[0].tagName')
echo "version=$VER" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check if already notified for this Scarb stable
id: dedup
uses: actions/cache/restore@v4
with:
path: .notified
key: notified-scarb-nightly-${{ steps.stable.outputs.version }}

- name: Notifying about nightly check fail!
if: steps.dedup.outputs.cache-hit != 'true'
uses: slackapi/slack-github-action@v3.0.3
with:
webhook: ${{ secrets.SLACK_SCHEDULED_CHECK_FAILURE_WEBHOOK_URL }}
webhook-type: webhook-trigger
payload: |
{
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}

- name: Record that we notified for this stable
if: steps.dedup.outputs.cache-hit != 'true'
run: mkdir -p .notified && echo "${{ github.run_id }}" > .notified/run

- name: Save notification marker
if: steps.dedup.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: .notified
key: notified-scarb-nightly-${{ steps.stable.outputs.version }}
Loading