Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
requilence committed May 31, 2023
1 parent 3fae8fa commit d97b4a4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
echo $(go env GOPATH)/bin >> $GITHUB_PATH
- name: Install patched gox
run: |
rm -rf $GOPATH/src/github.com/mitchellh
mkdir -p $GOPATH/src/github.com/mitchellh
cd $GOPATH/src/github.com/mitchellh
git clone https://github.com/aslakhellesoy/gox
Expand All @@ -35,13 +36,6 @@ jobs:
go install github.com/mitchellh/gox
- name: Checkout
uses: actions/checkout@v2
- uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
- name: Set env vars
env:
AMPLITUDE_KEY: ${{ secrets.AMPLITUDE_KEY }}
Expand All @@ -52,15 +46,15 @@ jobs:
echo VERSION=${GITHUB_REF##*/} >> $GITHUB_ENV
echo SDKROOT=$(xcrun --sdk macosx --show-sdk-path) >> $GITHUB_ENV
echo GOPRIVATE=github.com/anyproto >> $GITHUB_ENV
echo PATH=deps:$(GOPATH)/bin:$(PATH) >> $GITHUB_ENV
echo $(pwd)/deps >> $GITHUB_PATH
echo "${GOBIN}" >> $GITHUB_PATH
git config --global url."https://${{ secrets.ANYTYPE_PAT }}@github.com/".insteadOf "https://github.com/"
- name: Go mod download
run: |
go mod download
- name: install protoc
run: |
make setup-protoc
make setup-protoc-go
- name: setup go
run: |
make setup-go
Expand Down Expand Up @@ -198,12 +192,13 @@ jobs:
cd open
python3 tools/generate.py --platform golang
cd ..
gem install license_finder
sudo gem install license_finder
license_finder inherited_decisions add open/decisions.yml
license_finder --enabled-package-managers gomodules
- name: Install patched gox
run: |
rm -rf $GOPATH/src/github.com/mitchellh
mkdir -p $GOPATH/src/github.com/mitchellh
cd $GOPATH/src/github.com/mitchellh
git clone https://github.com/aslakhellesoy/gox
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Generate mocks
run: |
go install github.com/golang/mock/mockgen@latest
CGO_ENABLED=0 go generate ./...
CGO_ENABLED=0 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 }}
Expand All @@ -57,7 +57,7 @@ jobs:
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
gotestsum --junitfile ~/gotestsum-report/gotestsum-report.xml -- -tags "nogrpcserver nographviz" -p 1 $(echo $PACKAGE_NAMES) -coverprofile=coverage.out -covermode=count ./...
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) -coverprofile=coverage.out -covermode=count ./...
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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ lint:

test:
@echo 'Running tests...'
@ANYTYPE_LOG_NOGELF=1 go test -cover github.com/anyproto/anytype-heart/...
@ANYTYPE_LOG_NOGELF=1 CGO_CFLAGS="-Wno-deprecated-declarations -Wno-deprecated-non-prototype -Wno-xor-used-as-pow" go test -cover github.com/anyproto/anytype-heart/...

test-integration:
@echo 'Running integration tests...'
Expand Down

0 comments on commit d97b4a4

Please sign in to comment.