fix: trim whitespace from checksum file before hash validation #331
Workflow file for this run
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: CI | |
| on: | |
| push: | |
| branches: [main, master, develop] | |
| paths-ignore: | |
| - "**.md" | |
| - LICENSE | |
| - ".gitignore" | |
| pull_request: | |
| branches: [main, master, develop] | |
| paths-ignore: | |
| - "**.md" | |
| - LICENSE | |
| - ".gitignore" | |
| permissions: | |
| contents: read | |
| env: | |
| GO_VERSION: "1.26" | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| cache-dependency-path: go.sum | |
| - name: Install golangci-lint | |
| run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2 | |
| - name: Run golangci-lint | |
| run: golangci-lint run ./... | |
| - name: Check go.mod tidy | |
| run: go mod tidy && git diff --exit-code go.mod go.sum | |
| - name: Verify install script checksums | |
| run: | | |
| expected=$(sha256sum scripts/install.sh scripts/install.ps1) | |
| actual=$(sed -n '/^[0-9a-f]/p' scripts/checksums.txt) | |
| if [ "$expected" != "$actual" ]; then | |
| echo "Checksum mismatch! Expected:" >&2 | |
| echo "$expected" >&2 | |
| echo "Actual:" >&2 | |
| echo "$actual" >&2 | |
| echo "Run 'pre-commit run update-checksums --all-files' to fix." >&2 | |
| exit 1 | |
| fi | |
| echo "Install script checksums verified." | |
| test: | |
| name: Test (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }}-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu, macos, windows] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| cache-dependency-path: go.sum | |
| - name: Run tests with coverage | |
| shell: bash | |
| run: | | |
| go test -race -coverprofile=coverage.out -covermode=atomic ./... | |
| go tool cover -func=coverage.out | |
| - name: Check coverage threshold | |
| if: matrix.os == 'ubuntu' | |
| shell: bash | |
| run: | | |
| COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//') | |
| echo "Total coverage: ${COVERAGE}%" | |
| if [ "$(echo "$COVERAGE < 70" | bc -l)" -eq 1 ]; then | |
| echo "Coverage ${COVERAGE}% is below 70% threshold" | |
| exit 1 | |
| fi | |
| platform: | |
| name: Build (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }}-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu, macos, windows] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| cache: true | |
| cache-dependency-path: go.sum | |
| - name: Build for ${{ matrix.os }} | |
| shell: bash | |
| run: | | |
| EXT="" | |
| if [ "${{ matrix.os }}" = "windows" ]; then EXT=".exe"; fi | |
| go build -v -o kairo$EXT . | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: kairo-${{ matrix.os }} | |
| path: kairo* |