generated from snivilised/astrolib
-
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
0 parents
commit 2464135
Showing
38 changed files
with
2,308 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 @@ | ||
*.go text eol=lf |
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,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: gomod | ||
directory: / | ||
schedule: | ||
interval: weekly |
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,64 @@ | ||
name: Initialise Repo | ||
on: | ||
create: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
run-script: | ||
name: run auto-check script | ||
|
||
# We will only run this action when this repository isn't the | ||
# template repository | ||
# | ||
if: >- | ||
${{ !github.event.repository.is_template }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Configure Git | ||
run: | | ||
git config --global user.name "${GITHUB_ACTOR}" | ||
git config --global user.email "${GITHUB_ACTOR_EMAIL}" | ||
shell: bash | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.ref }} | ||
|
||
- name: Run Auto Check script | ||
run: | | ||
. ./scripts/automate-checklist.sh | ||
auto-check | ||
shell: bash | ||
|
||
- name: Go Format | ||
run: | | ||
go fmt ./... | ||
shell: bash | ||
|
||
- name: Clean up redundant scripts | ||
run: | | ||
rm -fv .github/workflows/auto-check-workflow.yml 2>/dev/null | ||
rm -fv ./scripts/automate-checklist.sh 2>/dev/null | ||
shell: bash | ||
|
||
- name: Add files and commit changes | ||
run: | | ||
echo "* available branches:" | ||
git branch | cat | ||
echo "default branch: '${{ github.event.repository.default_branch }}'" | ||
echo "========" | ||
git fetch | ||
git checkout main | ||
git add . | ||
git commit -m "chore(gh-actions): apply auto-check edits" | ||
git push -u origin ${{ github.event.repository.default_branch }} | ||
shell: bash | ||
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,75 @@ | ||
name: Astrolib Continuous Integration | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.23 | ||
- uses: actions/checkout@v3 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.60.3 | ||
args: --verbose | ||
|
||
test: | ||
strategy: | ||
matrix: | ||
go-version: [1.23] | ||
platform: [ubuntu-latest, macos-latest] | ||
|
||
runs-on: ${{ matrix.platform }} | ||
|
||
env: | ||
COVER_DIR: ${{ github.workspace }}/coverage | ||
COVER_FILE: coverage.out | ||
COVER_OUT_PATH: ${{ github.workspace }}/coverage/coverage.out | ||
COVER_HTML_PATH: ${{ github.workspace }}/coverage/coverage.html | ||
GINKGO_REPORT: ginkgo.report | ||
|
||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Install goveralls | ||
run: go install github.com/mattn/goveralls@latest | ||
|
||
- name: Install ginkgo | ||
run: go install github.com/onsi/ginkgo/v2/ginkgo@v2.20.2 | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Ensure coverage directory exists | ||
run: | | ||
mkdir -p ${{ github.workspace }}/coverage | ||
- name: Run tests and generate coverage profile with Ginkgo | ||
run: | | ||
ginkgo run -r -json-report {{env.GINKGO_REPORT}} -coverpkg=./... -coverprofile=coverage.out | ||
- name: Apply coverage exclusions | ||
run: | | ||
${{ github.workspace }}/scripts/apply-coverage-exclusions.sh | ||
- name: Check coverage directory contents | ||
run: | | ||
echo "Contents of ${{ github.workspace }}/coverage:" | ||
ls -la ${{ github.workspace }}/coverage | ||
- name: Generate HTML coverage report | ||
run: | | ||
go tool cover -html=coverage.out -o ${{ github.workspace }}/coverage/coverage.html | ||
- name: Upload coverage to Coveralls | ||
uses: shogo82148/actions-goveralls@v1 | ||
with: | ||
path-to-profile: coverage.out |
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,35 @@ | ||
name: Astrolib Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
goreleaser: | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Git Fetch | ||
run: git fetch --force --tags | ||
- name: Setup | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '>=1.23' | ||
cache: true | ||
- name: Generate Changelog Only | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean | ||
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,30 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
*.env | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
coverage | ||
coverage.out | ||
ginkgo.report | ||
report.json | ||
coverage.html | ||
|
||
.task/ | ||
|
||
i18n/out/en-US/active.en-GB.json | ||
|
||
.DS_Store | ||
thumbs.db | ||
.tmp |
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 @@ | ||
linters-settings: | ||
errcheck: | ||
check-type-assertions: true | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 3 | ||
gocritic: | ||
enabled-tags: | ||
- diagnostic | ||
- experimental | ||
- opinionated | ||
- performance | ||
- style | ||
govet: | ||
shadow: true | ||
disable: | ||
- fieldalignment # too strict | ||
|
||
nolintlint: | ||
require-explanation: false | ||
require-specific: true | ||
linters: | ||
disable-all: true | ||
enable: | ||
- bodyclose | ||
# - deadcode | ||
# depguard needs to be reviewed properly and then configured, before | ||
# it can be re-enabled. | ||
# https://github.com/OpenPeeDeeP/depguard#example-configs | ||
# - depguard | ||
- copyloopvar | ||
- dogsled | ||
# - dupl | ||
- errcheck | ||
- exhaustive | ||
- goconst | ||
- gocritic | ||
- gofmt | ||
- goimports | ||
- gocyclo | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- misspell | ||
- mnd | ||
- nolintlint | ||
- nakedret | ||
- prealloc | ||
- predeclared | ||
- revive | ||
- staticcheck | ||
# - structcheck | ||
- stylecheck | ||
- thelper | ||
- tparallel | ||
- unconvert | ||
- unparam | ||
# - varcheck | ||
- whitespace | ||
- wsl | ||
|
||
issues: | ||
max-issues-per-linter: 0 | ||
max-same-issues: 0 | ||
fix: true | ||
exclude: | ||
- "cuddle" | ||
|
||
run: | ||
issues-exit-code: 1 | ||
timeout: "5m" |
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,51 @@ | ||
before: | ||
hooks: | ||
- go mod tidy | ||
# ? do we need a - go mod generate | ||
# - go mod generate | ||
|
||
builds: | ||
- id: "astrolib" | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
no_main_check: true | ||
skip: true | ||
|
||
archives: | ||
- format: tar.gz | ||
# this name template makes the OS and Arch compatible with the results of uname. | ||
name_template: >- | ||
{{ .ProjectName }}_ | ||
{{- title .Os }}_ | ||
{{- if eq .Arch "amd64" }}x86_64 | ||
{{- else if eq .Arch "386" }}i386 | ||
{{- else }}{{ .Arch }}{{ end }} | ||
{{- if .Arm }}v{{ .Arm }}{{ end }} | ||
# use zip for windows archives | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
checksum: | ||
name_template: "checksums.txt" | ||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
changelog: | ||
use: github | ||
sort: asc | ||
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" | ||
groups: | ||
- title: "🚀 Features" | ||
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$' | ||
order: 0 | ||
- title: "🐛 Bug fixes" | ||
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$' | ||
order: 1 | ||
- title: "🥝 Others" | ||
order: 999 |
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,11 @@ | ||
repos: | ||
- repo: https://github.com/golangci/golangci-lint | ||
rev: v1.52.2 | ||
hooks: | ||
- id: golangci-lint | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: no-commit-to-branch | ||
args: ["--branch", "master", "--branch", "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,15 @@ | ||
{ | ||
// 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 Package", | ||
"type": "go", | ||
"request": "launch", | ||
"mode": "auto", | ||
"program": "${fileDirname}" | ||
} | ||
] | ||
} |
Oops, something went wrong.