cleanup path prefix #9
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: Build | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "*.md" | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- "*.md" | |
permissions: | |
pull-requests: write | |
contents: write | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23.4 | |
- name: Download dependencies | |
run: | | |
go mod tidy | |
go mod download -x | |
- name: Run Tests with Coverage | |
run: | | |
mkdir -p coverage | |
go test -v \ | |
$(go list ./... | grep -v '^github.com/maintc/rustmaps-cli/cmd') \ | |
-coverprofile=coverage/coverage.txt \ | |
-covermode atomic | |
- name: Update coverage report | |
uses: ncruces/go-coverage-report@v0 | |
with: | |
coverage-file: coverage/coverage.txt | |
report: true | |
chart: true | |
amend: true | |
- name: Install gocov and gocov-xml | |
run: | | |
go install github.com/axw/gocov/gocov@latest | |
go install github.com/AlekSi/gocov-xml@latest | |
- name: Convert coverage to Cobertura | |
run: | | |
gocov convert coverage/coverage.txt | gocov-xml > coverage/cobertura.xml | |
- name: Upload Coverage Report | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: coverage/ | |
compile: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23.4 | |
- name: Build binary | |
run: go build -x -o rustmaps | |
coverage: | |
needs: test | |
if: ${{ github.event_name == 'pull_request' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: coverage-report | |
path: coverage/ | |
- uses: insightsengineering/coverage-action@v2 | |
with: | |
path: coverage/cobertura.xml | |
threshold: 80 | |
fail: true | |
publish: true | |
diff: true | |
diff-branch: main | |
coverage-summary-title: "Code Coverage Summary" | |
diff-storage: coverage-reports |