fix: use empty stdin by default #842
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
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
name: Test | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go-version: [1.21.x] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Test | |
run: go test ./... -coverprofile coverage.out | |
- name: Report coverage | |
uses: coverallsapp/github-action@v2 | |
with: | |
file: coverage.out | |
parallel: true | |
flag-name: ${{ join(matrix.*, ' ') }} | |
test-integrity: | |
strategy: | |
matrix: | |
go-version: [1.21.x] | |
os: [ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
env: | |
GOCOVERDIR: ${{ github.workspace }}/_icoverdir_ | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Prepare lefthook | |
run: | | |
mkdir _icoverdir_ | |
go install -cover | |
- name: Run integrity tests | |
run: go test integrity_test.go -tags=integrity | |
- name: Collect coverage | |
run: | | |
go tool covdata textfmt -i _icoverdir_ -o coverage.out | |
- name: Report coverage | |
uses: coverallsapp/github-action@v2 | |
with: | |
file: coverage.out | |
format: golang | |
parallel: true | |
flag-name: integration-${{ join(matrix.*, ' ') }} | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21.x | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Build binaries | |
uses: goreleaser/goreleaser-action@v2 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: build --snapshot --skip-validate --clean | |
- name: Tar binaries to preserve executable bit | |
run: 'tar -cvf lefthook-binaries.tar --directory dist/ $(find dist/ -executable -type f -printf "%P\0" | xargs --null)' | |
- name: Upload binaries as artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Executables | |
path: lefthook-binaries.tar | |
coverage: | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
- test-integrity | |
steps: | |
- uses: coverallsapp/github-action@v2 | |
with: | |
carryforward: "integration-1.21.x ubuntu-latest,integration-1.21.x macos-latest,1.21.x ubuntu-latest,1.21.x macos-latest,1.21.x windows-latest" | |
parallel-finished: true |