refactor #21
This file contains hidden or 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
| name: Benchmark | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - feat/auto-scale | |
| concurrency: | |
| group: benchmark-${{ github.event_name == 'pull_request' && github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| benchmark: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.22" | |
| # setup uv and get uv path to env | |
| - name: Install uv | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| echo "UV_PATH=$(which uv)" >> $GITHUB_ENV | |
| - name: Setup License | |
| run: go run cmd/license/generate/main.go | |
| - name: Run benchmark | |
| env: | |
| UV_PATH: ${{ env.UV_PATH }} | |
| run: | | |
| go test -run=^$ -bench=. -benchmem -benchtime=30s ./... > result.txt | |
| - name: Run load testing | |
| run: | | |
| go run cmd/loadtesting/main.go > load_testing_result.txt | |
| - name: Run load testing with auto scale | |
| run: | | |
| go run cmd/loadtesting/main.go --min-instances 4 --max-instances 4 --auto-scale > load_testing_result_auto_scale.txt | |
| - name: Remove License | |
| run: git stash | |
| - name: Store benchmark result | |
| uses: rhysd/github-action-benchmark@v1 | |
| with: | |
| name: Go Benchmark | |
| tool: "go" | |
| output-file-path: result.txt | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| benchmark-data-dir-path: "benchmark-data" | |
| auto-push: true | |
| - name: Store load testing result to artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: load_testing_result.txt | |
| path: load_testing_result.txt | |
| - name: Store load testing result with auto scale to artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: load_testing_result_auto_scale.txt | |
| path: load_testing_result_auto_scale.txt |