1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-07 21:47:02 +09:00

GO-1732 Add commit hooks and test coverage report

This commit is contained in:
Mikhail Iudin 2023-07-21 13:14:26 +02:00
parent 9b7d7e11a7
commit b3bf441aca
No known key found for this signature in database
GPG key ID: FAAAA8BAABDFF1C0
4 changed files with 46 additions and 0 deletions

17
.githooks/pre-push Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
INSTALL_PYTHON=python3
ARGS=(hook-impl --config=.pre-commit-config.yaml --hook-type=pre-push)
# end templated
HERE="$(cd "$(dirname "$0")" && pwd)"
ARGS+=(--hook-dir "$HERE" -- "$@")
if [ -x "$INSTALL_PYTHON" ]; then
exec "$INSTALL_PYTHON" -mpre_commit "${ARGS[@]}"
elif command -v pre-commit > /dev/null; then
exec pre-commit "${ARGS[@]}"
else
echo '`pre-commit` not found. Please visit https://wiki.anytype.io/doc/mandatory-git-hooks-5rQt1Qyw7k ' 1>&2
exit 1
fi

View file

@ -3,6 +3,10 @@ on:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
test:
runs-on: ubuntu-latest
@ -32,6 +36,21 @@ jobs:
${{ runner.os }}-go-${{ matrix.go-version }}-
# }}
- name: Setup license repository
uses: actions/checkout@master
with:
repository: anyproto/open
ref: refs/heads/main
path: ./open
- name: Check licenses
run: |
cd open
python3 tools/generate.py --platform golang
cd ..
sudo gem install license_finder
license_finder inherited_decisions add open/decisions.yml
license_finder --enabled-package-managers gomodules
- name: deps
run: make deps
@ -55,3 +74,4 @@ jobs:
echo "Failed"
exit 1
fi
- uses: seriousben/go-patch-cover-action@v1

5
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,5 @@
repos:
- repo: https://github.com/zricethezav/gitleaks
rev: v8.16.0
hooks:
- id: gitleaks

View file

@ -2,6 +2,10 @@
export GOPRIVATE=github.com/anyproto
export PATH:=deps:$(PATH)
all:
@set -e;
@git config core.hooksPath .githooks;
proto:
@echo 'Generating protobuf packages (Go)...'