Skip to content

Commit 2db1c01

Browse files
authored
chore: setup CI (#1)
1 parent ab668ce commit 2db1c01

8 files changed

+181
-0
lines changed

.github/release-please-config.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"include-component-in-tag": false,
4+
"include-v-in-tag": true,
5+
"packages": {
6+
".": {
7+
"release-type": "go",
8+
"package-name": "hcloud-upload-image",
9+
"extra-files": ["internal/version/version.go"]
10+
}
11+
}
12+
}

.github/release-please-manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{".":"0.0.1"}

.github/workflows/ci.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version-file: go.mod
19+
20+
- name: Run golangci-lint (CLI)
21+
uses: golangci/golangci-lint-action@v5
22+
with:
23+
version: v1.57.2 # renovate: datasource=github-releases depName=golangci/golangci-lint
24+
args: --timeout 5m
25+
26+
- name: Run golangci-lint (Lib)
27+
uses: golangci/golangci-lint-action@v5
28+
with:
29+
version: v1.57.2 # renovate: datasource=github-releases depName=golangci/golangci-lint
30+
args: --timeout 5m
31+
working-directory: hcloudimages
32+
33+
34+
test:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
40+
- name: Set up Go
41+
uses: actions/setup-go@v5
42+
with:
43+
go-version-file: go.mod
44+
45+
- name: Run tests
46+
run: go test -v -race -coverpkg=./...,./hcloudimages/... ./... ./hcloudimages/...
47+
48+
49+
go-mod-tidy:
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v4
54+
55+
- name: Set up Go
56+
uses: actions/setup-go@v5
57+
with:
58+
go-version-file: go.mod
59+
60+
- name: Run go mod tidy
61+
run: go mod tidy
62+
63+
- name: Check uncommitted changes
64+
run: git diff --exit-code
65+
66+
- if: failure()
67+
run: echo "::error::Check failed, please run 'go mod tidy' and commit the changes."

.github/workflows/release-please.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: release-please
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
release-please:
9+
# Do not run on forks.
10+
if: github.repository == 'apricote/hcloud-upload-image'
11+
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: google-github-actions/release-please-action@v4
15+
with:
16+
token: ${{ secrets.RELEASE_PLEASE_GH_TOKEN }}
17+
config-file: .github/release-please-config.json
18+
manifest-file: .github/release-please-manifest.json

.github/workflows/release.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version-file: go.mod
19+
20+
- name: Run GoReleaser
21+
uses: goreleaser/goreleaser-action@v5
22+
with:
23+
version: latest
24+
args: release --clean
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
dist/

.goreleaser.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
2+
3+
version: 1
4+
5+
builds:
6+
- env:
7+
- CGO_ENABLED=0
8+
goos:
9+
- linux
10+
- windows
11+
- darwin
12+
13+
archives:
14+
- format: tar.gz
15+
# this name template makes the OS and Arch compatible with the results of `uname`.
16+
name_template: >-
17+
{{ .ProjectName }}_
18+
{{- title .Os }}_
19+
{{- if eq .Arch "amd64" }}x86_64
20+
{{- else if eq .Arch "386" }}i386
21+
{{- else }}{{ .Arch }}{{ end }}
22+
{{- if .Arm }}v{{ .Arm }}{{ end }}
23+
# use zip for windows archives
24+
format_overrides:
25+
- goos: windows
26+
format: zip
27+
28+
changelog:
29+
# Generated by release-please
30+
disable: true
31+
32+

renovate.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:recommended",
5+
":semanticCommits",
6+
":semanticCommitTypeAll(chore)",
7+
":semanticCommitScope(deps)",
8+
":enableVulnerabilityAlerts"
9+
],
10+
"postUpdateOptions": [
11+
"gomodTidy",
12+
"gomodUpdateImportPaths"
13+
],
14+
"customManagers": [
15+
{
16+
"customType": "regex",
17+
"fileMatch": ["^\\.github\\/(?:workflows|actions)\\/.+\\.ya?ml$"],
18+
"matchStrings": [
19+
"(?:version|VERSION): (?<currentValue>.+) # renovate: datasource=(?<datasource>[a-z-]+) depName=(?<depName>.+)(?: lookupName=(?<lookupName>.+))?(?: versioning=(?<versioning>[a-z-]+))?"
20+
]
21+
}
22+
]
23+
}

0 commit comments

Comments
 (0)