-
Notifications
You must be signed in to change notification settings - Fork 376
129 lines (121 loc) · 3.85 KB
/
main.yaml
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Main
on: [push, pull_request]
jobs:
go-docker:
name: "Docker: Build berty/berty"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Build berty/berty
uses: n0izn0iz/Publish-Docker-Github-Action@master
with:
name: berty/berty
workdir: go
go-generate:
name: "Go: Check generation"
runs-on: ubuntu-latest
container:
image: bertytech/protoc:20
steps:
- name: Checkout
uses: actions/checkout@master
- run: find . -name gen.sum -delete
- run: cd go && go mod vendor
- run: cd go && make generate_local && make tidy
- run: cd docs && make generate_local
- run: |
git status | cat
git diff -w | cat
git diff-index -w --quiet HEAD --
githooks:
name: "Githooks"
runs-on: ubuntu-latest
container:
image: bertytech/githooks:v1
steps:
- name: Checkout
uses: actions/checkout@master
- run: ./githooks/pre-commit
- run: |
git status | cat
git diff -w | cat
git diff-index -w --quiet HEAD --
go-build-112:
name: "Go: Build"
runs-on: ${{ matrix.os }}
env:
GO111MODULE: on
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Setup go
uses: actions/setup-go@v1
with:
go-version: 1.12.x
- name: Checkout
uses: actions/checkout@master
# TODO: cache $GOPATH/pkg/mod
- run: go mod download
working-directory: ./go
# https://circleci.com/orbs/registry/orb/gotest/tools#commands-mod-tidy-check
- run: go mod tidy -v
working-directory: ./go
- run: git --no-pager diff go.mod go.sum
working-directory: ./go
- run: git --no-pager diff --quiet go.mod go.sum
working-directory: ./go
- run: make go.install
working-directory: ./go
- run: make go.unittest GO_TEST_OPTS="-v -test.timeout=120s"
working-directory: ./go
- run: make tidy
working-directory: ./go
- name: Setup golangci-lint
working-directory: ./go
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.21.0
- run: PATH=$PATH:$(pwd)/bin make lint
working-directory: ./go
- if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v1.0.3
with:
token: ${{secrets.CODECOV_TOKEN}}
file: ./go/coverage.txt
bazel-go:
name: "Go: Bazel"
strategy:
matrix:
bazel-target: [unittest, banner, build]
os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- if: contains(matrix.os, 'macos-')
name: Install bazel (darwin)
working-directory: /tmp
run: |
curl -LO https://github.com/bazelbuild/bazel/releases/download/0.29.1/bazel-0.29.1-installer-darwin-x86_64.sh
chmod +x bazel-0.29.1-installer-darwin-x86_64.sh
./bazel-0.29.1-installer-darwin-x86_64.sh --user
- if: contains(matrix.os, 'ubuntu-')
name: Install bazel (linux)
working-directory: /tmp
run: |
curl -LO https://github.com/bazelbuild/bazel/releases/download/0.29.1/bazel-0.29.1-installer-linux-x86_64.sh
chmod +x bazel-0.29.1-installer-linux-x86_64.sh
./bazel-0.29.1-installer-linux-x86_64.sh --user
- name: Setup go
uses: actions/setup-go@v1
with:
go-version: 1.12.x
- name: Print versions
run: |
PATH=${PATH}:${HOME}/bin bazel --version
go version
- name: Checkout
uses: actions/checkout@v1
- name: Run make bazel.${{ matrix.bazel-target }}
working-directory: ./go
env:
BAZEL_CMD_ARGS: --sandbox_debug --jobs=2 --local_ram_resources=HOST_RAM*.5
run: PATH=${PATH}:${HOME}/bin make bazel.${{ matrix.bazel-target }}