Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 564a94f

Browse files
committed
feat: add CI
1 parent 625f434 commit 564a94f

6 files changed

Lines changed: 154 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
commit-message:
8+
prefix: "fix"
9+
include: "scope"
10+
11+
- package-ecosystem: "docker"
12+
directory: "/"
13+
schedule:
14+
interval: "daily"
15+
commit-message:
16+
prefix: "fix"
17+
include: "scope"
18+
19+
- package-ecosystem: "github-actions"
20+
directory: "/"
21+
schedule:
22+
interval: "daily"
23+
commit-message:
24+
prefix: "fix"
25+
include: "scope"

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
binaries:
10+
runs-on: ubuntu-20.04
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2.4.0
15+
with:
16+
token: ${{ secrets.API_GITHUB_TOKEN }}
17+
18+
- name: Fetch Go version
19+
run: |
20+
GO_VERSION=$(perl -ne 'print "$1\n" if /FROM golang:([0-9.]+)/' Dockerfile | head -n1)
21+
[ -n "$GO_VERSION" ] || exit 1
22+
echo "go_version=$GO_VERSION" >> $GITHUB_ENV
23+
- name: Setup Go environment
24+
uses: actions/setup-go@v2.1.4
25+
with:
26+
go-version: "${{ env.go_version }}"
27+
28+
- name: Binaries Release
29+
uses: goreleaser/goreleaser-action@v2.8.0
30+
with:
31+
version: ~> 0.175
32+
args: release --rm-dist
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.API_GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [master, develop]
6+
pull_request:
7+
branches: [master, develop]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-20.04
12+
13+
steps:
14+
- name: Checkout with token
15+
if: github.event_name != 'pull_request'
16+
uses: actions/checkout@v2.4.0
17+
with:
18+
token: ${{ secrets.API_GITHUB_TOKEN }}
19+
20+
- name: Checkout without token
21+
if: github.event_name == 'pull_request'
22+
uses: actions/checkout@v2.4.0
23+
24+
- name: Fetch Go version
25+
run: |
26+
GO_VERSION=$(perl -ne 'print "$1\n" if /FROM golang:([0-9.]+)/' Dockerfile | head -n1)
27+
[ -n "$GO_VERSION" ] || exit 1
28+
echo "go_version=$GO_VERSION" >> $GITHUB_ENV
29+
- name: Setup Go environment
30+
uses: actions/setup-go@v2.1.4
31+
with:
32+
go-version: "${{ env.go_version }}"
33+
34+
- name: Program Test
35+
run: go test ./...
36+
37+
- name: Version
38+
if: github.event_name != 'pull_request'
39+
uses: cycjimmy/semantic-release-action@v2.7.0
40+
with:
41+
semantic_version: 17.4
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.API_GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
before:
2+
builds:
3+
- env:
4+
- CGO_ENABLED=0
5+
ldflags:
6+
- -s -w
7+
flags:
8+
- -trimpath
9+
goos:
10+
- linux
11+
- windows
12+
- darwin
13+
goarch:
14+
- 386
15+
- amd64
16+
- arm
17+
- arm64
18+
goarm:
19+
- 6
20+
- 7
21+
archives:
22+
- format: binary
23+
checksum:
24+
name_template: "checksums.txt"
25+
release:
26+
prerelease: auto

.releaserc.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"branches": [
3+
{
4+
"name": "master"
5+
},
6+
{
7+
"name": "develop",
8+
"prerelease": true
9+
}
10+
],
11+
"plugins": [
12+
"@semantic-release/commit-analyzer",
13+
"@semantic-release/release-notes-generator",
14+
[
15+
"@semantic-release/github",
16+
{
17+
"successComment": false,
18+
"failComment": false
19+
}
20+
]
21+
]
22+
}

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM golang:1.17.3-alpine AS builder
2+
3+
# Placeholder Dockerfile
4+
# Used to enable Dependabot to update Go version for binary build

0 commit comments

Comments
 (0)