-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (54 loc) · 1.46 KB
/
ci.yml
File metadata and controls
66 lines (54 loc) · 1.46 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
name: CI
on:
push:
pull_request:
permissions:
contents: read
jobs:
ci:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
defaults:
run:
shell: pwsh
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- name: Download dependencies
run: go mod download
- name: Check formatting
if: matrix.os == 'ubuntu-latest' # Formatting check is platform-agnostic, so only run it once to save time
run: |
$unformatted = gofmt -l .
if ($unformatted) {
Write-Error "The following Go files are not gofmt-formatted:"
$unformatted
exit 1
}
- name: Vet
run: go vet ./...
- name: Test
run: go test ./...
- name: Build
run: |
New-Item -ItemType Directory -Force dist | Out-Null
$ext = if ($env:RUNNER_OS -eq 'Windows') { '.exe' } else { '' }
go build -v -o "dist/dspm$ext" ./cmd/dspm
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: dspm-${{ runner.os }}-${{ runner.arch }}-${{ github.sha }}
path: dist/*
if-no-files-found: error