Skip to content

Commit

Permalink
refactor: runtime configuration for trunk correct to support all GOOS (
Browse files Browse the repository at this point in the history
…#161)

- Improve debug logging.
- Update deps.
  • Loading branch information
sheldonhull authored Aug 16, 2024
1 parent 49fe77d commit f2b89b4
Show file tree
Hide file tree
Showing 225 changed files with 14,076 additions and 7,279 deletions.
10 changes: 5 additions & 5 deletions .aqua/aqua.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
# require_checksum: true
registries:
- type: standard
ref: v4.192.0 # renovate: depName=aquaproj/aqua-registry
ref: v4.213.0 # renovate: depName=aquaproj/aqua-registry
packages:
- name: miniscruff/changie@v1.19.0
- name: goreleaser/goreleaser@v1.26.2
- name: miniscruff/changie@v1.19.1
- name: goreleaser/goreleaser@v2.2.0
- name: magefile/mage@v1.15.0
- name: golangci/golangci-lint@v1.59.1
- name: golang/go@go1.22.4
- name: golangci/golangci-lint@v1.60.1
- name: golang/go@go1.23.0
- name: gotestyourself/gotestsum@v1.12.0
- name: BurntSushi/ripgrep@14.1.0
- name: direnv/direnv@v2.34.0
Expand Down
3 changes: 3 additions & 0 deletions .changes/unreleased/🐛 Bug Fix-20240521-122813.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: "\U0001F41B Bug Fix"
body: Trunk upgrade was set to install, not upgrade tooling, so now it does what it should have done in the first place... before the coder in question got in way and didn't use his noggin.
time: 2024-05-21T12:28:13.507347-05:00
5 changes: 5 additions & 0 deletions .changes/unreleased/🐛 Bug Fix-20240815-182504.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: "\U0001F41B Bug Fix"
body: |-
Since mage is typically not precompiled, the normal build directives for darwin, linux, windows don't apply. Instead, the logic needs to be just runtime evaluation in the same code not broken apart by files.
This fixes it, improves logging for trunk setup, and does general dep upgrades.
time: 2024-08-15T18:25:04.926744-05:00
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: "\U0001F528 Developer Experience"
body: Improve the error output with shellescape library so the command that failed can be rerun manually easily.
time: 2024-08-15T18:32:50.392527-05:00
7 changes: 7 additions & 0 deletions .changes/unreleased/🔨 Refactor-20240521-122929.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: "\U0001F528 Refactor"
body: |-
Trunk package now supports installing for windows, via the newer trunk npm based install, while maintaining the bash install for linux/darwin.
If the project has a package.json, then it will install as dev dependency, otherwise as a global tool.
No logic to detect alternative tooling such as yarn, bun, deno, etc unless requested.
While trunk also supports this method of installation for Darwin/Linux, I've opted to keep it the same as before and use the bash install method for those regardless if package.json is there or not.
time: 2024-05-21T12:29:29.380394-05:00
8 changes: 0 additions & 8 deletions .changes/v1.0.2.md

This file was deleted.

16 changes: 2 additions & 14 deletions .changie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,34 @@ headerPath: header.tpl.md
changelogPath: CHANGELOG.md
versionExt: md
versionFormat: '## {{.Version}} - {{.Time.Format "2006-01-02"}}'
kindFormat: ""
changeFormat: "- **{{ .Kind }}**: {{ .Body -}}"
kindFormat: "### {{.Kind}}"
changeFormat: "- {{ .Body -}}"
body:
block: true
kinds:
- label: 🤖 CI & Build
key: ci-build
auto: patch
- label: 🎉 New Product Feature
key: new-product-feature
auto: minor
- label: 📘 Documentation
key: documentation
auto: patch
- label: ⬆️ Dependencies
key: dependencies
auto: patch
- label: 🐛 Bug Fix
key: bug-fix
auto: patch
- label: 🧪 Tests
key: tests
auto: patch
- label: 🔨 Developer Experience
key: developer-experience
auto: patch
- label: 🔨 Refactor
key: refactor
auto: patch
- label: 🔥 Breaking Change
key: breaking-change
auto: minor
- label: 🔒 Security
key: security
auto: patch
- label: ⬇️ Deprecated
key: deprecated
auto: minor
- label: 🔥 Major Version Change (Breaking Changes)
key: major-version-change-breaking-changes)
auto: major
newlines:
afterChange: 0
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ COPY files/first-run-notice.txt /home/$DEVCONTAINER_USER/first-run-notice.txt
RUN mkdir -p /home/$DEVCONTAINER_USER/.minikube \
&& chown $DEVCONTAINER_USER /home/$DEVCONTAINER_USER/.minikube \
&& /bin/bash -c 'set -euo pipefail && curl https://get.trunk.io -fsSL | bash -s -- -y' \
&& /bin/bash -c 'set -euo pipefail && curl -sSfL https://raw.githubusercontent.com/aquaproj/aqua-installer/v3.0.1/aqua-installer | bash'
&& /bin/bash -c 'set -euo pipefail && curl -sSfL https://raw.githubusercontent.com/aquaproj/aqua-installer/v1.0.0/aqua-installer | bash'


VOLUME [ "/var/lib/docker" ]
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"username": "vscode",
"installOhMyZsh": true
},
"ghcr.io/devcontainers/features/docker-in-docker:1.0.9": {
"ghcr.io/devcontainers/features/docker-in-docker:1.0.7": {
"version": "20.10",
"dockerDashComposeVersion": "v2",
"username": "vscode"
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/changie-trigger-release.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
with:
fetch-depth: 0
- name: Set up Go
Expand All @@ -28,7 +28,7 @@ jobs:
# whatchanged --output CHANGELOG.md
export GORELEASER_CURRENT_TAG="${{ github.event.inputs.version }}" && echo $GORELEASER_CURRENT_TAG >> $GITHUB_ENV
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 # v5
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:
timeout-minutes: 5
steps:
- name: checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
# Automatically caches for performance as well
# https://github.com/reviewdog/action-golangci-lint
# - name: golangci-lint
# uses: reviewdog/action-golangci-lint@70498f2d1f75a55ee9a4d719e74e21ed68aebea3 # renovate: tag=v2
- name: trunk-check
uses: trunk-io/trunk-action@f6c5f1b90503c30e02059667dbc247f2257b63c5 # v1
uses: trunk-io/trunk-action@bd686325615e9cf5a4ef98372ba94a472f9b5238 # v1
with:
arguments: --github-annotate-new-only=false
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4

# https://github.com/magnetikonline/action-golang-cache
- name: Setup Golang with cache
Expand Down
28 changes: 0 additions & 28 deletions .github/workflows/test.yml

This file was deleted.

81 changes: 81 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
name: go-tests
on:
pull_request:
push:
tags:
- v*
workflow_dispatch:
defaults:
run:
shell: bash
working-directory: .
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- uses: aquaproj/aqua-installer@fd2089d1f56724d6456f24d58605e6964deae124 # v2.3.2
with:
aqua_version: v2.27.4
enable_aqua_install: true
# aqua_opts: ""
env:
# AQUA_CONFIG: '${{ github.workspace }}/aqua.yaml'
AQUA_LOG_LEVEL: debug
AQUA_OPTS:
""
# working_directory: "${{ github.workspace }}"

# - name: aqua-install
# run: |
# curl -sSfL https://raw.githubusercontent.com/aquaproj/aqua-installer/v1.1.2/aqua-installer | bash -s -- -i /usr/local/bin/aqua
# # echo "$HOME/.local/share/aquaproj-aqua/bin" >> $GITHUB_PATH
# # [[ -e "${AQUA_CONFIG}" ]] && echo "✅ AQUA_CONFIG: ${AQUA_CONFIG} exists" || echo "::error ❗ unable to validate the target file: ${AQUA_CONFIG} exists"
# ls -lla "${{ github.workspace }}"
# env:
# AQUA_CONFIG: '${{ github.workspace }}/aqua.yaml'
# AQUA_LOG_LEVEL: debug
# AQUA_OPTS: ""
- name: env-config-go
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Setup Golang caches
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
with:
path: |
${HOME}/.cache/go-build
${HOME}/go/pkg/mod
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-golang-
- name: mage-init
run: |
export PATH="${AQUA_ROOT_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/aquaproj-aqua}/bin/aqua:${PATH}"
export PATH="$(go env GOPATH)/bin:${PATH}"
# aqua install # --only-link
mage init
- name: mage-testsum
run: |
export PATH="${AQUA_ROOT_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/aquaproj-aqua}/bin/aqua:${PATH}"
export PATH="$(go env GOPATH)/bin:${PATH}"
mage go:testsum ./...
env:
# Race conditions will be hit due to the cli driven tasks and binaries being called.
GOTEST_DISABLE_RACE: 1
GOTESTS: "slow"
GOTEST_FLAGS: "--tags=integration"

- name: Upload coverage reports to Codecov
run: |
# improved codecov with signature verification
curl https://uploader.codecov.io/verification.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
curl -Os https://uploader.codecov.io/latest/linux/codecov
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
shasum -a 256 -c codecov.SHA256SUM
chmod +x codecov
./codecov -t ${{ secrets.CODECOV_TOKEN }}
40 changes: 15 additions & 25 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
---
output:
formats:
- format: line-number

- format: tab
linters-settings:
misspell:
locale: US

nolintlint:
allow-unused: false
allow-no-explanation: []
Expand Down Expand Up @@ -38,15 +36,14 @@ linters-settings:
desc: use zerolog
- pkg: "github.com/pkg/errors"
desc: Should be replaced by standard lib errors package

# gomodguard:
# blocked:
# modules:
# - github.com/sirupsen/logrus:
# recommendations:
# - internal/logging
# reason: logging is allowed only by zerolog. Please use zerolog
# local_replace_directives: false
# gomodguard:
# blocked:
# modules:
# - github.com/sirupsen/logrus:
# recommendations:
# - internal/logging
# reason: logging is allowed only by zerolog. Please use zerolog
# local_replace_directives: false
tagliatelle:
case:
use-field-name: true
Expand Down Expand Up @@ -95,7 +92,6 @@ linters-settings:
- ok
- zl
- fs

revive:
ignore-generated-header: true
enable-all-rules: true
Expand All @@ -104,45 +100,39 @@ linters-settings:
severity: error
- name: line-length-limit
disabled: true

- name: add-constant
disabled: true
- name: comment-spacings
disabled: true
- name: cognitive-complexity
disabled: true # not useful for this repo cause it's not typical nice Go code ;-p
linters:
enable-all: true
disable:
- scopelint
- paralleltest
- noctx
- wsl
- lll
- interfacer
- golint
- maligned
- goimports
- gci
- gofmt
- nlreturn
- gofumpt
- exhaustivestruct
- exhaustruct
- wrapcheck
- godox
- execinquery
- nonamedreturns
- forbidigo
- structcheck
- varcheck
- deadcode
- ifshort
- godox
- godot
- nosnakecase
- rowserrcheck # disabled due to generics, can enable in future if needed
- sqlclosecheck # disabled due to generics, can enable in future if needed
- wastedassign # disabled due to generics, can enable in future if needed
- funlen #OVERRIDE: ok using for bot, lots of quick long commands i worked on
- cyclop #OVERRIDE: ok using for bot, lots of quick long commands i worked on
- gocognit #OVERRIDE: ok using for bot, lots of quick long commands i worked on
- perfsprint

run:
timeout: 5m
build-tags:
Expand Down
7 changes: 0 additions & 7 deletions .trunk/scripts/gotestsum-superslow.sh

This file was deleted.

7 changes: 0 additions & 7 deletions .trunk/scripts/gotestsum.sh

This file was deleted.

Loading

0 comments on commit f2b89b4

Please sign in to comment.