careyjames/dns-scout

View on GitHub
.github/workflows/codeclimate.yml

Summary

Maintainability
Test Coverage
name: Code Climate

on:
  push:
    branches:
      - main

jobs:
  codeclimate:
    runs-on: ubuntu-latest
    steps:
      - name: Check Out Code
        uses: actions/checkout@v2

      - name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.21 # Replace with your Go version
      
      - name: Print Current Working Directory
        run: |
          ls -all
        working-directory: ${{ github.workspace }}

      - name: Install Code Climate Test Reporter
        run: |
          curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
          chmod +x ./cc-test-reporter

      - name: Run Tests and Upload Coverage
        env:
          CC_TEST_REPORTER_ID: 4409f8e483a77d5f19fc0ccb0e31b4b0829d054f325e81eaf98cd2f4115f490e
        run: |
          go test $(go list ./... | grep -v constant | grep -v dto | grep -v generate_sitemap | grep -v generate_sitemap) -coverprofile c.out
          mkdir -p ./github.com/careyjames
          ln -s $PWD ./github.com/careyjames/dns-scout
          ./cc-test-reporter format-coverage -t gocov -o codeclimate.json c.out
          ./cc-test-reporter upload-coverage -i ./codeclimate.json