diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100755 index 00000000..996f5883 --- /dev/null +++ b/.githooks/pre-push @@ -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 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 25f36913..71dff2ef 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..43f091d0 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: + - repo: https://github.com/zricethezav/gitleaks + rev: v8.16.0 + hooks: + - id: gitleaks \ No newline at end of file diff --git a/Makefile b/Makefile index 003fbbf7..69126b5b 100644 --- a/Makefile +++ b/Makefile @@ -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)...'