Merge pull request #1162 from carapace-sh/dependabot/github_actions/g… #3135
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: Go | |
on: | |
pull_request: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: shallow clone | |
uses: actions/checkout@v5 | |
if: "!startsWith(github.ref, 'refs/tags/')" | |
- name: deep clone | |
uses: actions/checkout@v5 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v6 | |
with: | |
go-version: '1.23.4' | |
- name: Generate | |
run: go generate ./... | |
- name: Test | |
run: mkdir .cover && CARAPACE_COVERDIR="$(pwd)/.cover" go test -v -coverpkg ./... -coverprofile=unit.cov ./... ./example-nonposix/... | |
- name: Bench | |
run: go test -bench ./... | |
- name: Convert coverage | |
run: go tool covdata textfmt -i .cover/ -o integration.cov | |
- name: Filter coverage | |
run: sed -i '/^github.com\/carapace-sh\/carapace\/third_party/d' unit.cov integration.cov | |
- name: "Check formatting" | |
run: '[ "$(gofmt -d -s . | tee -a /dev/stderr)" = "" ]' | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage | |
path: | | |
unit.cov | |
integration.cov | |
retention-days: 1 | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
coveralls: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: shallow clone | |
uses: actions/checkout@v5 | |
- uses: actions/download-artifact@v5 | |
with: | |
name: coverage | |
- uses: shogo82148/actions-goveralls@v1 | |
with: | |
path-to-profile: unit.cov | |
parallel: true | |
- uses: shogo82148/actions-goveralls@v1 | |
with: | |
path-to-profile: integration.cov | |
parallel: true | |
- uses: shogo82148/actions-goveralls@v1 | |
with: | |
parallel-finished: true |