-
Notifications
You must be signed in to change notification settings - Fork 5
142 lines (135 loc) · 4.26 KB
/
push_master.workflow.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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Main branches checks
on:
push:
branches:
- master
- 2-stable
jobs:
documentation-snippet-tests:
name: Documentation - Snippet Tests
runs-on: ubuntu-18.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- run: docker-compose -f .ci/doc/docker-compose.yml run doc-tests node index
lint:
name: Linters
runs-on: ubuntu-18.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: Install dependencies
run: |
go version
go get -u golang.org/x/lint/golint
# Uncomment following lines when https://github.com/kuzzleio/sdk-go/issues/288 is fixed
# - name: Run Vet
# run: go vet ./...
# - name: Run Lint
# run: golint ./...
- name: Run Fmt (format also documentation snippets)
run: gofmt -l ./**/*.go
build:
name: Build with ${{ matrix.goVersion }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
needs: [lint]
strategy:
matrix:
goVersion: [1.12.x, 1.13.x, 1.14.x, 1.15.x]
os: [ubuntu-18.04, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.goVersion }}
- name: Build
run: go build -v ./...
coverage:
name: Tests on latest Go version with coverage
runs-on: ubuntu-18.04
timeout-minutes: 30
needs: [build]
steps:
- uses: actions/checkout@v2
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: Test With Coverage
run: go test -v -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
test:
name: Test with ${{ matrix.goVersion }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
needs: [build]
strategy:
matrix:
goVersion: [1.12.x, 1.13.x, 1.14.x, 1.15.x]
os: [ubuntu-18.04, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.goVersion }}
- name: Test
run: go test -v ./...
doc-deploy:
name: Deployment Doc Prod
runs-on: ubuntu-latest
needs: [documentation-snippet-tests, test, coverage]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Extract references from context
shell: bash
id: extract-refs
run: |
echo "::set-output name=version::$(git describe --abbrev=0 --tags | cut -d. -f 1)"
echo "::set-output name=repo::$(echo $GITHUB_REPOSITORY | cut -d/ -f 2)"
echo "::set-output name=branch::$(echo $GITHUB_REF | cut -d/ -f 3)"
- uses: convictional/[email protected]
with:
owner: kuzzleio
repo: documentation
github_token: ${{ secrets.ACCESS_TOKEN_CI }}
workflow_file_name: child_repo.workflow.yml
ref: master
inputs: '{"repo_name": "${{ steps.extract-refs.outputs.repo }}", "branch": "${{ steps.extract-refs.outputs.branch }}", "version": "${{ steps.extract-refs.outputs.version }}"}'