Skip to content

Commit 79d1256

Browse files
committed
Add GitHub Actions CI workflow
1 parent f7672c9 commit 79d1256

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
ci:
12+
name: ${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os:
18+
- ubuntu-latest
19+
- windows-latest
20+
- macos-latest
21+
22+
defaults:
23+
run:
24+
shell: pwsh
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v6
29+
30+
- name: Setup Go
31+
uses: actions/setup-go@v6
32+
with:
33+
go-version-file: go.mod
34+
cache-dependency-path: go.sum
35+
36+
- name: Download dependencies
37+
run: go mod download
38+
39+
- name: Check formatting
40+
run: |
41+
$unformatted = gofmt -l .
42+
if ($unformatted) {
43+
Write-Error "The following Go files are not gofmt-formatted:"
44+
$unformatted
45+
exit 1
46+
}
47+
48+
- name: Vet
49+
run: go vet ./...
50+
51+
- name: Test
52+
run: go test ./...
53+
54+
- name: Build
55+
run: |
56+
New-Item -ItemType Directory -Force dist | Out-Null
57+
$os = ($env:RUNNER_OS).ToLowerInvariant()
58+
$arch = ($env:RUNNER_ARCH).ToLowerInvariant()
59+
$ext = if ($env:RUNNER_OS -eq 'Windows') { '.exe' } else { '' }
60+
go build -v -o "dist/dspm-$os-$arch$ext" ./cmd/dspm
61+
62+
- name: Upload artifact
63+
uses: actions/upload-artifact@v7
64+
with:
65+
name: dspm-${{ runner.os }}-${{ runner.arch }}
66+
path: dist/*
67+
if-no-files-found: error

0 commit comments

Comments
 (0)