-
Notifications
You must be signed in to change notification settings - Fork 185
130 lines (112 loc) · 4.27 KB
/
scheduled.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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"
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"
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@82a92a6e8fbeee089604da2575dc567ae9ddeaab
- 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
test-forge-e2e:
if: "! github.event.repository.fork"
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@82a92a6e8fbeee089604da2575dc567ae9ddeaab
- 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
- uses: taiki-e/install-action@nextest
- run: cargo test --release -p forge e2e
test-cast:
if: "! github.event.repository.fork"
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@82a92a6e8fbeee089604da2575dc567ae9ddeaab
- 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
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 ]
steps:
- name: Notify that the workflow has failed
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_SCHEDULED_TESTS_FAILURE_WEBHOOK_URL }}
with:
payload: |
{
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}