GO-3354 subscription publish undetermined order #2931
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
on: [ pull_request ] | |
name: Test | |
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@v1 | |
with: | |
go-version: 1.22 | |
- name: git config | |
run: git config --global url.https://${{ secrets.ANYTYPE_PAT }}@github.com/.insteadOf /~https://github.com/ | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup GO | |
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: | | |
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 | |
CGO_CFLAGS="-Wno-deprecated-declarations -Wno-deprecated-non-prototype -Wno-xor-used-as-pow" gotestsum --junitfile ~/gotestsum-report/gotestsum-report.xml -- -tags "nogrpcserver nographviz" -p 1 $(echo $PACKAGE_NAMES) -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 |