-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Use Mise to track tools and run tasks (#162)
- Loading branch information
Showing
5 changed files
with
98 additions
and
139 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
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
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 |
---|---|---|
|
@@ -23,38 +23,26 @@ jobs: | |
with: | ||
ref: ${{ inputs.version || github.ref }} | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.x | ||
cache: true | ||
|
||
- name: Install parse-changelog | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: [email protected] | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: jdx/mise-action@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Determine version (tagged release) | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
run: | | ||
set -eou pipefail | ||
REF=${{ github.ref }} | ||
echo "VERSION=${REF#refs/tags/v}" >> "$GITHUB_ENV" | ||
- name: Determine version (manual dispatch) | ||
if: github.event_name == 'workflow_dispatch' | ||
- name: Set version (changie) | ||
if: inputs.version == '' | ||
run: | | ||
CHANGIE_VERSION=$(changie latest) | ||
echo "VERSION=${CHANGIE_VERSION#v}" >> "$GITHUB_ENV" | ||
- name: Set version (input) | ||
if: inputs.version != '' | ||
run: | ||
echo "VERSION=${INPUT_VERSION#v}" >> "$GITHUB_ENV" | ||
env: | ||
INPUT_VERSION: ${{ inputs.version }} | ||
|
||
- name: Extract changelog | ||
run: | | ||
parse-changelog CHANGELOG.md ${{ env.VERSION }} > ${{ github.workspace }}-CHANGELOG.txt | ||
tail -n+2 .changes/v${{ env.VERSION }}.md \ | ||
| tee ${{ github.workspace }}-CHANGELOG.txt | ||
echo ::group::CHANGELOG | ||
cat ${{ github.workspace }}-CHANGELOG.txt | ||
echo ::endgroup:: | ||
|
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 @@ | ||
[env] | ||
GOBIN = "{{ config_root }}/bin" | ||
_.path = ["{{ config_root }}/bin"] | ||
|
||
[vars] | ||
_readme_args = '-o README.md -preface doc/preface.txt doc/README.md' | ||
|
||
[tools] | ||
"ubi:golangci/golangci-lint" = "latest" | ||
"ubi:miniscruff/changie" = "latest" | ||
go = "1.23.5" | ||
|
||
[tasks.install] | ||
run = "go install go.abhg.dev/stitchmd" | ||
description = "Install the project into bin/" | ||
|
||
[tasks.test] | ||
description = "Run tests" | ||
run = "go test ./..." | ||
|
||
[tasks."test:cover"] | ||
description = "Run tests with coverage" | ||
run = ["go test -coverprofile=cover.out -coverpkg=./... ./..."] | ||
|
||
[tasks."test:cover:html"] | ||
description = "Run tests with coverage and generate HTML report" | ||
depends = ["test:cover"] | ||
run = "go tool cover -html=cover.out -o cover.html" | ||
|
||
[tasks.lint] | ||
description = "Run all linters" | ||
depends = ["lint:*"] | ||
|
||
[tasks.readme] | ||
description = "Update the README" | ||
sources = ["doc/**", "**/*.go"] | ||
run = "go run . {{vars._readme_args}}" | ||
|
||
[tasks."lint:tidy"] | ||
description = "Ensure go.mod is tidy" | ||
run = "go mod tidy -diff" | ||
|
||
[tasks."lint:golangci"] | ||
description = "Run golangci-lint" | ||
run = "golangci-lint run" | ||
|
||
[tasks."lint:readme"] | ||
description = "Ensure that the README is up-to-date" | ||
run = """ | ||
DIFF=$(go run . -color -d {{vars._readme_args}}) | ||
if [[ -n "$DIFF" ]]; then | ||
echo "README.md is out of date" | ||
echo "$DIFF" | ||
exit 1 | ||
fi | ||
""" | ||
|
||
[tasks."release:prepare"] | ||
description = "Prepare a release" | ||
run = [ | ||
"changie batch {{arg(name='version')}}", | ||
"changie merge", | ||
] | ||
|