Skip to content

GO-4065 Add latex processors #4239

GO-4065 Add latex processors

GO-4065 Add latex processors #4239

Workflow file for this run

on:
push:
branches:
- main
pull_request:
branches:
- '*'
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
jobs:
unit-test:
runs-on: ${{ vars.RUNNER_TEST }}
env:
GOPRIVATE: github.com/anyproto
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22
cache: false
- name: git config
run: git config --global url.https://${{ secrets.ANYTYPE_PAT }}@github.com/.insteadOf https://github.com/
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup GO env
run: |
echo GOPATH=$(go env GOPATH) >> $GITHUB_ENV
echo GOBIN=$(go env GOPATH)/bin >> $GITHUB_ENV
echo $(go env GOPATH)/bin >> $GITHUB_PATH
- 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 ..
gem install license_finder
license_finder inherited_decisions add open/decisions.yml
license_finder --enabled-package-managers gomodules
- name: Generate mocks
run: |
make download-tantivy-all
go install go.uber.org/mock/mockgen@v0.3.0
CGO_ENABLED=1 CGO_CFLAGS="-Wno-deprecated-declarations -Wno-deprecated-non-prototype -Wno-xor-used-as-pow" go generate ./...
- name: Go test
env:
prometheus_username: ${{ secrets.PROMETHEUS_USERNAME }}
prometheus_password: ${{ secrets.PROMETHEUS_PASSWORD }}
run: |
export ANYTYPE_LOG_LEVEL=DEBUG
export ANYTYPE_LOG_NOGELF=1
go install gotest.tools/gotestsum@latest
PACKAGE_NAMES=$(go list -tags nogrpcserver ./... | grep -v "github.com/anyproto/anytype-heart/cmd/grpserver" | grep -v "github.com/anyproto/anytype-heart/clientlibrary/clib")
rm -rf ~/gotestsum-report
mkdir ~/gotestsum-report
if [[ "$GITHUB_REF" == "refs/heads/main" && "$GITHUB_EVENT_NAME" == "push" ]]; then
export RACE=-race
else
echo "run without race detector"
fi
CGO_CFLAGS="-Wno-deprecated-non-prototype -Wno-unknown-warning-option -Wno-deprecated-declarations -Wno-xor-used-as-pow -Wno-single-bit-bitfield-constant-conversion" gotestsum --junitfile ~/gotestsum-report/gotestsum-report.xml -- -tags "nogrpcserver nographviz" -ldflags="-extldflags=-Wl,-ld_classic" -p 1 $(echo $PACKAGE_NAMES) $(echo $RACE) -coverprofile=coverage.out -covermode=atomic ./...
generated_pattern='^\/\/ Code generated .* DO NOT EDIT\.$'
files_list=$(grep -rl "$generated_pattern" . | grep '\.go$' | sed 's/^\.\///')
for file in $files_list; do
echo "Removing $file from coverage report"
grep -v "$file" coverage.out > temp_file
mv temp_file coverage.out
done
COVERAGE=$(go tool cover -func coverage.out | grep total | awk '{print substr($3, 1, length($3)-1)}')
echo "coverage_middleware $COVERAGE" | curl --data-binary @- --user "$prometheus_username:$prometheus_password" https://pushgateway.anytype.io/metrics/job/tech_quality
- name: Publish Test Report
uses: mikepenz/action-junit-report@v2
with:
report_paths: '~/gotestsum-report/gotestsum-report.xml'
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: seriousben/go-patch-cover-action@v1