-
Notifications
You must be signed in to change notification settings - Fork 19
56 lines (51 loc) · 1.61 KB
/
build-test.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
name: CI Build and Test
on:
workflow_call:
push:
branches: ['main']
pull_request:
branches: ['main']
concurrency:
# Cancel in-progress runs on PR update
group: ci-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-and-test:
name: Build & run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
cache: true
- name: Install dependencies
run: go get ./...
- name: Build
run: go build -tags release -v ./...
- name: Test
run: make test
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: coverage.out
# XXX this will fail if main does not already have a coverage.out report uploaded by the previous job
# TODO uncomment this after upload-artifact has run on main branch
# code-coverage:
# name: Code coverage report
# runs-on: ubuntu-latest
# needs: build-and-test
# steps:
# - name: coverage report
# id: coverage-report
# uses: fgrosse/[email protected]
# with:
# coverage-file-name: coverage.out
# skip-comment: true # requires write permissin on pull requests
# # below options help track coverage across forks
# trim: github.com/project-kessel/inventory-api
# root-package: ""
# - name: coverage summary
# run: echo "${{ steps.coverage-report.outputs.coverage_report }}" >> "$GITHUB_STEP_SUMMARY"