-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (153 loc) · 6.32 KB
/
check-hardhat.yaml
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
name: Hardhat
on:
workflow_call:
inputs:
# Custom solidity hardhat parameters
hardhat-zksync-version:
type: string
description: 'Hardhat version'
required: false
zksync-contracts-version:
type: string
description: 'ZKsync contracts version'
required: false
zksync-ethers-version:
type: string
description: 'ZKsync ethers version'
required: false
# Solidity compiler parameters
zksolc-release-suffix:
type: string
description: 'zksolc artifact suffix to test'
required: false
default: ''
zksolc-version:
type: string
description: 'zksolc version to test'
required: false
default: ''
# Custom hardhat vyper parameters
hardhat-zksync-deploy-version:
type: string
description: 'Hardhat zksync deploy version'
required: false
hardhat-zksync-node-version:
type: string
description: 'Hardhat zksync node version'
required: false
hardhat-zksync-vyper-version:
type: string
description: 'Hardhat zksync vyper version'
required: false
# Vyper compiler parameters
zkvyper-release-suffix:
type: string
description: 'zkvyper artifact suffix to test'
required: false
default: ''
zkvyper-version:
type: string
description: 'zkvyper version to test'
required: false
default: ''
jobs:
# hardhat-solidity and hardhat-vyper jobs are supposed to check hardhat templates
# with the most recent version of Hardhat
# and with the most recent version of compilers
# This should be triggered when any new version of dependency is released
# new compiler is out - trigger it with the new compiler version
# new hardhat plugin version is out - trigger it with the new compiler version
# if CI fails, then the reasons may include:
# 1. new compiler version is not compatible with the code
# 2. new hardhat plugin version is not compatible with the code
# 3. templates and docs must be updated to support new versions of dependencies
hardhat-solidity:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: 'templates/hardhat/solidity'
shell: bash -ex {0}
steps:
- name: Check input parameters
if: ${{ inputs.zksolc-release-suffix != '' && inputs.zksolc-version != '' }}
run: |
echo "Both zksolc-release-suffix and zksolc-version are set. Please, choose only one of them."
exit 1
- name: Checkout
uses: actions/checkout@v4
with:
repository: matter-labs/zksync-contract-templates
- name: Patch hardhat
run: |
[ ! -z '${{ inputs.hardhat-zksync-version }}' ] && yarn add @matterlabs/hardhat-zksync@${{ inputs.hardhat-zksync-version }} || true
[ ! -z '${{ inputs.zksync-contracts-version }}' ] && yarn add @matterlabs/zksync-contracts@${{ inputs.zksync-contracts-version }} || true
[ ! -z '${{ inputs.zksync-ethers-version }}' ] && yarn add zksync-ethers@${{ inputs.zksync-ethers-version }} || true
- name: Download zksolc compiler
if: inputs.zksolc-release-suffix != ''
uses: actions/download-artifact@v4
with:
name: release-${{ inputs.zksolc-release-suffix }}
path: templates/hardhat/solidity/zksolc
- name: Update compiler path
if: inputs.zksolc-release-suffix != ''
run: |
ZKSOLC_PATH=$(readlink -f ./zksolc/${{ inputs.zksolc-release-suffix }}/zksolc-${{ inputs.zksolc-release-suffix }})
chmod a+x "${ZKSOLC_PATH}"
${ZKSOLC_PATH} --version
sed -i '/zksolc: {/,/settings: {/ { /version:/d }' hardhat.config.ts
sed -i "/settings: {/a\ compilerPath: \"${ZKSOLC_PATH}\"," hardhat.config.ts
cat hardhat.config.ts
- name: Update compiler config
if: inputs.zksolc-version == ''
run: |
sed -i 's/version: "latest"/version: "${{ inputs.zksolc-version }}"/' hardhat.config.ts
cat hardhat.config.ts
- name: Install dependencies
run: yarn install
- name: Run tests
run: yarn test
hardhat-vyper:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: 'templates/hardhat/vyper'
shell: bash -ex {0}
steps:
- name: Check input parameters
if: ${{ inputs.zkvyper-release-suffix != '' && inputs.zkvyper-version != '' }}
run: |
echo "Both zkvyper-release-suffix and zkvyper-version are set. Please, choose only one of them."
exit 1
- name: Checkout
uses: actions/checkout@v4
with:
repository: matter-labs/zksync-contract-templates
- name: Patch hardhat
run: |
[ ! -z '${{ inputs.hardhat-zksync-deploy-version }}' ] && yarn add @matterlabs/hardhat-zksync-deploy@${{ inputs.hardhat-zksync-deploy-version }} || true
[ ! -z '${{ inputs.hardhat-zksync-node-version }}' ] && yarn add @matterlabs/hardhat-zksync-node@${{ inputs.hardhat-zksync-node-version }} || true
[ ! -z '${{ inputs.hardhat-zksync-vyper-version }}' ] && yarn add @matterlabs/hardhat-zksync-vyper@${{ inputs.hardhat-zksync-vyper-version }} || true
- name: Download zkvyper compiler
if: inputs.zkvyper-release-suffix != ''
uses: actions/download-artifact@v4
with:
name: release-${{ inputs.zkvyper-release-suffix }}
path: templates/hardhat/vyper/zkvyper
- name: Update compiler path
if: inputs.zkvyper-release-suffix != ''
run: |
ZKVYPER_PATH=$(readlink -f ./zkvyper/${{ inputs.zkvyper-release-suffix }}/zkvyper-${{ inputs.zkvyper-release-suffix }})
chmod a+x "${ZKVYPER_PATH}"
${ZKVYPER_PATH} --version
sed -i '/zkvyper: {/,/settings: {/ { /version:/d }' hardhat.config.ts
sed -i "/settings: {/a\ compilerPath: \"${ZKVYPER_PATH}\"," hardhat.config.ts
cat hardhat.config.ts
- name: Update compiler config
if: inputs.zkvyper-version != ''
run: |
sed -i 's/version: "latest"/version: "${{ inputs.zkvyper-version }}"/' hardhat.config.ts
cat hardhat.config.ts
- name: Install dependencies
run: yarn install
- name: Run tests
run: yarn test