From 0c59bbc39bc47c8001a744e3357e090df723000f Mon Sep 17 00:00:00 2001 From: Pulkit Kathuria Date: Mon, 22 Jan 2024 16:12:30 +0900 Subject: [PATCH] merged ci yamls --- .github/workflows/build.yml | 46 ------------------ .github/workflows/coveritup.yml | 86 ++++++++++++++++----------------- 2 files changed, 43 insertions(+), 89 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index a840e51..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,46 +0,0 @@ -on: - push: - paths: - - '**/*.go' - - '**/*.mod' - - '**/*.sum' - - '**/*.yml' -name: CI -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} -jobs: - build: - strategy: - matrix: - go-version: [latest] - os: [ubuntu-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - uses: kevincobain2000/action-gobrew@v2 - with: - version: ${{ matrix.go-version }} - - name: Setup Node.js ${{ matrix.node-versions }} - uses: actions/setup-node@v2 - with: - node-version: 20 - - - name: Build Dist for Embed - working-directory: app/frontend - run: | - npm install - npm run build - - name: Build - working-directory: app - run: go build main.go - - - name: Install Tools - run: | - go install github.com/securego/gosec/v2/cmd/gosec@latest - - name: Lint - working-directory: app - run: | - gosec ./... - go vet -all . - diff --git a/.github/workflows/coveritup.yml b/.github/workflows/coveritup.yml index fe806e7..5a10e3a 100644 --- a/.github/workflows/coveritup.yml +++ b/.github/workflows/coveritup.yml @@ -79,51 +79,51 @@ jobs: with: type: go-build-time - # - name: Test - # working-directory: app - # run: | - # START=$SECONDS - # go test -race -v ./... -count=1 -coverprofile=coverage.out - # echo SCORE=$(($SECONDS-START)) >> "$GITHUB_ENV" - # - uses: kevincobain2000/action-coveritup@v1 - # with: - # type: unit-test-run-time + - name: Test + working-directory: app + run: | + START=$SECONDS + go test -race -v ./... -count=1 -coverprofile=coverage.out + echo SCORE=$(($SECONDS-START)) >> "$GITHUB_ENV" + - uses: kevincobain2000/action-coveritup@v1 + with: + type: go-test-run-time - # - name: Coverage - # working-directory: app - # run: | - # go tool cover -html=coverage.out -o coverage.html - # gocov convert coverage.out | gocov-xml > coverage.xml - # - name: Coveritup - # run: | - # curl -sLk https://raw.githubusercontent.com/kevincobain2000/cover-totalizer/master/install.sh | sh - # echo SCORE=`./cover-totalizer coverage.xml` >> "$GITHUB_ENV" - # - uses: kevincobain2000/action-coveritup@v1 - # with: - # type: coverage + - name: Coverage + working-directory: app + run: | + go tool cover -html=coverage.out -o coverage.html + gocov convert coverage.out | gocov-xml > coverage.xml + - name: Coveritup + run: | + curl -sLk https://raw.githubusercontent.com/kevincobain2000/cover-totalizer/master/install.sh | sh + echo SCORE=`./cover-totalizer coverage.xml` >> "$GITHUB_ENV" + - uses: kevincobain2000/action-coveritup@v1 + with: + type: coverage - # - name: Go Binary Size - # working-directory: app - # run: | - # echo SCORE=`du -sk main | awk '{print $1}'` >> "$GITHUB_ENV" - # - uses: kevincobain2000/action-coveritup@v1 - # with: - # type: go-binary-size + - name: Go Binary Size + working-directory: app + run: | + echo SCORE=`du -sk main | awk '{print $1}'` >> "$GITHUB_ENV" + - uses: kevincobain2000/action-coveritup@v1 + with: + type: go-binary-size - # - name: Number of dependencies - # working-directory: app - # run: echo SCORE=`go list -m all|wc -l|awk '{$1=$1};1'` >> "$GITHUB_ENV" - # - uses: kevincobain2000/action-coveritup@v1 - # with: - # type: go-mod-dependencies + - name: Number of dependencies + working-directory: app + run: echo SCORE=`go list -m all|wc -l|awk '{$1=$1};1'` >> "$GITHUB_ENV" + - uses: kevincobain2000/action-coveritup@v1 + with: + type: go-mod-dependencies - # - name: Number of GO Sec issues - # working-directory: app - # run: echo SCORE=`gosec -no-fail --quiet ./...|grep Issues | tail -1 |awk '{print $3}'` >> "$GITHUB_ENV" - # - uses: kevincobain2000/action-coveritup@v1 - # with: - # type: go-sec-issues + - name: Number of GO Sec issues + working-directory: app + run: echo SCORE=`gosec -no-fail --quiet ./...|grep Issues | tail -1 |awk '{print $3}'` >> "$GITHUB_ENV" + - uses: kevincobain2000/action-coveritup@v1 + with: + type: go-sec-issues - # - uses: kevincobain2000/action-coveritup@v1 - # with: - # pr_comment: true + - uses: kevincobain2000/action-coveritup@v1 + with: + pr_comment: true