-
Notifications
You must be signed in to change notification settings - Fork 10
125 lines (102 loc) · 2.8 KB
/
contracts.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
name: test contracts
defaults:
run:
working-directory: contracts
env:
FOUNDRY_PROFILE: ci
CI: true
FORCE_COLOR: true
on:
push:
branches: [main]
paths:
- ".github/workflows/contracts.yml"
- "contracts/**"
pull_request:
paths:
- ".github/workflows/contracts.yml"
- "contracts/**"
jobs:
test-foundry:
strategy:
fail-fast: true
name: Foundry tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build
- name: Run Forge tests
run: |
forge test -vvv
id: test
coverage-foundry:
name: Foundry coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build
- name: Run Forge coverage
run: |
forge coverage --report lcov
id: coverage
- name: Install lcov
run: sudo apt-get -y install lcov
- name: Filter out tests from coverage
run: |
lcov --remove lcov.info -o lcov.info 'src/test/*'
id: coverage_filter
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
base-path: ./contracts/
# Potential improvement to include merge with hardhat tests: https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/e91c3100c29d2913d175df4b3d1790d6a057d36e/solidity/coverage.sh
path-to-lcov: ./contracts/lcov.info
debug: true
console-logs:
name: Check we didn’t forget to remove console imports
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Check console imports
working-directory: contracts
run: >-
! grep -R console src | grep import | grep -v "://" | grep -v TestContracts | grep -v ExternalContracts | grep -v "\.t\.sol"
test-hardhat:
name: Hardhat tests
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Test contracts
run: yarn test