-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (54 loc) · 1.56 KB
/
test.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
name: CI
on: [push, pull_request]
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true
jobs:
lint:
name: Run Tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '^1.22.3'
- name: Cache Go Modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install Dependencies
run: go clean && go mod download && go mod verify
- name: Check Formatting
run: |
output=$(gofmt -l .)
if [ -n "$output" ]; then
echo "The following files need formatting:"
echo "$output"
exit 1
else
echo "All files are properly formatted."
fi
- name: Run Static Code Analysis
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest && golangci-lint run
- name: Run Unit Tests
run: bash coverage.sh
- name: Upload Test Coverage
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: coverage.out
- name: Build
run: go build -o wpokt-oracle .
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: wpokt-oracle
path: wpokt-oracle