Skip to content

Commit 83ffd98

Browse files
committed
add ci checks
1 parent 062942e commit 83ffd98

File tree

5 files changed

+94
-5
lines changed

5 files changed

+94
-5
lines changed

.github/ci.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 'feature/**'
8+
- 'v**'
9+
pull_request:
10+
branches:
11+
- master
12+
- 'feature/**'
13+
- 'v**'
14+
15+
jobs:
16+
test:
17+
name: Test
18+
runs-on: ubuntu-20.04
19+
steps:
20+
- name: Install dependencies
21+
run: sudo apt-get update && sudo apt-get install wabt
22+
- uses: actions/checkout@v2
23+
with:
24+
fetch-depth: 0
25+
- uses: actions/setup-go@v2
26+
with:
27+
go-version: '1.18.x'
28+
- uses: actions/setup-node@v2
29+
with:
30+
node-version: '15'
31+
- uses: actions/cache@v1
32+
with:
33+
path: ~/go/pkg/mod
34+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
35+
restore-keys: |
36+
${{ runner.os }}-go-
37+
- name: Test
38+
run: make
39+
- name: Check tidy
40+
run: make check-tidy
41+
42+
lint:
43+
name: Lint
44+
runs-on: ubuntu-20.04
45+
steps:
46+
- uses: actions/checkout@v2
47+
with:
48+
fetch-depth: 0
49+
- uses: actions/setup-go@v2
50+
with:
51+
go-version: '1.18.1'
52+
- uses: actions/cache@v1
53+
with:
54+
path: ~/go/pkg/mod
55+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
56+
restore-keys: |
57+
${{ runner.os }}-go-
58+
- name: Check license headers
59+
run: make check-headers
60+
- name: Check capabilities of dependencies
61+
run: make check-capabilities

Makefile

+23
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ VERSION ?= $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
22

33
BINARY ?= cadence-analyzer
44

5+
LINTERS :=
6+
ifneq ($(linters),)
7+
LINTERS = -E $(linters)
8+
endif
9+
510
.PHONY: test
611
test:
712
go test -v -parallel 4 ./...
@@ -32,3 +37,21 @@ publish:
3237
clean:
3338
rm -f cadence-analyzer*
3439

40+
.PHONY: check-capabilities
41+
check-capabilities:
42+
go install github.com/cugu/[email protected]
43+
go mod download
44+
gocap check .
45+
46+
.PHONY: generate
47+
generate:
48+
go generate -v ./...
49+
50+
.PHONY: check-headers
51+
check-headers:
52+
@./check-headers.sh
53+
54+
.PHONY: check-tidy
55+
check-tidy: generate
56+
go mod tidy
57+
git diff --exit-code

check-headers.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
files=$(find . -name \*.go -type f -print0 | xargs -0 grep -L -E '(Licensed under the Apache License)|(Code generated (from|by))')
4+
if [ -n "$files" ]; then
5+
echo "Missing license header in:"
6+
echo "$files"
7+
exit 1
8+
fi

go.mod

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ require (
99
github.com/onflow/flow-go-sdk v0.26.1
1010
github.com/spf13/afero v1.8.2
1111
github.com/stretchr/testify v1.7.3
12-
golang.org/x/tools v0.1.10
1312
)
1413

1514
require (

go.sum

+2-4
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,6 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce
176176
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
177177
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
178178
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
179-
github.com/bits-and-blooms/bitset v1.2.2 h1:J5gbX05GpMdBjCvQ9MteIg2KKDExr7DrgK+Yc15FvIk=
180-
github.com/bits-and-blooms/bitset v1.2.2/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
181179
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
182180
github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
183181
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
@@ -1359,8 +1357,8 @@ github.com/onflow/cadence v0.21.3-0.20220513161637-08b93d4bb7b9/go.mod h1:vNIxF1
13591357
github.com/onflow/cadence v0.21.3-0.20220601002855-8b113c539a2c/go.mod h1:FliGP1FZLEuSemnSf8pKItDzW7E2cvPukx/SsE1+oCo=
13601358
github.com/onflow/cadence v0.24.0/go.mod h1:tIJiQ4RIq1WUTXdBewv8p+gNUETN93Eb7jSFedjqs5w=
13611359
github.com/onflow/cadence v0.24.1/go.mod h1:tIJiQ4RIq1WUTXdBewv8p+gNUETN93Eb7jSFedjqs5w=
1362-
github.com/onflow/cadence v0.24.2-0.20220627175009-9da477fec7df h1:dhcYY0rQ8okmzuna3ailJtuDafSZPfI2GaCU/AiZ62A=
1363-
github.com/onflow/cadence v0.24.2-0.20220627175009-9da477fec7df/go.mod h1:g19FlFrcQsiegiZDe6wYtUCBO8O1hM1x/+l68aVO07k=
1360+
github.com/onflow/cadence v0.24.2-0.20220627150521-b803f9b296b7 h1:WeoPWv90rc3PPgCukDnDaGoOeRhNippa/T6D9V/ApPQ=
1361+
github.com/onflow/cadence v0.24.2-0.20220627150521-b803f9b296b7/go.mod h1:xBL+cVnpVYkcpwluAb3Fkqds6R7TeS6arygrvMgJQAI=
13641362
github.com/onflow/cadence/languageserver v0.15.2/go.mod h1:hQGE8dYH5CfQ1Oe0nXglchgURzZwR3JQhmuXtv4ROHs=
13651363
github.com/onflow/cadence/languageserver v0.16.0/go.mod h1:UPV1so9LcMrhj27IegrTucoyS4TLRVjNr4DJqjqBhFA=
13661364
github.com/onflow/cadence/languageserver v0.18.2/go.mod h1:ehuDCUevEEavUzgJqLevcZPjfmTzMBX7Sglbi5ur9uU=

0 commit comments

Comments
 (0)