ci: fix releaser #25
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
name: Test | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
workflow_call: | |
jobs: | |
go-test: | |
name: Run Go Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: [1.21.x] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
cache-dependency-path: "go.sum" | |
- name: Test | |
run: | | |
go test ./... -coverprofile=coverage.out -covermode=count -v | |
- name: Upload coverage results to Github artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: ./coverage.out | |
upload-codecov: | |
name: Upload coverage output to Codecov.io | |
runs-on: ubuntu-latest | |
needs: go-test | |
if: github.ref == 'refs/heads/main' || github.event_name == 'pull_request' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download coverage output file | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage | |
- name: Upload coverage output to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
fail_ci_if_error: true | |
directory: "./" |