From 8f596ffae712f7b27c07ab236bf3134dd9b9af16 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Thu, 3 Oct 2024 16:00:58 +0200 Subject: [PATCH 1/3] Add offline tests workflow and clean up SonarQube config Introduce a new offline tests workflow to validate Go code across multiple OS and Go versions. This commit also removes unused environment variables and updates the Go version syntax in the SonarQube workflow. --- .github/workflows/offline-tests.yml | 47 +++++++++++++++++++++++++++++ .github/workflows/sonarqube.yml | 13 +------- 2 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/offline-tests.yml diff --git a/.github/workflows/offline-tests.yml b/.github/workflows/offline-tests.yml new file mode 100644 index 0000000..7ca3ea2 --- /dev/null +++ b/.github/workflows/offline-tests.yml @@ -0,0 +1,47 @@ +# SPDX-FileCopyrightText: 2022 Winni Neessen +# +# SPDX-License-Identifier: CC0-1.0 + +name: Offline tests workflow +on: + push: + branches: + - main + paths: + - '**.go' + - 'go.*' + - '.github/**' + - 'codecov.yml' + pull_request: + branches: + - main + paths: + - '**.go' + - 'go.*' + - '.github/**' + - 'codecov.yml' +permissions: + contents: read + +jobs: + run: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + go: ['1.19', '1.20', '1.21', '1.22', '1.23'] + steps: + - name: Harden Runner + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 + with: + egress-policy: audit + + - name: Checkout Code + uses: actions/checkout@61b9e3751b92087fd0b06925ba6dd6314e06f089 # master + - name: Setup go + uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + with: + go-version: ${{ matrix.go }} + - name: Run Tests + run: | + go test -race -shuffle=on ./... \ No newline at end of file diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml index 3f6dc11..dd91da2 100644 --- a/.github/workflows/sonarqube.yml +++ b/.github/workflows/sonarqube.yml @@ -14,17 +14,6 @@ on: pull_request: branches: - main # or the name of your main branch -env: - TEST_HOST: ${{ secrets.TEST_HOST }} - TEST_FROM: ${{ secrets.TEST_USER }} - TEST_ALLOW_SEND: "1" - TEST_SMTPAUTH_USER: ${{ secrets.TEST_USER }} - TEST_SMTPAUTH_PASS: ${{ secrets.TEST_PASS }} - TEST_SMTPAUTH_TYPE: "LOGIN" - TEST_ONLINE_SCRAM: "1" - TEST_HOST_SCRAM: ${{ secrets.TEST_HOST_SCRAM }} - TEST_USER_SCRAM: ${{ secrets.TEST_USER_SCRAM }} - TEST_PASS_SCRAM: ${{ secrets.TEST_PASS_SCRAM }} jobs: build: name: Build @@ -42,7 +31,7 @@ jobs: - name: Setup Go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: - go-version: '1.23.x' + go-version: '1.23' - name: Run unit Tests run: | From 6f10892d0b81ceaab4abb7a77b7a6b78cd80f289 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Thu, 3 Oct 2024 16:01:58 +0200 Subject: [PATCH 2/3] Reduce Go versions in Codecov workflow to only 1.23 This commit updates the Codecov GitHub Actions workflow to run only on Go version 1.23, removing support for 1.19 and 1.20. Simplifying to a single Go version aims to streamline the testing process and reduce potential compatibility issues. --- .github/workflows/codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 0099f12..60679ee 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -40,7 +40,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - go: ['1.19', '1.20', '1.23'] + go: ['1.23'] steps: - name: Harden Runner uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 From 19dcba620aa6d47a1903d2a469a77470ea538e2b Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Thu, 3 Oct 2024 16:15:07 +0200 Subject: [PATCH 3/3] Remove redundant steps from Cirrus CI configuration Eliminated unnecessary environment variables and pkg update step to streamline the CI process. Simplified the test script by removing verbose flag from the go test command. --- .cirrus.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index f240ff5..8ca7373 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -14,12 +14,10 @@ freebsd_task: image_family: freebsd-14-0 env: - TEST_ALLOW_SEND: 0 TEST_SKIP_SENDMAIL: 1 pkginstall_script: - - pkg update -f - pkg install -y go test_script: - - go test -v -race -cover -shuffle=on ./... \ No newline at end of file + - go test -race -cover -shuffle=on ./... \ No newline at end of file