-
Notifications
You must be signed in to change notification settings - Fork 126
102 lines (88 loc) · 3.12 KB
/
unit-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
on:
pull_request:
# Commented paths to avoid skipping required workflow
# See https://github.community/t/feature-request-conditional-required-checks/16761
# paths:
# - .github/workflows/unit-tests.yml
# - "**/*.go"
# - "chain/**"
# - "cmd/**"
# - "dot/**"
# - "internal/**"
# - "lib/**"
# - "pkg/**"
# - "tests/**"
# - go.mod
# - go.sum
# - Makefile
name: unit-tests
jobs:
unit-tests:
timeout-minutes: 60
runs-on: buildjet-4vcpu-ubuntu-2204
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
all_but_latest: true
- uses: actions/setup-go@v5
with:
go-version: "1.23.2"
stable: true
check-latest: true
- name: Set cache variables
id: go-cache-paths
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
- uses: actions/checkout@v4
- name: Go build cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-build
- name: Go modules cache
uses: actions/cache@v4
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-mod
- name: Install Subkey
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
wget -P $HOME/.local/bin/ https://chainbridge.ams3.digitaloceanspaces.com/subkey-v2.0.0
mv $HOME/.local/bin/subkey-v2.0.0 $HOME/.local/bin/subkey
elif [ "$RUNNER_OS" == "macOS" ]; then
wget -P $HOME/.local/bin/ https://chainbridge.ams3.digitaloceanspaces.com/subkey-v2.0.0-macos
mv $HOME/.local/bin/subkey-v2.0.0-macos $HOME/.local/bin/subkey
else
echo "Subkey for $RUNNER_OS is not supported"
exit 1
fi
chmod +x $HOME/.local/bin/subkey
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Run devnet unit tests
run: |
cd devnet && \
go test -timeout=10m ./... && \
cd ..
- name: generate a shared library file for erasure
run: make compile-erasure
- name: Run unit tests
run: CI=buildjet go test -coverprofile=coverage.out -covermode=atomic -timeout=45m ./...
- name: Trie memory test
run: |
sed -i 's/const skip = true/const skip = false/g' ./pkg/trie/inmemory/mem_test.go
go test -run ^Test_Trie_MemoryUsage$ ./pkg/trie
sed -i 's/const skip = false/const skip = true/g' ./pkg/trie/inmemory/mem_test.go
- name: Test - Race
run: make test-using-race-detector
- uses: codecov/[email protected]
with:
if_ci_failed: success
informational: true
files: ./coverage.out
flags: unit-tests
name: coverage
verbose: true