Skip to content

Commit

Permalink
chore: replace makefile by taskfile
Browse files Browse the repository at this point in the history
  • Loading branch information
nikaro committed Aug 18, 2024
1 parent e7343e4 commit cc5da3a
Show file tree
Hide file tree
Showing 17 changed files with 235 additions and 274 deletions.
10 changes: 0 additions & 10 deletions .devcontainer.json

This file was deleted.

17 changes: 10 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# EditorConfig is awesome: https://editorconfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_style = tab
indent_size = 4
indent_style = space
indent_size = 2
insert_final_newline = true

[Dockerfile]
indent_style = space
[*.py]
indent_size = 4

[*.{json,yml,yaml}]
indent_style = space
indent_size = 2
[Makefile]
indent_style = tab
10 changes: 10 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh

echo Running commit-msg hook

if ! command -v cz >/dev/null 2>&1; then
echo "commitizen could not be found - please install it commiting"
exit 1
fi

cz check --allow-abort --commit-msg-file "$1"
15 changes: 15 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env sh

echo Running pre-commit hook

# Run pre-commit, this checks if we changed any files and runs the checks.
FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
if [ -n "$FILES" ]; then
if ! task lint --yes >/dev/null 2>&1; then
echo "Error running make lint - please fix before committing"
echo "if this is a mistake you can skip the checks with 'git commit --no-verify'"
exit 1
fi
fi

exit 0
4 changes: 0 additions & 4 deletions .github/FUNDING.yml

This file was deleted.

10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
- package-ecosystem: gomod
directory: /
schedule:
interval: weekly
13 changes: 0 additions & 13 deletions .github/renovate.json

This file was deleted.

57 changes: 31 additions & 26 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
---
name: CD

on:
schedule:
- cron: "0 0 * * 3"
workflow_dispatch:

env:
TASK_X_REMOTE_TASKFILES: 1

jobs:
ci:
name: CI
Expand All @@ -15,41 +17,44 @@ jobs:
release:
name: Release
needs: [ci]
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
GH_TOKEN: ${{ github.token }}
run: |-
gh repo clone ${{ github.repository }} ${{ github.workspace }} -- --branch "$BRANCH"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Dry run
uses: commitizen-tools/commitizen-action@1f11eb222996406681d2bfa1eb3d997eca46557c # 0.21.0
with:
github_token: ${{ github.token }}
changelog_increment_filename: _changelog.md
dry_run: true
- name: Install tools
run: |
echo "/home/linuxbrew/.linuxbrew/bin" >> "$GITHUB_PATH"
/home/linuxbrew/.linuxbrew/bin/brew install \
commitizen \
go \
go-task \
goreleaser \
- name: Bump
if: env.PREVIOUS_REVISION != env.REVISION
uses: commitizen-tools/commitizen-action@1f11eb222996406681d2bfa1eb3d997eca46557c # 0.21.0
with:
github_token: ${{ github.token }}
changelog_increment_filename: _changelog.md
run: |-
echo "PREVIOUS_REVISION=$(cz version --project)" >>"$GITHUB_ENV"
task go:bump --yes
echo "REVISION=$(cz version --project)" >>"$GITHUB_ENV"
- name: Setup Go
- name: Push tags
if: env.PREVIOUS_REVISION != env.REVISION
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
cache: true
check-latest: true
go-version-file: go.mod
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
REMOTE_REPO: https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.git
run: git push "$REMOTE_REPO" "HEAD:${BRANCH}" --tags

- name: Run GoReleaser
- name: Release
if: env.PREVIOUS_REVISION != env.REVISION
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
args: release --clean --release-notes _changelog.md
env:
AUR_KEY: ${{ secrets.AUR_KEY }}
GITHUB_TOKEN: ${{ github.token }}
run: task go:release --yes
93 changes: 52 additions & 41 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,88 @@
---
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_call:
workflow_dispatch:

permissions:
contents: read

env:
TASK_X_REMOTE_TASKFILES: 1

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
cache: true
check-latest: true
go-version-file: go.mod

- name: Run staticcheck
uses: dominikh/staticcheck-action@fe1dd0c3658873b46f8c9bb3291096a617310ca6 # v1.3.1
with:
install-go: false

- name: Run govulncheck
uses: golang/govulncheck-action@dd0578b371c987f96d1185abb54344b44352bd58 # v1.0.3
with:
go-version-file: go.mod
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
GH_TOKEN: ${{ github.token }}
run: gh repo clone ${{ github.repository }} ${{ github.workspace }} -- --depth=1 --branch "$BRANCH"

- name: Run golangci-lint
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
- name: Install tools
run: |
echo "/home/linuxbrew/.linuxbrew/bin" >> "$GITHUB_PATH"
/home/linuxbrew/.linuxbrew/bin/brew install \
actionlint \
check-jsonschema \
fd \
go \
go-task \
golangci-lint \
govulncheck \
jq \
prettier \
shellcheck \
staticcheck \
shfmt \
yamlfmt \
yamllint \
- name: Run pre-commit
uses: nikaro/actions/pre-commit@cecb5d4e1f07cde50d8c5738e4a1c60c4938fc9f # 1.6.10
with:
python-version: 3.x
- name: Lint
run: task lint --yes

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
GH_TOKEN: ${{ github.token }}
run: gh repo clone ${{ github.repository }} ${{ github.workspace }} -- --depth=1 --branch "$BRANCH"

- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
cache: true
check-latest: true
go-version-file: go.mod
- name: Install tools
run: |
echo "/home/linuxbrew/.linuxbrew/bin" >> "$GITHUB_PATH"
/home/linuxbrew/.linuxbrew/bin/brew install \
go \
go-task \
- name: Build
run: go build -v .
run: task go:build --yes

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
GH_TOKEN: ${{ github.token }}
run: gh repo clone ${{ github.repository }} ${{ github.workspace }} -- --depth=1 --branch "$BRANCH"

- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
cache: true
check-latest: true
go-version-file: go.mod
- name: Install tools
run: |
echo "/home/linuxbrew/.linuxbrew/bin" >> "$GITHUB_PATH"
/home/linuxbrew/.linuxbrew/bin/brew install \
go \
go-task \
- name: Test
run: go test -v ./...
run: task go:test --yes
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ config.toml

# Artifacts
_changelog.md
.task/
1 change: 0 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
---
version: 2

builds:
Expand Down
67 changes: 0 additions & 67 deletions .pre-commit-config.yaml

This file was deleted.

7 changes: 7 additions & 0 deletions .yamlfmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
gitignore_excludes: true
formatter:
eof_newline: true
pad_line_comments: 2
retain_line_breaks_single: true
scan_folded_as_literal: true
trim_trailing_whitespace: true
Loading

0 comments on commit cc5da3a

Please sign in to comment.