ci: Upload coverage reports to Codecov #17
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: Build And Test | |
on: | |
push: | |
# Does not run on a tag push | |
branches: | |
- "main" | |
paths-ignore: | |
- "**.md" | |
pull_request: | |
paths-ignore: | |
- "**.md" | |
jobs: | |
Build: | |
strategy: | |
matrix: | |
go-version: [1.21.0] | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Setup Go ${{ matrix.go }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Fetch Repository | |
uses: actions/checkout@v2 | |
- name: Tidy | |
run: go mod tidy | |
- name: Build | |
run: ./scripts/build.sh | |
- name: Test | |
run: go test -v ./... -race -coverprofile=coverage.out -covermode=atomic | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
docker-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch Repository | |
uses: actions/checkout@v3 | |
- name: Build Image | |
run: make docker-build | |
- name: Run Image | |
run: | | |
docker run --name dexus -d -p 8080:8080 --rm dexus:latest | |
sleep 5 | |
if ! curl -fs localhost:8080/health; then | |
printf 'err: container is not running properly' >&2 | |
exit 1 | |
fi | |
docker stop dexus | |
- name: Deploy Image | |
run: echo 'TODO' | |
golangci: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21" | |
cache: false | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.54 |