-
Notifications
You must be signed in to change notification settings - Fork 93
189 lines (162 loc) · 5.81 KB
/
ci.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: CI
on:
push:
branches:
- master
pull_request:
env:
# Etherscan API keys.
ARBISCAN_API_KEY: ${{ secrets.ARBISCAN_API_KEY }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} # Mainnet.
OPTIMISTIC_ETHERSCAN_API_KEY: ${{ secrets.OPTIMISTIC_ETHERSCAN_API_KEY }}
POLYGONSCAN_API_KEY: ${{ secrets.POLYGONSCAN_API_KEY }}
# Subgraphs
MAINNET_SUBGRAPH_URL: ${{ secrets.MAINNET_SUBGRAPH_URL }}
OPTIMISM_SUBGRAPH_URL: ${{ secrets.OPTIMISM_SUBGRAPH_URL }}
GNOSIS_CHAIN_SUBGRAPH_URL: ${{ secrets.GNOSIS_CHAIN_SUBGRAPH_URL }}
POLYGON_SUBGRAPH_URL: ${{ secrets.POLYGON_SUBGRAPH_URL }}
BASE_SUBGRAPH_URL: ${{ secrets.BASE_SUBGRAPH_URL }}
ARBITRUM_ONE_SUBGRAPH_URL: ${{ secrets.ARBITRUM_ONE_SUBGRAPH_URL }}
SEPOLIA_SUBGRAPH_URL: ${{ secrets.SEPOLIA_SUBGRAPH_URL }}
# Other.
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
POLYGON_RPC_URL: ${{ secrets.POLYGON_RPC_URL }}
OPTIMISM_RPC_URL: ${{ secrets.OPTIMISM_RPC_URL }}
ARBITRUM_ONE_RPC_URL: ${{ secrets.ARBITRUM_ONE_RPC_URL }}
SEPOLIA_RPC_URL: ${{ secrets.SEPOLIA_RPC_URL }}
GNOSIS_CHAIN_RPC_URL: ${{ secrets.GNOSIS_CHAIN_RPC_URL }}
BASE_RPC_URL: $${{ secrets.BASE_RPC_URL }}
FOUNDRY_PROFILE: ci
WALLET_CONNECT_PROJECT_ID: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: volta-cli/action@v4
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
- run: yarn list
- run: yarn install --frozen-lockfile --verbose --network-concurrency 1
- run: yarn build
- name: Upload frontend build
uses: actions/upload-artifact@v4
with:
name: frontend
path: |
frontend/dist/spa
fleek.config.json
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: volta-cli/action@v4
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
- run: yarn install --network-concurrency 1
- name: Run tests
run: yarn test
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: volta-cli/action@v4
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
- run: yarn install
- name: Run coverage
run: yarn coverage
- name: Merge directories
run: |
sudo apt update && sudo apt install -y lcov
lcov \
--add-tracefile ./contracts-periphery/lcov.info \
--add-tracefile ./umbra-js/coverage/lcov.info \
--output-file lcov.info \
--rc lcov_branch_coverage=1
# To ignore coverage for certain directories modify the paths in this step as needed.
# Alternatively, to include coverage in all directories, comment out this step.
- name: Filter directories
run: |
lcov --remove ./lcov.info 'contracts-periphery/test/*' 'contracts-periphery/script/*' \
--output-file lcov.info \
--rc lcov_branch_coverage=1
# This step posts a detailed coverage report as a comment and deletes previous comments on
# each push. The below step is used to fail coverage if the specified coverage threshold is
# not met. The below step can post a comment (when it's `github-token` is specified) but it's
# not as useful, and this action cannot fail CI based on a minimum coverage threshold, which
# is why we use both in this way.
- name: Post coverage report
if: github.event_name == 'pull_request' # This action fails when ran outside of a pull request.
uses: romeovs/lcov-reporter-action@v0.3.1
with:
delete-old-comments: true
lcov-file: ./lcov.info
github-token: ${{ secrets.GITHUB_TOKEN }} # Adds a coverage summary comment to the PR.
- name: Verify minimum coverage
uses: zgosalvez/github-actions-report-lcov@v2
with:
coverage-files: ./lcov.info
minimum-coverage: 70 # Set coverage threshold.
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: volta-cli/action@v4
- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly
- name: Install scopelint
uses: engineerd/configurator@v0.0.8
with:
name: scopelint
repo: ScopeLift/scopelint
fromGitHubReleases: true
version: latest
pathInArchive: scopelint-x86_64-linux/scopelint
urlTemplate: https://github.com/ScopeLift/scopelint/releases/download/{{version}}/scopelint-x86_64-linux.tar.xz
token: ${{ secrets.GITHUB_TOKEN }}
- run: yarn install
- name: Run yarn lint
run: yarn lint
- name: Run scopelint
run: |
cd contracts-periphery
scopelint --version
scopelint check
deploy-to-fleek:
needs: [build]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
env:
FLEEK_TOKEN: ${{ secrets.FLEEK_TOKEN }}
FLEEK_PROJECT_ID: ${{ secrets.FLEEK_PROJECT_ID }}
steps:
- name: Download frontend
uses: actions/download-artifact@v4
with:
name: frontend
- uses: volta-cli/action@v4
- name: Look at directory
run: ls -la
- name: Install Typescript
run: volta run yarn global add typescript@^4.0.3
- name: Install Fleek CLI
run: volta run yarn global add @fleekxyz/cli
- name: Build & deploy sites
run: volta run fleek sites deploy