Skip to content

Commit 268e426

Browse files
authored
Some CI updates (#2)
* Always run linter and tests on any push but skip release without tag * Read go version from go.mod * Update actions/setup-go * Use separate jobs for checks and release
1 parent cfd1e75 commit 268e426

File tree

2 files changed

+36
-20
lines changed

2 files changed

+36
-20
lines changed

.github/workflows/release.yml

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,51 @@
1-
name: Release
1+
name: '🧑‍🏭'
22

3-
on:
4-
push:
5-
tags:
6-
- "*"
3+
on: [ push, pull_request ]
74

85
jobs:
9-
build:
10-
runs-on: ubuntu-latest
116

7+
check:
8+
runs-on: ubuntu-22.04
129
steps:
10+
1311
- name: Checkout
1412
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
1515

1616
- name: Setup Go
17-
uses: actions/setup-go@v4
17+
uses: actions/setup-go@v5
18+
with:
19+
go-version-file: 'go.mod'
20+
check-latest: true
21+
cache: true
22+
23+
- name: Run linter and tests
24+
run: go test -v -vet='all' ./...
25+
26+
release:
27+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') == true
28+
needs: check
29+
runs-on: ubuntu-22.04
30+
steps:
31+
32+
- name: Checkout
33+
uses: actions/checkout@v4
1834
with:
19-
go-version: 1.20.x
35+
fetch-depth: 0
2036

21-
- name: Install dependencies
22-
run: go get .
37+
- name: Setup Go
38+
uses: actions/setup-go@v5
39+
with:
40+
go-version-file: 'go.mod'
41+
check-latest: true
42+
cache: true
2343

2444
- name: Build windows/amd64
2545
run: GOOS=windows GOARCH=amd64 go build -o ChunkCleaner-Win64.exe
2646

2747
- name: Build linux/amd64
28-
run: GOOS=linux GOARCH=amd64 go build -o ChunkCleaner-Linux64 -v ./...
29-
30-
- name: Debug - List files
31-
run: |
32-
ls ${{ github.workspace }}
48+
run: GOOS=linux GOARCH=amd64 go build -o ChunkCleaner-Linux64
3349

3450
- name: Release
3551
uses: marvinpinto/action-automatic-releases@latest

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# If you prefer the allow list template instead of the deny list, see community template:
2-
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3-
#
1+
/ChunkCleaner-Linux64
2+
/ChunkCleaner-Win64.exe
3+
44
# Binaries for programs and plugins
55
*.exe
66
*.exe~
@@ -22,4 +22,4 @@ go.work
2222

2323
# User-specific stuff
2424
.idea/
25-
*.iml
25+
*.iml

0 commit comments

Comments
 (0)