generated from FinTechIntro/HW-Template
-
Notifications
You must be signed in to change notification settings - Fork 1
176 lines (160 loc) · 5.7 KB
/
test.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Autograding Tests
'on':
- push
- repository_dispatch
permissions:
checks: write
actions: read
contents: read
jobs:
run-autograding-tests:
runs-on: ubuntu-latest
if: github.actor != 'github-classroom[bot]'
steps:
- name: Code Verification
uses: actions/checkout@v4
- name: Foundry Installation
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Forge Installation
run: |
cd hw
forge install
id: test
## Problem Template
# - name: Problem <id>
# id: problem-<id>
# uses: classroom-resources/autograding-command-grader@v1
# with:
# test-name: Problem <id>
# command: cd hw && forge test --mt <foundry-test-name>
# timeout: <time-limit>
# max-score: <max-score>
## LiaoToken
- name: LiaoToken
id: problem-1-1
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: LiaoToken::transfer
command: cd hw && forge test --mc LiaoTokenTest --mt test_check_transfer_points
timeout: 10
max-score: 5
- name: LiaoToken
id: problem-1-2
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: LiaoToken::approve
command: cd hw && forge test --mc LiaoTokenTest --mt test_check_approve_points
timeout: 10
max-score: 5
- name: LiaoToken
id: problem-1-3
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: LiaoToken::transferFrom
command: cd hw && forge test --mc LiaoTokenTest --mt test_check_transferFrom_points
timeout: 10
max-score: 5
## NFinTech
- name: NFinTech
id: problem-2-1
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: NFinTech::approve
command: cd hw && forge test --mc NFinTechTest --mt test_check_approve_function
timeout: 10
max-score: 5
- name: NFinTech
id: problem-2-2
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: NFinTech::setApproveForAll
command: cd hw && forge test --mc NFinTechTest --mt test_check_setApproveForAll
timeout: 10
max-score: 5
- name: NFinTech
id: problem-2-3
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: NFinTech::transferFrom
command: cd hw && forge test --mc NFinTechTest --mt test_check_transferFrom_points
timeout: 10
max-score: 5
- name: NFinTech
id: problem-2-4
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: NFinTech::safeTransferFrom
command: cd hw && forge test --mc NFinTechTest --mt test_check_safeTransferFrom
timeout: 10
max-score: 5
- name: NFinTech
id: problem-2-5
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: NFinTech::Mix
command: cd hw && forge test --mc NFinTechTest --mt test_check_mix_operation
timeout: 10
max-score: 10
## Loan
- name: Loan
id: problem-3-1
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: Loan::BadCaller
command: cd hw && forge test --mc BadCallerTest --mt testExploit
timeout: 10
max-score: 10
- name: Loan
id: problem-3-2
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: Loan::BadLender
command: cd hw && forge test --mc BadLenderTest --mt testExploit
timeout: 10
max-score: 10
- name: Delegation
id: problem-4-1
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: Delegation::Bank
command: cd hw && forge test --mc BankTest --mt testExploit
timeout: 10
max-score: 10
- name: Bank
id: problem-4-2
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: Delegation::UntrustedOracle
command: cd hw && forge test --mc UntrustedOracleTest --mt testExploit
timeout: 10
max-score: 10
- name: Vault
id: problem-5
uses: classroom-resources/autograding-command-grader@v1
with:
test-name: Vault
command: cd hw && forge test --mc VaultTest --mt testExploit
timeout: 10
max-score: 15
## Modify Autograding Reporter
## If new problems are added, remember to add new grading actions below
- name: Autograding Reporter
uses: classroom-resources/autograding-grading-reporter@v1
env:
PROBLEM-1-1_RESULTS: "${{steps.problem-1-1.outputs.result}}"
PROBLEM-1-2_RESULTS: "${{steps.problem-1-2.outputs.result}}"
PROBLEM-1-3_RESULTS: "${{steps.problem-1-3.outputs.result}}"
PROBLEM-2-1_RESULTS: "${{steps.problem-2-1.outputs.result}}"
PROBLEM-2-2_RESULTS: "${{steps.problem-2-2.outputs.result}}"
PROBLEM-2-3_RESULTS: "${{steps.problem-2-3.outputs.result}}"
PROBLEM-2-4_RESULTS: "${{steps.problem-2-4.outputs.result}}"
PROBLEM-2-5_RESULTS: "${{steps.problem-2-5.outputs.result}}"
PROBLEM-3-1_RESULTS: "${{steps.problem-3-1.outputs.result}}"
PROBLEM-3-2_RESULTS: "${{steps.problem-3-2.outputs.result}}"
PROBLEM-4-1_RESULTS: "${{steps.problem-4-1.outputs.result}}"
PROBLEM-4-2_RESULTS: "${{steps.problem-4-2.outputs.result}}"
PROBLEM-5_RESULTS: "${{steps.problem-5.outputs.result}}"
with:
runners: problem-1-1, problem-1-2, problem-1-3, problem-2-1, problem-2-2, problem-2-3, problem-2-4, problem-2-5, problem-3-1, problem-3-2, problem-4-1, problem-4-2, problem-5