Skip to content

test: add test on restart and dev command #136

test: add test on restart and dev command

test: add test on restart and dev command #136

Workflow file for this run

name: Test
on:
pull_request:
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 Build
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: Init Dummy Git config for testing
run: |
git config --global user.email "[email protected]"
git config --global user.name "github-action"
- name: Test
shell: 'script -q -e -c "bash {0}"'
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: "./"