generated from golang-templates/seed
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (88 loc) · 2.53 KB
/
build.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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Main Workflow
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
ci:
name: Build and Test
strategy:
fail-fast: true
matrix:
os: [ubuntu-20.04, macos-11, windows-2022]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Clone Repository
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18
- name: Build
run: make ci
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: bin
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
file: ./bin/coverage.out
flags: ${{ runner.os }}
sonarCloudTrigger:
needs: ci
name: SonarCloud Trigger
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Download code coverage results
uses: actions/download-artifact@v3
with:
name: code-coverage-report
path: bin
- name: Analyze with SonarCloud
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
release-test:
needs: ci
name: Release Test
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18
- name: Run GoReleaser - snapshot
uses: goreleaser/goreleaser-action@v4
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --snapshot --skip-publish --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Archive dist
uses: actions/upload-artifact@v3
with:
name: snapshot
path: dist