Skip to content

Commit 3e279be

Browse files
committed
init workflows
1 parent 35f113e commit 3e279be

File tree

4 files changed

+141
-0
lines changed

4 files changed

+141
-0
lines changed

.github/workflows/build.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
persist-credentials: false
19+
20+
- name: setup go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version-file: 'go.mod'
24+
cache: true
25+
26+
- name: build
27+
run: go build -v ./cmd/gh-combine

.github/workflows/lint.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: lint
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
persist-credentials: false
19+
20+
- name: setup go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version-file: 'go.mod'
24+
cache: true
25+
26+
# Taken from https://github.com/cli/cli/blob/trunk/.github/workflows/lint.yml
27+
- name: lint
28+
run: |
29+
STATUS=0
30+
assert-nothing-changed() {
31+
local diff
32+
"$@" >/dev/null || return 1
33+
if ! diff="$(git diff -U1 --color --exit-code)"; then
34+
printf '\e[31mError: running `\e[1m%s\e[22m` results in modifications that you must check into version control:\e[0m\n%s\n\n' "$*" "$diff" >&2
35+
git checkout -- .
36+
STATUS=1
37+
fi
38+
}
39+
40+
assert-nothing-changed go fmt ./...
41+
assert-nothing-changed go mod tidy
42+
43+
exit $STATUS
44+
45+
- name: deadcode
46+
run: |
47+
go install golang.org/x/tools/cmd/deadcode@latest
48+
49+
deadcode -test ./... > "deadcode.txt"
50+
if [ -s "deadcode.txt" ]; then
51+
echo "dead code found:"
52+
cat deadcode.txt
53+
exit 1
54+
fi

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
persist-credentials: false
21+
22+
- name: setup go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version-file: "go.mod"
26+
cache: false
27+
28+
- name: goreleaser
29+
uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # pin@v6
30+
with:
31+
args: release --clean
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
persist-credentials: false
19+
20+
- name: setup go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version-file: 'go.mod'
24+
cache: true
25+
26+
- name: test
27+
run: go test -v -cover ./...

0 commit comments

Comments
 (0)