-
-
Notifications
You must be signed in to change notification settings - Fork 159
144 lines (140 loc) · 4 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
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
143
144
name: build
concurrency:
group: ${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
on:
push:
tags:
- v*
branches:
- main
paths:
- "go.*"
- "**/*.go"
- "Taskfile.yml"
- "Dockerfile"
- ".github/workflows/*.yml"
- "testdata/**"
- ".goreleaser.yml"
pull_request:
paths:
- "go.*"
- "**/*.go"
- "Taskfile.yml"
- "Dockerfile"
- ".github/workflows/*.yml"
- "testdata/**"
- ".goreleaser.yml"
permissions:
contents: read
jobs:
govulncheck:
uses: caarlos0/meta/.github/workflows/govulncheck.yml@main
with:
go-version: stable
semgrep:
uses: caarlos0/meta/.github/workflows/semgrep.yml@main
ruleguard:
uses: caarlos0/meta/.github/workflows/ruleguard.yml@main
with:
go-version: stable
args: "-disable largeloopcopy"
unit-tests:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: task setup
- run: task test
- uses: codecov/codecov-action@v5
if: matrix.os == 'ubuntu-latest'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
acceptance-tests:
strategy:
matrix:
pkgFormat: [deb, rpm, apk, archlinux, ipk]
pkgPlatform: [amd64, arm64, 386, ppc64le, armv6, armv7, s390x]
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
NO_TEST_PPC64LE: "true"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- run: task setup
- run: task acceptance
env:
TEST_PATTERN: "/${{ matrix.pkgFormat }}/${{ matrix.pkgPlatform }}/"
windows-build-pkgs:
needs: [unit-tests]
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: dist/
key: ${{ env.sha_short }}
enableCrossOsArchive: true
- run: task acceptance:windows:package
install-windows-pkgs:
runs-on: ubuntu-latest
needs: [windows-build-pkgs]
steps:
- uses: docker/setup-qemu-action@v3
- uses: actions/checkout@v4
- uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: dist/
key: ${{ env.sha_short }}
enableCrossOsArchive: true
- run: task acceptance:windows:install
dependabot:
needs: [unit-tests, acceptance-tests, install-windows-pkgs]
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}}
steps:
- id: metadata
uses: dependabot/fetch-metadata@dbb049abf0d677abbd7f7eee0375145b417fdd34 # v2.2.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- run: |
gh pr review --approve "$PR_URL"
gh pr merge --squash --auto "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}