Skip to content

Scheduled

Scheduled #97

Workflow file for this run

name: Scheduled
on:
pull_request:
paths:
- scripts/get_scarb_versions.sh
- .github/workflows/scheduled.yml
schedule:
- cron: '0 0 * * 3,0'
workflow_dispatch:
jobs:
get-scarb-versions:
if: github.event.repository.fork == false
name: Get Scarb versions
outputs:
versions: ${{ steps.get_versions.outputs.versions }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
with:
tool_versions: |
scarb latest
- name: Get versions
id: get_versions
run: |
scarb_versions=$(./scripts/get_scarb_versions.sh)
echo ${scarb_versions[@]}
echo "versions=[${scarb_versions[@]}]" >> "$GITHUB_OUTPUT"
test-forge-unit-and-integration:
if: github.event.repository.fork == false
runs-on: ubuntu-latest
needs: get-scarb-versions
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.get-scarb-versions.outputs.versions) }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: ${{ matrix.version }}
- uses: software-mansion/setup-universal-sierra-compiler@v1
- run: cargo test --release --lib -p forge
- run: cargo test --release -p forge integration --features assert_non_exact_gas
test-forge-e2e:
if: github.event.repository.fork == false
runs-on: ubuntu-latest
needs: get-scarb-versions
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.get-scarb-versions.outputs.versions) }}
steps:
- name: Extract branch name
if: github.event_name != 'pull_request'
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
- name: Extract branch name on pull request
if: github.event_name == 'pull_request'
run: echo "BRANCH_NAME=$(echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV
- name: Extract repo name and owner
if: github.event_name != 'pull_request'
run: echo "REPO_NAME=$(echo ${{ github.repository }}.git)" >> $GITHUB_ENV
- name: Extract repo name and owner on pull request
if: github.event_name == 'pull_request'
run: echo "REPO_NAME=$(echo ${{ github.event.pull_request.head.repo.full_name }}.git)" >> $GITHUB_ENV
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: ${{ matrix.version }}
- uses: software-mansion/setup-universal-sierra-compiler@v1
- name: Install cairo-profiler
run: |
curl -L https://raw.githubusercontent.com/software-mansion/cairo-profiler/main/scripts/install.sh | sh
- name: Install cairo-coverage
run: |
curl -L https://raw.githubusercontent.com/software-mansion/cairo-coverage/main/scripts/install.sh | sh
- uses: taiki-e/install-action@nextest
- run: cargo test --release -p forge e2e
test-cast:
if: github.event.repository.fork == false
runs-on: ubuntu-latest
needs: get-scarb-versions
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.get-scarb-versions.outputs.versions) }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: ${{ matrix.version }}
- uses: software-mansion/setup-universal-sierra-compiler@v1
- name: Install starknet-devnet-rs
run: ./scripts/install_devnet.sh
- run: cargo test --release -p sncast
get-version:
name: Get current foundry version
if: github.event.repository.fork == false
runs-on: ubuntu-latest
outputs:
version: ${{ steps.validVersion.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Get version from Cargo.toml
id: lookupVersion
uses: mikefarah/yq@8bf425b4d1344db7cd469a8d10a390876e0c77fd
with:
cmd: yq -oy '.workspace.package.version' 'Cargo.toml'
- name: Return version
id: validVersion
run: |
COMMIT_VERSION=${{ steps.lookupVersion.outputs.result }}
echo "Project version from this commit = $COMMIT_VERSION"
echo "version=$COMMIT_VERSION" >> "$GITHUB_OUTPUT"
build-plugin-binaries:
name: Build plugin binaries
needs: get-version
uses: ./.github/workflows/_build-plugin-binaries.yml
with:
overridden_plugin_version: ${{ needs.get-version.outputs.version }}-test.${{ github.run_id }}
publish-plugin:
needs: [get-version, build-plugin-binaries]
uses: ./.github/workflows/_publish-plugin.yml
secrets: inherit
with:
overridden_plugin_version: ${{ needs.get-version.outputs.version }}-test.${{ github.run_id }}
publish-std:
needs: [get-version, publish-plugin]
uses: ./.github/workflows/publish-std.yml
secrets: inherit
with:
plugin_dep_version: ${{ needs.get-version.outputs.version }}-test.${{ github.run_id }}
override_std_version: ${{ needs.get-version.outputs.version }}-test.${{ github.run_id }}
build-binaries:
needs: [get-version]
uses: ./.github/workflows/_build-binaries.yml
with:
version: ${{ needs.get-version.outputs.version }}-test.${{ github.run_id }}
test-binary:
name: Test binary
needs: [ build-binaries, get-version, publish-std ]
uses: ./.github/workflows/_test-binaries.yml
secrets: inherit
with:
bin_version: ${{ needs.get-version.outputs.version }}-test.${{ github.run_id }}
std_version: ${{ needs.get-version.outputs.version }}-test.${{ github.run_id }}
notify_if_failed:
runs-on: ubuntu-latest
if: always() && contains(needs.*.result, 'failure') && github.event_name == 'schedule'
needs: [ test-forge-unit-and-integration, test-forge-e2e, test-cast , build-plugin-binaries, build-binaries, publish-plugin, publish-std, test-binary ]
steps:
- name: Notify that the workflow has failed
uses: slackapi/[email protected]
with:
webhook: ${{ secrets.SLACK_SCHEDULED_TESTS_FAILURE_WEBHOOK_URL }}
webhook-type: webhook-trigger
payload: |
url: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"