feat: initial (#1) #7
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
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
- qa | |
- uat | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
container: golang:1.23-alpine | |
env: | |
ENVIRONMENT: ci | |
steps: | |
- uses: actions/checkout@v4 | |
- run: apk update && apk add curl openssl git openssh-client build-base && mkdir -p /root/.ssh | |
- run: wget -O /usr/bin/mockgen https://github.com/skynet2/mock/releases/latest/download/mockgen && chmod 777 /usr/bin/mockgen | |
- run: go test -json -coverprofile=/root/coverage_temp.txt -covermode=atomic ./... > /root/test.json | |
- run: cat /root/coverage_temp.txt | grep -v "_mock.go" | grep -v "_mocks.go" | grep -v "_mocks_test.go" | grep -v "_mock_test.go" > /root/coverage.txt || true | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: /root/coverage.txt | |
if: (!(startsWith(github.event.pull_request.title, 'Deploy to'))) | |
- run: cat /root/test.json | |
if: always() | |
- run: wget https://github.com/mfridman/tparse/releases/latest/download/tparse_linux_x86_64 -O tparse && chmod 777 tparse && ./tparse -all -file=/root/test.json | |
if: always() | |
- uses: guyarb/[email protected] | |
if: always() | |
with: | |
test-results: /root/test.json | |
lint: | |
runs-on: ubuntu-latest | |
container: golang:1.23-alpine | |
env: | |
ENVIRONMENT: ci | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: golangci/[email protected] | |
if: github.ref != 'refs/heads/master' && github.ref != 'refs/heads/qa' && github.ref != 'refs/heads/uat' | |
with: | |
version: latest | |
args: --timeout=5m --tests=false ./... |