-
Notifications
You must be signed in to change notification settings - Fork 5
117 lines (111 loc) · 3.33 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
name: CI
# Triggers the workflow on pushes to main branch or any pull request
on:
push:
branches:
- main
pull_request:
branches: '*'
env:
## Sets environment variable
DEPLOY_ACCOUNT_KEY: ${{ secrets.DEPLOY_ACCOUNT_KEY }}
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
ALCHEMY_ARB_API_KEY: ${{ secrets.ALCHEMY_ARB_API_KEY }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
LLAMA_API_KEY: ${{ secrets.LLAMA_API_KEY}}
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Verify that the code is formatted correctly
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v1
with:
node-version: 18
- name: Cache
uses: actions/cache@v2
id: cache
with:
path: '**/node_modules'
key: yarn-v1-${{ hashFiles('**/yarn.lock') }}
- name: Install
run: yarn --immutable
if: steps.cache.outputs.cache-hit != 'true'
- name: Lint
run: yarn lint
# Verify that the build passes
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v1
with:
node-version: 18
- name: Cache
uses: actions/cache@v2
id: cache
with:
path: '**/node_modules'
key: yarn-v1-${{ hashFiles('**/yarn.lock') }}
- name: Install
run: yarn --immutable
if: steps.cache.outputs.cache-hit != 'true'
- name: Build
run: yarn build
# Verify that integration tests pass
test:
name: 'Run Integration Test'
# The type of runner that the job will run on
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Check out repository
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up node
uses: actions/setup-node@v2
with:
node-version: 18
- name: Node module cache
uses: actions/cache@v2
id: cache
with:
path: '**/node_modules'
key: npm-v2-${{ hashFiles('**/yarn.lock') }}
restore-keys: npm-v2-
- name: Install dependencies
run: |
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
if: steps.cache.outputs.cache-hit != 'true'
- name: Hardhat artifact cache
uses: actions/cache@v2
id: hardhat-cache
with:
path: 'artifacts'
key: artifacts-${{ hashFiles('contracts/**/*.sol') }}
restore-keys: |
artifacts-
- name: Hardhat compile
run: yarn hardhat compile
if: steps.hardhat-cache.outputs.cache-hit != 'true'
- name: Run Test
run: yarn hardhat test
timeout-minutes: 30
env:
# pass GitHub token to allow accurately detecting a build vs a re-run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}