-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (104 loc) · 3.44 KB
/
Copy pathgo.yml
File metadata and controls
118 lines (104 loc) · 3.44 KB
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
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: build-test
on:
workflow_dispatch:
push:
branches: [ "main" ]
paths:
- '**.go'
- '**.xsd'
- '**.html'
- '**.sql'
- '**.yaml'
- '**/Makefile'
- '**/Dockerfile' #run this workflow first to ensure tests are passing
- '**/chart/**' #trigger also when chart templates chnage to force republish
- '.github/**' #trigger when pipeline changes
- '**/go.mod' #trigger when dependencies change
- '**/ModuleDescriptor-template.json' #trigger when module descriptor changes
pull_request:
branches: [ "main" ]
paths:
- '**.go'
- '**.xsd'
- '**.html'
- '**.sql'
- '**.yaml'
- '**/Makefile'
- '**/Dockerfile' #run this workflow first to ensure tests are passing
- '**/chart/**' #trigger also when chart templates change to force republish
- '.github/**' #trigger when pipeline changes
- '**/go.mod' #trigger when dependencies change
- '**/ModuleDescriptor-template.json' #trigger when module descriptor changes
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
modules: [broker, illmock]
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Load tool versions
run: cat .github/tool-versions.env >> "$GITHUB_ENV"
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: xsltproc libyaz-dev pkg-config
version: 1.0
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: |
go.work.sum
${{ matrix.modules }}/go.sum
- name: Generate sources
run: make generate
- name: Lint module '${{ matrix.modules }}'
uses: golangci/golangci-lint-action@v9
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
working-directory: ${{ matrix.modules }}
- name: Build
run: make all
working-directory: ${{ matrix.modules }}
- name: Test
run: make check
working-directory: ${{ matrix.modules }}
- name: Check test coverage
uses: vladopajic/go-test-coverage@v2
continue-on-error: true
with:
config: ${{ matrix.modules }}/.testcoverage.yaml
profile: ${{ matrix.modules }}/coverage.out
- name: Check vulnerabilities in '${{ matrix.modules }}'
id: govulncheck
uses: golang/govulncheck-action@master
continue-on-error: true
with:
go-version-input: ${{ env.GO_VERSION }}
repo-checkout: false
go-package: ./...
output-format: text
work-dir: ${{ matrix.modules }}
#setup go already restores the cache
cache: false
- name: Report vulnerability findings in '${{ matrix.modules }}'
if: ${{ steps.govulncheck.outcome == 'failure' }}
run: echo "::error title=Govulncheck reported vulnerabilities in ${{ matrix.modules }}::Review the govulncheck step output before merging"
build-all:
if: ${{ always() }}
runs-on: ubuntu-latest
name: Check all builds succeeded
needs: [build]
steps:
- run: |
result="${{ needs.build.result }}"
if [[ $result == "success" || $result == "skipped" ]]; then
exit 0
else
exit 1
fi