Skip to content

Commit 20cb543

Browse files
authored
Initial commit
0 parents  commit 20cb543

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+3301
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.go text eol=lf

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: gomod
4+
directory: /
5+
schedule:
6+
interval: weekly
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Initialise Repository
2+
3+
on:
4+
push:
5+
branches:
6+
- main # first push triggers bootstrap
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
bootstrap:
13+
# Only run for org repos and skip template repositories
14+
if: ${{ github.repository_owner == 'snivilised' && !github.event.repository.is_template }}
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
# Checkout repository using default github.token (always safe)
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
ref: ${{ github.ref }}
23+
24+
# Configure Git author
25+
- name: Configure Git
26+
run: |
27+
git config --global user.name "github-actions[bot]"
28+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
29+
30+
# Install Go version specified in go.mod
31+
- name: Setup Go
32+
uses: actions/setup-go@v5
33+
with:
34+
go-version-file: go.mod
35+
36+
# Run automation script
37+
- name: Run automation script
38+
run: go run ./scripts/automate-checklist.go
39+
40+
# Format code and tidy modules
41+
- name: Format & tidy Go
42+
run: |
43+
go fmt ./...
44+
go mod tidy
45+
46+
# Remove bootstrap/template-only files
47+
- name: Clean up template scripts
48+
run: |
49+
rm -fv .github/workflows/auto-check-workflow.yml
50+
rm -fv ./scripts/automate-checklist.go
51+
rm -fv ./scripts/automate-checklist.sh
52+
53+
# Commit & push changes using org PAT (no linter warning)
54+
- name: Commit & push changes
55+
env:
56+
ORG_PAT: ${{ secrets.AUTOMATION_PAT }}
57+
run: |
58+
git add .
59+
if [ -n "$(git status --porcelain)" ]; then
60+
git commit -m "chore(repo): bootstrap repository"
61+
# Update remote URL to include PAT for push
62+
git remote set-url origin https://x-access-token:${ORG_PAT}@github.com/${GITHUB_REPOSITORY}.git
63+
git push origin HEAD:${{ github.event.repository.default_branch }}
64+
else
65+
echo "No changes to commit"
66+
fi
67+

.github/workflows/ci-workflow.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Arcadia Continuous Integration
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
golangci:
8+
name: lint
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/setup-go@v5
12+
with:
13+
go-version: 1.26
14+
- uses: actions/checkout@v4
15+
- name: golangci-lint
16+
uses: golangci/golangci-lint-action@v7
17+
with:
18+
version: v2.10.1
19+
args: --verbose
20+
21+
test:
22+
strategy:
23+
matrix:
24+
go-version: [1.26]
25+
platform: [ubuntu-latest, macos-latest]
26+
27+
runs-on: ${{ matrix.platform }}
28+
29+
env:
30+
COVER_DIR: ${{ github.workspace }}/coverage
31+
COVER_FILE: coverage.out
32+
COVER_OUT_PATH: ${{ github.workspace }}/coverage/coverage.out
33+
COVER_HTML_PATH: ${{ github.workspace }}/coverage/coverage.html
34+
GINKGO_REPORT: ginkgo.report
35+
36+
steps:
37+
- name: Install Go
38+
uses: actions/setup-go@v5
39+
with:
40+
go-version: ${{ matrix.go-version }}
41+
42+
- name: Install goveralls
43+
run: go install github.com/mattn/goveralls@latest
44+
45+
- name: Install ginkgo
46+
run: go install github.com/onsi/ginkgo/v2/ginkgo@v2.20.0
47+
48+
- name: Checkout code
49+
uses: actions/checkout@v4
50+
51+
- name: Ensure coverage directory exists
52+
run: |
53+
mkdir -p ${{ github.workspace }}/coverage
54+
55+
- name: Run tests and generate coverage profile with Ginkgo
56+
run: |
57+
ginkgo run -r -json-report {{env.GINKGO_REPORT}} -coverpkg=./... -coverprofile=coverage.out
58+
59+
- name: Apply coverage exclusions
60+
run: |
61+
${{ github.workspace }}/scripts/apply-coverage-exclusions.sh
62+
63+
- name: Check coverage directory contents
64+
run: |
65+
echo "Contents of ${{ github.workspace }}/coverage:"
66+
ls -la ${{ github.workspace }}/coverage
67+
68+
- name: Generate HTML coverage report
69+
run: |
70+
go tool cover -html=coverage.out -o ${{ github.workspace }}/coverage/coverage.html
71+
72+
- name: Upload coverage to Coveralls
73+
uses: shogo82148/actions-goveralls@v1
74+
with:
75+
path-to-profile: coverage.out
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Arcadia Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
if: startsWith(github.ref, 'refs/tags/')
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
- name: Git Fetch
22+
run: git fetch --force --tags
23+
- name: Setup
24+
uses: actions/setup-go@v3
25+
with:
26+
go-version: ">=1.22"
27+
cache: true
28+
- name: Generate Changelog Only
29+
uses: goreleaser/goreleaser-action@v4
30+
with:
31+
distribution: goreleaser
32+
version: latest
33+
args: release --clean
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with `go test -c`
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
*.env
14+
15+
# Dependency directories (remove the comment below to include it)
16+
# vendor/
17+
18+
coverage
19+
coverage.out
20+
ginkgo.report
21+
report.json
22+
coverage.html
23+
24+
dist/
25+
.task/
26+
27+
locale/i18n/out/en-US/active.en-GB.json
28+
test/data/research/scientist/
29+
30+
.DS_Store
31+
thumbs.db
32+
*.log

.golangci.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
version: "2"
2+
3+
run:
4+
timeout: 5m
5+
issues-exit-code: 1
6+
7+
linters:
8+
enable:
9+
# correctness
10+
- errcheck
11+
- govet
12+
- staticcheck
13+
- ineffassign
14+
15+
# bug prevention
16+
- copyloopvar
17+
- bodyclose
18+
- exhaustive
19+
- unparam
20+
- unconvert
21+
22+
# code quality
23+
# - gocyclo # TODO: enable later, need to fix complexity issues
24+
- goconst
25+
- revive
26+
- prealloc
27+
- predeclared
28+
29+
# security
30+
- gosec
31+
32+
# testing
33+
- thelper
34+
- tparallel
35+
36+
# misc
37+
- misspell
38+
- whitespace
39+
- nolintlint
40+
- dogsled
41+
42+
settings:
43+
errcheck:
44+
check-type-assertions: true
45+
46+
goconst:
47+
min-len: 2
48+
min-occurrences: 3
49+
50+
gocyclo:
51+
min-complexity: 15
52+
53+
govet:
54+
enable:
55+
- shadow
56+
57+
revive:
58+
severity: warning
59+
60+
nolintlint:
61+
require-explanation: false
62+
require-specific: true
63+
64+
exclusions:
65+
rules:
66+
# Ginkgo/Gomega test suites use dot-imports by convention; suppress the
67+
# revive dot-imports warning for all test files.
68+
- path: '_test\.go'
69+
linters:
70+
- revive
71+
text: 'dot-imports'
72+
73+
issues:
74+
max-issues-per-linter: 0
75+
max-same-issues: 0
76+
fix: false

.goreleaser.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
before:
2+
hooks:
3+
- go mod tidy
4+
# ? do we need a - go mod generate
5+
# - go mod generate
6+
7+
builds:
8+
- id: "arcadia"
9+
env:
10+
- CGO_ENABLED=0
11+
goos:
12+
- linux
13+
- windows
14+
- darwin
15+
main: ./src/app/main
16+
17+
archives:
18+
- format: tar.gz
19+
# this name template makes the OS and Arch compatible with the results of uname.
20+
name_template: >-
21+
{{ .ProjectName }}_
22+
{{- title .Os }}_
23+
{{- if eq .Arch "amd64" }}x86_64
24+
{{- else if eq .Arch "386" }}i386
25+
{{- else }}{{ .Arch }}{{ end }}
26+
{{- if .Arm }}v{{ .Arm }}{{ end }}
27+
# use zip for windows archives
28+
format_overrides:
29+
- goos: windows
30+
format: zip
31+
checksum:
32+
name_template: "checksums.txt"
33+
snapshot:
34+
name_template: "{{ incpatch .Version }}-next"
35+
changelog:
36+
use: github
37+
sort: asc
38+
filters:
39+
exclude:
40+
- "^docs:"
41+
- "^test:"
42+
groups:
43+
- title: "🚀 Features"
44+
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
45+
order: 0
46+
- title: "🐛 Bug fixes"
47+
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
48+
order: 1
49+
- title: "🥝 Others"
50+
order: 999

.pre-commit-config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
repos:
2+
- repo: https://github.com/golangci/golangci-lint
3+
rev: v1.56.2
4+
hooks:
5+
- id: golangci-lint
6+
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v4.4.0
9+
hooks:
10+
- id: no-commit-to-branch
11+
args: ["--branch", "master", "--branch", "main"]

.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch Package",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "auto",
12+
"program": "${fileDirname}"
13+
}
14+
]
15+
}

0 commit comments

Comments
 (0)