feat: implement gno mod tidy
#1414
Workflow file for this run
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
name: misc | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.x | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
# sync with misc/devdeps/go.mod | |
version: v1.53 | |
args: | |
--config=./.github/golangci.yml | |
fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.x | |
- name: Install make | |
run: sudo apt-get install -y make | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# prefill dependencies so that mod messages don't show up in make output | |
- name: Fetch dependencies | |
run: go mod download -modfile ./misc/devdeps/go.mod -x | |
# inspired by: | |
# https://github.com/Jerome1337/gofmt-action/blob/d5eabd189843f1d568286a54578159978b7c0fb1/entrypoint.sh | |
- name: Check gofumpt | |
run: | | |
output="$(GOFMT_FLAGS=-l make -s fmt)" | |
if [ ! -z "$output" ]; then | |
echo "The following files are not properly formatted; run 'make fmt' to format them." | |
echo "$output" | |
exit 1 | |
else | |
echo 'Succeeded.' | |
fi | |
modtidy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.x | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Check go.mods | |
run: | | |
sums="$(sha256sum go.mod misc/devdeps/go.mod)" | |
for path in . ./misc/devdeps; do | |
env -C $path go mod tidy -v || exit 1 | |
done | |
echo "$sums" | sha256sum -c |