Skip to content

Commit 3d27e8d

Browse files
committed
CI: Add GH actions to test and build Go packages
1 parent e71ff69 commit 3d27e8d

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

.github/workflows/build.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Test and build Go packages
2+
on:
3+
- push
4+
- pull_request
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: read
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-go@v3
13+
with:
14+
go-version-file: go.mod
15+
- uses: actions/cache@v3
16+
with:
17+
path: |
18+
~/.cache/go-build
19+
~/go/pkg/mod
20+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
21+
restore-keys: |
22+
${{ runner.os }}-go-
23+
- run: go test ./...
24+
25+
build:
26+
runs-on: ubuntu-latest
27+
needs:
28+
- test
29+
permissions:
30+
contents: read
31+
packages: write
32+
steps:
33+
- uses: actions/checkout@v3
34+
- uses: actions/setup-go@v3
35+
with:
36+
go-version-file: go.mod
37+
- uses: actions/cache@v3
38+
with:
39+
path: |
40+
~/.cache/go-build
41+
~/go/pkg/mod
42+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
43+
restore-keys: |
44+
${{ runner.os }}-go-
45+
- run: go build -a -o bin/pr-size ./cmd/gh-actions-pr-size
46+
- uses: elgohr/Publish-Docker-Github-Action@v4
47+
with:
48+
name: ${{ github.repository }}/gh-actions-pr-size
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.GITHUB_TOKEN }}
51+
registry: docker.pkg.github.com
52+
no_push: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bin/

0 commit comments

Comments
 (0)