Skip to content

Improve indexes current #433

Improve indexes current

Improve indexes current #433

Workflow file for this run

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
workflow_dispatch:
push:
branches: [main]
env:
CARGO_TERM_COLOR: always
COVERAGE_THRESHOLD: 9
name: tests_go
jobs:
test:
strategy:
matrix:
go-version: [1.23.x]
os: [ubuntu-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
cache-dependency-path: go.sum
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
${{ runner.os }}-go-
- name: Download dependencies
run: go mod download
- name: Verify dependencies
run: go mod verify
- name: Build verification
run: go build -v ./...
- name: Run tests with race detection
run: |
go test -v -race -timeout=20m -coverprofile=coverage.out -covermode=atomic -json ./... | tee test-results.json
timeout-minutes: 25
- name: Check coverage threshold
run: |
coverage=$(go tool cover -func=coverage.out | grep total | awk '{print substr($3, 1, length($3)-1)}')
echo "Coverage: ${coverage}%"
echo "Threshold: ${COVERAGE_THRESHOLD}%"
if (( $(echo "${coverage} < ${COVERAGE_THRESHOLD}" | bc -l) )); then
echo "Coverage ${coverage}% is below threshold ${COVERAGE_THRESHOLD}%"
exit 1
fi
echo "Coverage check passed!"
- name: Upload coverage to Codecov
if: matrix.go-version == '1.23.x'
uses: codecov/codecov-action@v4
with:
file: ./coverage.out
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.go-version }}-${{ matrix.os }}
path: |
test-results.json
coverage.out
retention-days: 30
- name: Parse test results
if: always()
run: |
if [ -f test-results.json ]; then
echo "Test Results Summary:"
cat test-results.json | jq -r 'select(.Action == "pass" or .Action == "fail") | "\(.Time) \(.Package) \(.Action)"' | tail -20
fi