Bläddra i källkod

Merge pull request #2315 from opencost/revert-2286-atm/add-code-coverage-ci

Revert "add code coverage"
Cliff Colvin 2 år sedan
förälder
incheckning
0fc7ce0365
4 ändrade filer med 4 tillägg och 79 borttagningar
  1. 3 11
      .github/workflows/pr.yaml
  2. 0 64
      .github/workflows/sonar.yaml
  3. 1 1
      justfile
  4. 0 3
      sonar-project.properties

+ 3 - 11
.github/workflows/pr.yaml

@@ -4,9 +4,7 @@ on:
   pull_request:
     branches:
       - develop
-  push:
-    branches:
-      - develop
+
 jobs:
   backend:
     runs-on: ubuntu-latest
@@ -38,18 +36,12 @@ jobs:
         name: Test
         run: |
           just test
-      - name: Get branch name 
-        shell: bash
-        run: echo "BRANCH_NAME=$(echo ${GITHUB_REF} | tr / -)" >> $GITHUB_ENV
-      - name: save coverage file
-        uses: actions/upload-artifact@v3
-        with:
-            path: ./coverage.out
-            name: coverage-${{ env.BRANCH_NAME }}-${{ github.sha }}
+
       -
         name: Build
         run: |
           just build-local
+
   frontend:
     runs-on: ubuntu-latest
     steps:

+ 0 - 64
.github/workflows/sonar.yaml

@@ -1,64 +0,0 @@
-Name: Sonar Code Quality Checks
-
-on:
-  workflow_run:
-    workflows: ["Develop PR - build test"]
-    types:
-      - completed
-
-jobs: 
-  submit-to-sonarcloud:
-    needs: backend
-    name: Submit to sonar
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v2
-        with:
-          fetch-depth: 0  # Shallow clones should be disabled for a better relevancy of analysis
-      - name: Get branch name 
-        shell: bash
-        run: echo "BRANCH_NAME=$(echo ${GITHUB_REF} | tr / -)" >> $GITHUB_ENV
-      - name: Restore coverage file
-        uses: actions/download-artifact@v3
-        with:
-          path: /tmp/coverage.out
-          name: coverage-${{ env.BRANCH_NAME }}-${{ github.sha }}
-      - name: copy output file
-        shell: bash
-        run: mv /tmp/coverage.out/coverage.out coverage.out
-      - uses: sonarsource/sonarcloud-github-action@master
-        env:
-          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-      - uses: geekyeggo/delete-artifact@v2
-        with:
-          name: coverage-${{ env.BRANCH_NAME }}-${{ github.sha }}
-      - name: save report file
-        uses: actions/upload-artifact@v3
-        with:
-            path: .scannerwork
-            name: report-${{ env.BRANCH_NAME }}-${{ github.sha }}
-  # code-quality-gate:  
-  #     needs: submit-to-sonarqube
-  #     name: Code Quality Gate
-  #     if: github.ref != 'refs/heads/develop'
-  #     runs-on: ubuntu-latest
-  #     steps: 
-  #       - name: Get branch name 
-  #         shell: bash
-  #         run: echo "BRANCH_NAME=$(echo ${GITHUB_REF} | tr / -)" >> $GITHUB_ENV
-  #       - name: Restore report file
-  #         uses: actions/download-artifact@v3
-  #         with:
-  #           path: /tmp/.scannerwork
-  #           name: report-${{ env.BRANCH_NAME }}-${{ github.sha }}
-  #       - name: copy output file
-  #         shell: bash
-  #         run: mv /tmp/.scannerwork .scannerwork
-  #       - uses: sonarsource/sonarqube-quality-gate-action@master
-  #         timeout-minutes: 5
-  #         env:
-  #           SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
-  #       - uses: geekyeggo/delete-artifact@v2
-  #         with:
-  #           name: report-${{ env.BRANCH_NAME }}-${{ github.sha }}      

+ 1 - 1
justfile

@@ -8,7 +8,7 @@ default:
 
 # Run unit tests
 test:
-    {{commonenv}} go test ./... -coverprofile=coverage.out
+    {{commonenv}} go test ./...
 
 # Compile a local binary
 build-local:

+ 0 - 3
sonar-project.properties

@@ -1,3 +0,0 @@
-sonar.projectKey=opencost
-sonar.sources=pkg,test
-sonar.go.coverage.reportPaths=coverage.out