Skip to content

Commit af036f2

Browse files
committed
make+gh: run unit tests
1 parent 88001a2 commit af036f2

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

.github/workflows/main.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
pull_request:
8+
branches:
9+
- "*"
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
15+
env:
16+
# go needs absolute directories, using the $HOME variable doesn't work here.
17+
GOCACHE: /home/runner/work/go/pkg/build
18+
GOPATH: /home/runner/work/go
19+
GO_VERSION: 1.22.3
20+
21+
jobs:
22+
########################
23+
# run unit tests
24+
########################
25+
unit-test:
26+
name: run unit tests
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: git checkout
30+
uses: actions/checkout@v3
31+
32+
- name: go cache
33+
uses: actions/cache@v3
34+
with:
35+
path: /home/runner/work/go
36+
key: btclog-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
37+
restore-keys: |
38+
btclog-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
39+
btclog-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-
40+
btclog-${{ runner.os }}-go-${{ env.GO_VERSION }}-
41+
btclog-${{ runner.os }}-go-
42+
43+
- name: setup go ${{ env.GO_VERSION }}
44+
uses: actions/setup-go@v3
45+
with:
46+
go-version: '~${{ env.GO_VERSION }}'
47+
48+
- name: run unit tests
49+
run: make unit

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
PKG := github.com/lightninglabs/btclog
2+
3+
GOLIST := go list -deps $(PKG)/... | grep '$(PKG)'| grep -v '/vendor/'
4+
GOTEST := go test -v
5+
6+
XARGS := xargs -L 1
7+
UNIT := $(GOLIST) | $(XARGS) env $(GOTEST) $(TEST_FLAGS)
8+
9+
unit:
10+
@$(call print, "Running unit tests.")
11+
$(UNIT)

0 commit comments

Comments
 (0)