-
Notifications
You must be signed in to change notification settings - Fork 207
109 lines (97 loc) · 2.73 KB
/
PR-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
103
104
105
106
107
108
109
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT
name: PR Build
on:
push:
branches:
- main
paths-ignore:
- '**/*.md'
- 'NOTICE'
- 'RELEASE_NOTES'
- 'THIRD-PARTY'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/PR-build.yml'
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
- ready_for_review
paths-ignore:
- '**/*.md'
- 'NOTICE'
- 'RELEASE_NOTES'
- 'THIRD-PARTY'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/PR-build.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
build:
name: Build ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-2019, windows-latest, macos-11]
include:
- os: ubuntu-latest
family: linux
cache-path: |
~/.cache/go-build
~/go/pkg/mod
- os: macos-11
family: darwin
cache-path: |
~/Library/Caches/go-build
~/go/pkg/mod
- os: windows-2019
family: windows
cache-path: |
~\AppData\Local\go-build
~\go\pkg\mod
- os: windows-latest
family: windows
cache-path: |
~\AppData\Local\go-build
~\go\pkg\mod
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ~1.19.6
cache: false
- name: Check out code
uses: actions/checkout@v3
- name: Cache binaries
id: cached_binaries
uses: actions/cache@v3
with:
key: "cached-binaries-${{ matrix.os }}-${{ github.sha }}"
path: go.mod
- name: Cache build output
if: steps.cached_binaries.outputs.cache-hit != 'true'
uses: actions/cache@v3
with:
path: ${{ matrix.cache-path }}
key: v1-go-pkg-mod-${{ matrix.os }}-${{ hashFiles('**/go.sum') }}
- name: Install make
if: matrix.family == 'windows' && steps.cached_binaries.outputs.cache-hit != 'true'
run: choco install make
- name: Unit Test
if: steps.cached_binaries.outputs.cache-hit != 'true'
run: make test
- name: Upload coverage to Codecov
if: steps.cached_binaries.outputs.cache-hit != 'true'
uses: codecov/codecov-action@v3
with:
verbose: true
- name: Build
if: steps.cached_binaries.outputs.cache-hit != 'true'
run: make amazon-cloudwatch-agent-${{ matrix.family }}