forked from pressly/goose
-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (48 loc) · 1.41 KB
/
ci.yaml
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
name: Goose CI
on:
push:
branches:
- master
pull_request:
jobs:
test:
name: Run unit tests
timeout-minutes: 10
concurrency:
group: test-${{ github.ref }}-${{ matrix.os }}-${{ matrix.go-version }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
go-version: ["1.20", "1.21", "1.22"]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Check Go code formatting
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
gofmt -s -l .
echo "Please format Go code by running: go fmt ./..."
exit 1
fi
- name: Run tests
run: |
mkdir -p bin
go vet ./...
go build ./...
make test-packages
- name: Install GoReleaser
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.go-version == '1.22'
uses: goreleaser/goreleaser-action@v5
with:
install-only: true
- name: Gorelease dry-run
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.go-version == '1.22'
run: |
goreleaser release --skip=publish --snapshot --fail-fast --clean