Skip to content

Commit 4803941

Browse files
committed
ci: add github actions
1 parent 4baf88c commit 4803941

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed

.github/workflows/main.yml

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
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+
GO111MODULE: on
20+
21+
# If you change this value, please change it in the following files as well:
22+
# /Dockerfile
23+
GO_VERSION: 1.17
24+
25+
jobs:
26+
########################
27+
# RPC compile and check
28+
########################
29+
rpc-check:
30+
name: RPC compilation check
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: git checkout
34+
uses: actions/checkout@v2
35+
36+
- name: setup go ${{ env.GO_VERSION }}
37+
uses: actions/setup-go@v2
38+
with:
39+
go-version: '~${{ env.GO_VERSION }}'
40+
41+
- name: RPC for JS compilation
42+
run: make rpc-js-compile
43+
44+
- name: run check
45+
run: make rpc-check
46+
47+
########################
48+
# go mod check
49+
########################
50+
mod-check:
51+
name: go mod check
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: git checkout
55+
uses: actions/checkout@v2
56+
57+
- name: setup go ${{ env.GO_VERSION }}
58+
uses: actions/setup-go@v2
59+
with:
60+
go-version: '~${{ env.GO_VERSION }}'
61+
62+
- name: run check
63+
run: make mod-check
64+
65+
########################
66+
# build and lint code
67+
########################
68+
lint:
69+
name: build and lint code
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: git checkout
73+
uses: actions/checkout@v2
74+
with:
75+
fetch-depth: 0
76+
77+
- name: go cache
78+
uses: actions/cache@v1
79+
with:
80+
path: /home/runner/work/go
81+
key: lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
82+
restore-keys: |
83+
loop-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
84+
loop-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-
85+
loop-${{ runner.os }}-go-${{ env.GO_VERSION }}-
86+
loop-${{ runner.os }}-go-
87+
88+
- name: setup go ${{ env.GO_VERSION }}
89+
uses: actions/setup-go@v2
90+
with:
91+
go-version: '~${{ env.GO_VERSION }}'
92+
93+
- name: build
94+
run: make build tags=dev
95+
96+
- name: lint
97+
run: make lint
98+
99+
########################
100+
# run unit tests
101+
########################
102+
unit-test:
103+
name: run unit tests
104+
runs-on: ubuntu-latest
105+
steps:
106+
- name: git checkout
107+
uses: actions/checkout@v2
108+
109+
- name: go cache
110+
uses: actions/cache@v1
111+
with:
112+
path: /home/runner/work/go
113+
key: lnd-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
114+
restore-keys: |
115+
loop-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
116+
loop-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-
117+
loop-${{ runner.os }}-go-${{ env.GO_VERSION }}-
118+
loop-${{ runner.os }}-go-
119+
120+
- name: setup go ${{ env.GO_VERSION }}
121+
uses: actions/setup-go@v2
122+
with:
123+
go-version: '~${{ env.GO_VERSION }}'
124+
125+
- name: run unit tests
126+
run: make unit

0 commit comments

Comments
 (0)