-
Notifications
You must be signed in to change notification settings - Fork 79
67 lines (60 loc) · 2.05 KB
/
ci.protocol.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
name: Protocol
on:
pull_request:
types: [opened, synchronize]
paths:
- "protocol/**"
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v3
with:
node-version: "18"
- run: yarn add prettier
- run: yarn add prettier-plugin-solidity
- run: shopt -s globstar; yarn prettier --write --config .prettierrc --plugin=prettier-plugin-solidity protocol/**/*.sol || true
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: prettier auto formatting changes
branch: ${{ github.head_ref }}
- name: check format
run: shopt -s globstar; yarn prettier --check --config .prettierrc --plugin=prettier-plugin-solidity protocol/**/*.sol
test:
needs: format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Protocol Tests
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Cache Node Modules
id: node-modules-cache
uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
- run: yarn generate
working-directory: protocol
- name: Clear cache and reinstall on generate failure
if: steps.generate-with-cache.outcome == 'failure' && steps.node-modules-cache.outputs.cache-hit == 'true'
run: |
rm -rf **/node_modules
yarn install --no-immutable
- name: Generate (after potential cache clear)
if: steps.generate-with-cache.outcome == 'failure'
run: yarn generate
working-directory: protocol
- name: Run tests
run: yarn test
env:
FORKING_RPC: ${{ secrets.ANVIL_FORK_URL }}
working-directory: protocol