Skip to content

test(world-cli): Add a sample test and fix a bug with the docker daem… #39

test(world-cli): Add a sample test and fix a bug with the docker daem…

test(world-cli): Add a sample test and fix a bug with the docker daem… #39

Workflow file for this run

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 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: 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: "./"