From e8750f55ec11300963989caa45c58c2fab602eb8 Mon Sep 17 00:00:00 2001 From: Ranielly Ferreira Date: Wed, 2 Oct 2024 12:00:07 -0300 Subject: [PATCH] Add OSSF Scorecard and Go unit test workflows --- .github/workflows/scorecard.yml | 25 +++++++++++++++++++++++++ .github/workflows/unit-tests.yml | 26 ++++++++++++++++++++++++++ internal/utils/utils_test.go | 2 +- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/scorecard.yml create mode 100644 .github/workflows/unit-tests.yml diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml new file mode 100644 index 0000000..278bb02 --- /dev/null +++ b/.github/workflows/scorecard.yml @@ -0,0 +1,25 @@ +name: OSSF Scorecard + +on: + schedule: + - cron: "0 0 * * 0" # Executa semanalmente aos domingos + workflow_dispatch: + +jobs: + scorecard: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run OSSF Scorecard + uses: ossf/scorecard-action@v2 + with: + results_file: results.sarif + # Opções adicionais podem ser configuradas aqui + + - name: Upload Scorecard Results + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: results.sarif diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 0000000..43f5735 --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,26 @@ +name: Go Unit Test + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Go 1.20 + uses: actions/setup-go@v4 + with: + go-version: 1.20 + + - name: Install dependencies + run: go mod download + + - name: Run unit tests + run: make test-unit diff --git a/internal/utils/utils_test.go b/internal/utils/utils_test.go index f755e84..8618f9a 100644 --- a/internal/utils/utils_test.go +++ b/internal/utils/utils_test.go @@ -19,7 +19,7 @@ package utils_test import ( "testing" - "github.com/raniellyferreira/rotate-files/pkg/utils" + "github.com/raniellyferreira/rotate-files/internal/utils" ) func TestGetAccountContainerAndPath(t *testing.T) {