-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
1,437 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env bash | ||
# Template form: | ||
# https://github.com/arg-sh/argsh | ||
# curl -sfLS https://envrc.arg.sh > .envrc | ||
# This is an example of a .envrc file for use with direnv. | ||
# It sets up the environment for the project. | ||
set -euo pipefail | ||
|
||
: "${PATH_BASE:="$(git rev-parse --show-toplevel)"}" | ||
: "${PATH_BIN:="${PATH_BASE}/.bin"}" | ||
export PATH_BASE PATH_BIN | ||
|
||
# shellcheck disable=SC2120 | ||
path::add() { | ||
command -v PATH_add 1>/dev/null || { | ||
_error "This can be only run within direnv" | ||
return | ||
} | ||
PATH_add "${1}" | ||
} | ||
|
||
export::env() { | ||
local env="${PATH_BASE}/${1}" | ||
# shellcheck disable=SC2046 | ||
[ ! -f "${env}" ] || { | ||
export $(grep -v '^#' "${env}" | sed -E 's/\s+=\s+/=/g' | xargs -d '\n') | ||
|
||
! command -v watch_file &>/dev/null || | ||
watch_file "${env}" | ||
} | ||
} | ||
|
||
copy::template() { | ||
local -r file="${PATH_BASE}/${1}" | ||
[ -f "${file}" ] || { | ||
cp "${file}.template" "${file}" 2>/dev/null || : | ||
} | ||
} | ||
|
||
main() { | ||
# Use this if you want a template file with example values | ||
# make sure to ignore .env and .secrets in your .gitignore | ||
copy::template .env | ||
copy::template .secrets | ||
|
||
# This will load the environment variables from the .env and .secrets files | ||
export::env .env | ||
export::env .secrets | ||
|
||
# Make your binaries available in the PATH | ||
# This is handy to make sure that all developers have the same binaries available | ||
path::add "${PATH_BIN:-"${PATH_BASE}/.bin"}" | ||
} | ||
|
||
# Run the main function if this file is sourced by direnv | ||
[ -z "${DIRENV_IN_ENVRC}" ] || main "${@}" |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @fentas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", | ||
"bootstrap-sha": "fc023e8337f2f8f4c6e8cd3742f989916f682c77", | ||
"include-component-in-tag": false, | ||
"include-v-in-tag": true, | ||
"packages": { | ||
".": { | ||
"release-type": "go", | ||
"package-name": "b-cli", | ||
"extra-files": ["cmd/b/main.go"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{".":"dev"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v5 | ||
with: | ||
version: latest | ||
args: release --clean --snapshot --skip=sign | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: Preview Binaries | ||
path: dist/b-*/b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
cache: false | ||
|
||
- name: Run gofmt | ||
run: diff -u <(echo -n) <(gofmt -d -s .) | ||
|
||
- name: Run golangci-lint | ||
uses: golangci/golangci-lint-action@v4 | ||
with: | ||
# Required: the version of golangci-lint is required and must be specified with patch version | ||
version: v1.57.1 # renovate: datasource=github-releases depName=golangci/golangci-lint | ||
# In general linting is quite fast with warm caches, but a fresh run might take some time. | ||
args: --timeout 5m | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: Run tests | ||
run: go test -coverprofile=coverage.txt -v -race ./... | ||
|
||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
generate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: Delete old generated files | ||
run: find . -name 'zz_*.go' -delete | ||
|
||
- name: Run go generate | ||
run: go generate ./... | ||
|
||
- name: Check uncommitted changes | ||
run: git diff --exit-code | ||
|
||
- if: failure() | ||
run: echo "::error::Check failed, please run 'go generate ./...' and commit the changes." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Release-please | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
release-please: | ||
# Do not run on forks. | ||
if: github.repository == 'hetznercloud/cli' | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: google-github-actions/release-please-action@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
config-file: .github/release-please-config.json | ||
manifest-file: .github/release-please-manifest.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: Set up gon | ||
run: brew install mitchellh/gon/gon | ||
|
||
- name: Import GPG key | ||
id: import_gpg | ||
uses: crazy-max/ghaction-import-gpg@v6 | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v5 | ||
with: | ||
version: latest | ||
args: release --clean --skip=validate | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
vendor | ||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- id: b-build | ||
main: ./cmd/b/main.go | ||
binary: b | ||
ldflags: | ||
- -w | ||
- -X {{ .ModulePath }}/cmd/b.version={{ .Version }} | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- freebsd | ||
- windows | ||
- linux | ||
goarch: | ||
- amd64 | ||
- arm | ||
- arm64 | ||
- "386" | ||
goarm: | ||
- "6" | ||
- "7" | ||
|
||
checksum: | ||
name_template: checksums.txt | ||
algorithm: sha256 | ||
|
||
signs: | ||
- artifacts: all | ||
signature: ${artifact}.sig | ||
id: buyo-sign | ||
ids: | ||
- b-build | ||
args: | ||
- --batch | ||
- --local-user=github-bot@buyo.io | ||
- --pinentry-mode=loopback | ||
- --output=${signature} | ||
- --detach-sign | ||
- ${artifact} | ||
|
||
archives: | ||
- id: b-archive | ||
builds: | ||
- b-build | ||
name_template: "{{ .Binary }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" | ||
|
||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
|
||
files: | ||
- LICENSE | ||
- README.md | ||
|
||
release: | ||
draft: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "debug", | ||
"program": "${workspaceRoot}/cmd/b/main.go", | ||
"args": ["--help"] | ||
} | ||
] | ||
} |
Oops, something went wrong.