-
Notifications
You must be signed in to change notification settings - Fork 22
133 lines (124 loc) · 3.63 KB
/
ci.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
126
127
128
129
130
131
132
133
name: CI
on: [push , pull_request]
jobs:
install_dependencies:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: |
npm install
npm run cp-ci-env
- uses: bissolli/gh-action-persist-workspace@v1
with:
action: persist
# test:
# runs-on: ubuntu-latest
# needs: install_dependencies
# steps:
# - uses: bissolli/gh-action-persist-workspace@v1
# with:
# action: retrieve
# - name: Run tests
# run: |
# CI=true npm run test
# - name: Store artifacts
# uses: actions/upload-artifact@v2
# with:
# name: test
# path: test
# scenarios:
# runs-on: ubuntu-latest
# needs: install_dependencies
# steps:
# - uses: bissolli/gh-action-persist-workspace@v1
# with:
# action: retrieve
# - name: Run scenarios
# run: |
# CI=true npm run scenarios
# - name: Store artifacts
# uses: actions/upload-artifact@v2
# with:
# name: scenarios
# path: scenarios
# lint:
# runs-on: ubuntu-latest
# needs: install_dependencies
# steps:
# - uses: bissolli/gh-action-persist-workspace@v1
# with:
# action: retrieve
# - name: Run Lint
# run: npm run lint
# - name: Store artifacts
# uses: actions/upload-artifact@v2
# with:
# name: lint
# path: lint
# coverage:
# runs-on: ubuntu-latest
# needs: install_dependencies
# steps:
# - uses: bissolli/gh-action-persist-workspace@v1
# with:
# action: retrieve
# - name: Run Coverage
# run: npm run coverage
# - name: Upload coverage to Coveralls
# uses: coverallsapp/github-action@v2
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# - name: Store artifacts
# uses: actions/upload-artifact@v2
# with:
# name: coverage
# path: coverage
# slither:
# runs-on: ubuntu-latest
# needs: install_dependencies
# steps:
# - uses: bissolli/gh-action-persist-workspace@v1
# with:
# action: retrieve
# - name: Run Slither
# uses: crytic/[email protected]
# id: slither
# with:
# node-version: 16
# sarif: results.sarif
# fail-on: high
gasCompare:
runs-on: ubuntu-latest
needs: install_dependencies
steps:
- uses: bissolli/gh-action-persist-workspace@v1
with:
action: retrieve
- name: Run GasCompare
run: |
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
BRANCH_NAME=$GITHUB_HEAD_REF
else
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g')
fi
echo "Current branch is $BRANCH_NAME"
if [ "$BRANCH_NAME" == "master" ]; then
echo "This is the master branch. Exiting..."
exit 0
fi
npm run test
mv ./gasReporterOutput.json /tmp/gasReporterOutput_Current.json
git checkout master
npm install
npm run test
mv ./gasReporterOutput.json /tmp/gasReporterOutput_Master.json
git checkout $BRANCH_NAME # Checkout back to the original branch
npm run gasCompare /tmp/gasReporterOutput_Current.json /tmp/gasReporterOutput_Master.json