Skip to content

Commit

Permalink
build: Update tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmidyson committed Jul 1, 2024
1 parent cbab9ee commit 059cd53
Show file tree
Hide file tree
Showing 18 changed files with 617 additions and 57 deletions.
16 changes: 6 additions & 10 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi
# Automatically sets up your devbox environment whenever you cd into this
# directory via our direnv integration:

nix_direnv_watch_file devenv.nix
nix_direnv_watch_file devenv.lock
nix_direnv_watch_file devenv.yaml
if ! use flake . --impure
then
echo "devenv could not be build. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
fi
eval "$(devbox generate direnv --print-envrc)"

# check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/
# for more details
9 changes: 7 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021-2023 D2iQ, Inc. All rights reserved.
# Copyright 2021 D2iQ, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# To get started with Dependabot version updates, you'll need to specify which
Expand All @@ -9,9 +9,14 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
directories:
- "/"
schedule:
interval: "weekly"
groups:
all-go-mod-patch-and-minor:
patterns: [ "*" ]
update-types: [ "patch", "minor" ]

- package-ecosystem: "github-actions"
directory: "/"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/checks-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: Set up devenv.sh environment
uses: d2iq-labs/devenv.sh-action@v1
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.11.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
enable-cache: true

- name: Build
run: make build-snapshot
run: devbox run -- make build-snapshot

- name: Run binary
run: |
Expand Down
52 changes: 35 additions & 17 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,51 +22,69 @@ jobs:
- name: Check out code
uses: actions/checkout@v4

- name: Set up devenv.sh environment
uses: d2iq-labs/devenv.sh-action@v1
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.11.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
enable-cache: true

- name: Run unit tests
run: make test
run: devbox run -- make test

lint:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up devenv.sh environment
uses: d2iq-labs/devenv.sh-action@v1
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.11.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
enable-cache: true

- name: Export golang and golangci-lint versions
id: versions
run: |
echo "GOLANGCI_LINT_VERSION=v$(golangci-lint version --format short)" >>$GITHUB_ENV
echo "GO_VERSION=$(go version | grep -o "[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)\?")" >>$GITHUB_ENV
echo "GOLANGCI_LINT_VERSION=v$(devbox run -- golangci-lint version --format short)" >>$GITHUB_OUTPUT
echo "GO_VERSION=$(devbox run -- go version | grep -o "[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)\?")" >>$GITHUB_OUTPUT
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
fail_on_error: true
reporter: github-pr-review
golangci_lint_version: ${{ env.GOLANGCI_LINT_VERSION }}
go_version: ${{ env.GO_VERSION }}
golangci_lint_version: ${{ steps.versions.outputs.GOLANGCI_LINT_VERSION }}
go_version: ${{ steps.versions.outputs.GO_VERSION }}

pre-commit:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Install devbox
uses: jetify-com/devbox-install-action@v0.11.0
with:
enable-cache: true

- name: Set up devenv.sh environment
uses: d2iq-labs/devenv.sh-action@v1
- name: Go cache
uses: actions/cache@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: pre-commit/action@v3.0.1
- name: Set up pre-commit cache
uses: actions/cache@v4
with:
extra_args: --all-files --show-diff-on-failure
path: ~/.cache/pre-commit
key: pre-commit-3|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Run pre-commit
run: devbox run -- make pre-commit
env:
SKIP: no-commit-to-branch,golangci-lint
SKIP: no-commit-to-branch,golangci-lint,actionlint-system
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ jobs:
with:
languages: ${{ matrix.language }}

- name: Set up devenv.sh environment
uses: d2iq-labs/devenv.sh-action@v1
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.11.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
enable-cache: true

- name: Build
run: make build-snapshot
run: devbox run -- make build-snapshot

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
20 changes: 18 additions & 2 deletions .github/workflows/conventional-pr-title.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021-2023 D2iQ, Inc. All rights reserved.
# Copyright 2021 D2iQ, Inc. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

name: "conventional-pr-title"
Expand All @@ -7,10 +7,26 @@ on:
types:
- opened
- edited
defaults:
run:
shell: bash
jobs:
check:
runs-on: ubuntu-22.04
steps:
- uses: amannn/action-semantic-pull-request@v5
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5
with:
types: |
build
ci
docs
feat
fix
perf
refactor
release
revert
style
test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/release-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
ref: ${{ github.ref }}
fetch-depth: 0

- name: Set up devenv.sh environment
uses: d2iq-labs/devenv.sh-action@v1
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.11.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
enable-cache: true

- name: Release
run: make release
run: devbox run -- make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ linters-settings:
- performance
- style
gofumpt:
lang-version: "1.17"
extra-rules: true
lll:
line-length: 120
Expand Down
19 changes: 8 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@ repos:
hooks:
- id: go-mod-tidy
stages: [commit]
- id: golangci-lint-mod
stages: [commit]
args: ["--fix"]
- repo: local
hooks:
- id: go-generate
name: go-generate
entry: make go-generate
language: system
types: [go]
pass_filenames: false
- id: golangci-lint
name: golangci-lint
entry: make go-generate lint
language: system
files: "(.*\\.go|go.mod|go.sum|go.mk)$"
pass_filenames: false
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
stages: [commit]
Expand Down Expand Up @@ -60,7 +57,7 @@ repos:
- id: script-must-have-extension
stages: [commit]
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.5
rev: v0.10.0.1
hooks:
- id: shellcheck
stages: [commit]
Expand Down
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.10.2"
}
15 changes: 15 additions & 0 deletions devbox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"packages": [
"crane@latest",
"go@latest",
"kubernetes-helm@latest",
"golines@latest",
"gotestsum@latest",
"goreleaser@latest",
"pre-commit@latest",
"shfmt@latest",
"yq-go@latest",
"path:./hack/flakes#golangci-lint",
"path:./hack/flakes#go-mod-upgrade"
]
}
Loading

0 comments on commit 059cd53

Please sign in to comment.