-
Notifications
You must be signed in to change notification settings - Fork 70
149 lines (146 loc) · 4.57 KB
/
lint-and-tests.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Lint + Unit Tests
on:
push:
branches:
- main
pull_request:
env:
GO_VERSION: "1.21.7"
jobs:
lint:
name: Lint
runs-on: ubuntu-20.04
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.56.2
working-directory: .
args: --timeout 5m
- name: Install license check
run: go install github.com/google/[email protected]
- name: Check license
run: addlicense -f ./LICENSE.header -check -v ./**/*.go ./**/**/*.go ./**/**/**/*.go ./**/**/**/**/*.go
test:
name: Golang Unit Tests v${{ matrix.go }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
go: ["1.21.7"]
os: [ubuntu-20.04, macos-13]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- run: go mod download
- run: scripts/build.sh
- run: go test -v -coverprofile=coverage.out $(go list ./... | grep -v /tests/ | grep -v '/sdk/')
env:
CGO_CFLAGS: "-O -D__BLST_PORTABLE__" # Set the CGO flags to use the portable version of BLST
- run: go tool cover -func=coverage.out
e2e_test:
name: e2e tests
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
matrix:
suite:
[
"\\[APM\\]",
"\\[Error handling\\]",
"\\[Key\\]",
"\\[Network\\]",
"\\[Package Management\\]",
"\\[Root\\]",
"\\[Local Subnet\\]",
"\\[Subnet Compatibility\\]",
"\\[Public Subnet\\]",
"\\[Subnet\\]",
"\\[Upgrade expect network failure\\]",
"\\[Upgrade public network\\]",
"\\[Upgrade local network\\]",
"\\[Node create\\]",
"\\[Node devnet\\]",
"\\[Docker\\]",
]
os: [ubuntu-latest, macos-13]
exclude:
- os: macos-13
suite: "\\[Node create\\]"
- os: macos-13
suite: "\\[Node devnet\\]"
- os: macos-13
suite: "\\[Docker\\]"
- os: macos-13
suite: "\\[Public Subnet\\]"
steps:
- name: Git checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
#- name: DEBUG => Setup upterm session
# uses: lhotari/action-upterm@v1
# with:
# limit-access-to-actor: true
- name: Install macosx dependencies
if: ${{ matrix.os == 'macos-13' }}
run: |
brew install python-setuptools
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "16.x"
- name: Yarn install
uses: nick-fields/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
retry_on: error
command: yarn --cwd ./tests/e2e/hardhat
- name: ts-node install
shell: bash
run: |
npm install -g typescript
npm install -g ts-node
npm install -g tsx
- name: Install docker on macos
if: ${{ (matrix.os == 'macos-13') && (matrix.suite == '\\[Public Subnet\\]') }}
run: |
brew install docker
brew install colima
colima start --vm-type vz
sudo ln -s ~/.colima/default/docker.sock /var/run/docker.sock
- name: generate ssh token for e2e tests
run: |
mkdir -p ~/.ssh && ssh-keygen -b 2048 -t rsa -f ~/.ssh/runner-avalanche-cli-keypair -q -N ""
echo "E2E_SSH_PUB_KEY<<EOF" >> $GITHUB_ENV
cat ~/.ssh/runner-avalanche-cli-keypair >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ env.E2E_SSH_PUB_KEY }}
- name: Run e2e tests
shell: bash
run: AVALANCHE_CLI_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} LEDGER_SIM=true scripts/run.e2e.sh --filter "${{ matrix.suite }}"
- name: "Upload Artifact"
if: always()
uses: actions/upload-artifact@v3
with:
name: cli-logs-${{ matrix.os }}
path: |
~/.avalanche-cli/
!~/.avalanche-cli/bin/
!~/.avalanche-cli/snapshots
retention-days: 5
#- name: "DEBUG => Sleep for 6 hours"
# if: always()
# run: sleep 6h