This repository has been archived by the owner on Apr 19, 2024. It is now read-only.
MegaFix global behavior bugs. #287
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
name: On Pull Request | |
on: | |
pull_request: | |
branches: [ master ] | |
env: | |
GOLANGCI_LINT_VERSION: v1.56.2 | |
jobs: | |
test: | |
name: test | |
strategy: | |
matrix: | |
go-version: | |
- 1.20.x | |
- 1.21.x | |
os: [ ubuntu-latest ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Fetch git tags | |
run: git fetch --tags | |
- name: Version consistency check | |
run: ./contrib/check-version.sh | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Cache deps | |
uses: actions/cache@v4 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Install deps | |
run: go mod download | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v4 | |
with: | |
version: ${{ env.GOLANGCI_LINT_VERSION }} | |
skip-cache: true | |
- name: Test | |
run: go test -v -race -p=1 -count=1 -tags holster_test_mode | |
go-bench: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # to be able to retrieve the last commit in master branch | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: './go.mod' | |
cache-dependency-path: './go.sum' | |
check-latest: true | |
- name: Run benchmark and store the output to a file | |
run: | | |
set -o pipefail | |
make bench | tee ${{ github.sha }}_bench_output.txt | |
- name: Get Master branch SHA | |
id: get-master-branch-sha | |
run: | | |
SHA=$(git rev-parse origin/master) | |
echo "sha=$SHA" >> $GITHUB_OUTPUT | |
- name: Get benchmark JSON from Master branch | |
id: cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ./cache/benchmark-data.json | |
key: ${{ steps.get-master-branch-sha.outputs.sha }}-${{ runner.os }}-go-benchmark | |
- name: Compare benchmarks with master | |
uses: benchmark-action/github-action-benchmark@v1 | |
if: steps.cache.outputs.cache-hit == 'true' | |
with: | |
alert-threshold: "200%" | |
# What benchmark tool the output.txt came from | |
tool: 'go' | |
# Where the output from the benchmark tool is stored | |
output-file-path: ${{ github.sha }}_bench_output.txt | |
# Where the benchmarks in master are (to compare) | |
external-data-json-path: ./cache/benchmark-data.json | |
# Do not save the data | |
save-data-file: false | |
# Workflow will fail when an alert happens | |
fail-on-alert: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
# Enable Job Summary for PRs | |
summary-always: true | |
- name: Run benchmarks but don't compare to master branch | |
uses: benchmark-action/github-action-benchmark@v1 | |
if: steps.cache.outputs.cache-hit != 'true' | |
with: | |
# What benchmark tool the output.txt came from | |
tool: 'go' | |
# Where the output from the benchmark tool is stored | |
output-file-path: ${{ github.sha }}_bench_output.txt | |
# Write benchmarks to this file, do not publish to GitHub Pages | |
save-data-file: false | |
external-data-json-path: ./cache/benchmark-data.json | |
# Enable Job Summary for PRs | |
summary-always: true |