Perf tests #69
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
#https://linear.app/anytype/issue/GO-3985/make-performance-report-on-the-stand | |
on: | |
workflow_dispatch: | |
inputs: | |
run-on-runner: | |
description: 'Specify the runner to use' | |
required: true | |
default: 'ARM64' | |
perf-test: | |
description: 'Run perf test times' | |
required: true | |
default: '10' | |
schedule: | |
- cron: '0 1 * * *' # every day at 1am | |
filters: | |
branches: | |
include: | |
- 'main' | |
permissions: | |
actions: 'write' | |
contents: 'write' | |
name: Perf tests | |
jobs: | |
build: | |
timeout-minutes: 60 | |
runs-on: 'ARM64' | |
steps: | |
- name: Setup GO | |
run: | | |
go version | |
echo GOPATH=$(go env GOPATH) >> $GITHUB_ENV | |
echo GOBIN=$(go env GOPATH)/bin >> $GITHUB_ENV | |
echo $(go env GOPATH)/bin >> $GITHUB_PATH | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set env vars | |
env: | |
UNSPLASH_KEY: ${{ secrets.UNSPLASH_KEY }} | |
INHOUSE_KEY: ${{ secrets.INHOUSE_KEY }} | |
run: | | |
GIT_SUMMARY=$(git describe --tags --always) | |
echo "FLAGS=-X github.com/anyproto/anytype-heart/util/vcs.GitSummary=${GIT_SUMMARY} -X github.com/anyproto/anytype-heart/metrics.DefaultInHouseKey=${INHOUSE_KEY} -X github.com/anyproto/anytype-heart/util/unsplash.DefaultToken=${UNSPLASH_KEY}" >> $GITHUB_ENV | |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
VERSION=${{ github.event.inputs.alpha_version }} | |
if [ -z "$VERSION" ]; then | |
VERSION=$(git rev-parse --short HEAD) | |
fi | |
fi | |
if [ -z "$VERSION" ]; then | |
VERSION=${GITHUB_REF##*/} | |
fi | |
echo VERSION=${VERSION} >> $GITHUB_ENV | |
echo MAVEN_ARTIFACT_VERSION=${VERSION} >> $GITHUB_ENV | |
echo GOPRIVATE=github.com/anyproto >> $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 | |
- name: setup go | |
run: | | |
make setup-go | |
make setup-gomobile | |
which gomobile | |
- name: run perf tests | |
run: | | |
echo "Running perf tests" | |
RUN_COUNT=${{ github.event.inputs.perf-test }} | |
if [[ "${{ github.event_name }}" == "schedule" ]]; then | |
RUN_COUNT=100 | |
fi | |
echo $PERF_CONFIG_STAGING > config.json | |
mv .github/staging_fake.yml staging_fake.yml | |
PERF_CONFIG=$PWD/config.json | |
cd cmd/perfstand/account_create | |
CGO_ENABLED="1" go run main.go $PERF_CONFIG $RUN_COUNT | |
cd ../account_select | |
CGO_ENABLED="1" go run main.go $PERF_CONFIG $RUN_COUNT | |
cd ../../.. | |
echo $PERF_CONFIG_LOCAL > ./config.json | |
cd cmd/perfstand/account_create | |
CGO_ENABLED="1" go run main.go $PERF_CONFIG $RUN_COUNT | |
cd ../account_select | |
CGO_ENABLED="1" go run main.go $PERF_CONFIG $RUN_COUNT | |
env: | |
PERF_CONFIG_STAGING: ${{ secrets.PERF_CONFIG_STAGING }} | |
PERF_CONFIG_LOCAL: ${{ secrets.PERF_CONFIG_LOCAL }} | |
CH_API_KEY: ${{ secrets.CH_PERF_API_KEY }} | |
- name: Archive perf tests results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: traces | |
path: | | |
*.log |