summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorKirill <[email protected]>2021-11-08 17:38:55 +0300
committerGitHub <[email protected]>2021-11-08 06:38:55 -0800
commit5e35338d58b589939b599c98ec9e6b44f94de20a (patch)
tree2cfd09de36ac1488d0662c0ac37ddf0caefccc42 /.github
parent533c82f2707b8ad2f0f667867b3ea91ec08667aa (diff)
Generate stringer files automatically (#841)
Added `stringer` annotations to `git.go` for `ErrorClass` and `ErrorCode`. Added `generate` rule for `Makefile` to generate string representations for these types (first building cgo files in `_obj` dir to get C constants). Finally, updated `ci` actions workflow to check that generated files are up to date. Fixes: #543
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/ci.yml23
1 files changed, 23 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5ab1b48..bc8e3bd 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -105,3 +105,26 @@ jobs:
sudo ./script/build-libgit2.sh --static --system
- name: Test
run: go test --count=1 --tags "static,system_libgit2" ./...
+
+ check-generate:
+ name: Check generated files were not modified
+ runs-on: ubuntu-20.04
+ steps:
+ - name: Set up Go
+ uses: actions/setup-go@v1
+ with:
+ go-version: '1.17'
+ id: go
+ - name: Check out code into the Go module directory
+ uses: actions/checkout@v2
+ - name: Install libgit2 build dependencies
+ run: |
+ git submodule update --init
+ sudo apt-get install -y --no-install-recommends libssh2-1-dev
+ go install golang.org/x/tools/cmd/stringer@latest
+ - name: Generate files
+ run: |
+ export PATH=$(go env GOPATH)/bin:$PATH
+ make generate
+ - name: Check nothing changed
+ run: git diff --quiet --exit-code || (echo "detected changes after generate" ; git status ; exit 1)