fix(meta): keep reader temp info alive with a session lease #412
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: Unit Test | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| - dev | |
| paths: | |
| - "**.go" | |
| - "go.mod" | |
| - "go.sum" | |
| - ".github/workflows/unit-test.yaml" | |
| pull_request: | |
| branches: | |
| - master | |
| - dev | |
| paths: | |
| - "**.go" | |
| - "go.mod" | |
| - "go.sum" | |
| - ".github/workflows/unit-test.yaml" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| unit-test: | |
| name: Unit Test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.25" | |
| cache: true | |
| - name: Run unit tests | |
| run: | | |
| go test -race -short -cover -coverprofile=coverage.out -covermode=atomic -failfast -timeout=20m \ | |
| $(go list ./... | grep -v -E '(tests/)') | |
| - name: Upload coverage to Codecov | |
| if: success() | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: coverage.out | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false | |
| - name: Handle failure | |
| if: failure() && github.event_name == 'pull_request' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| PR=${{ github.event.pull_request.number }} | |
| gh pr comment $PR --body "❌ **Unit Test** failed. Comment \`/rerun-unit-test\` to rerun, or \`/rerun\` to rerun all failed checks." | |
| gh pr edit $PR --remove-label "ci-passed" 2>/dev/null || true | |
| - name: Add ci-passed label | |
| if: success() && github.event_name == 'pull_request' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| PR=${{ github.event.pull_request.number }} | |
| SELF="${{ github.workflow }}" | |
| REQUIRED_CHECKS=("Lint" "Go Mod Tidy Check" "Unit Test" "E2E Local" "E2E Object Storage" "E2E Service" "Component Integration Test" "Chaos Test" "Operator Test" "Upgrade Compat Local" "Upgrade Compat Object Storage" "Upgrade Compat Service") | |
| CHECKS=$(gh pr checks $PR --json name,bucket 2>/dev/null || echo "[]") | |
| ALL_PASSED=true | |
| for check in "${REQUIRED_CHECKS[@]}"; do | |
| [ "$check" = "$SELF" ] && continue | |
| bucket=$(echo "$CHECKS" | jq -r --arg n "$check" '.[] | select(.name == $n) | .bucket' | head -1) | |
| # Skip checks not triggered for this PR (filtered out by `paths`); only block on checks that actually ran. | |
| [ -z "$bucket" ] && continue | |
| if [ "$bucket" != "pass" ]; then | |
| ALL_PASSED=false | |
| break | |
| fi | |
| done | |
| if [ "$ALL_PASSED" = true ]; then | |
| gh pr edit $PR --add-label "ci-passed" | |
| fi |