diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1fbd372f..bf8649ad 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -104,11 +104,55 @@ jobs: --gpgPubKeyFile=public_key.pem \ --version=${VERSION} + testing: + name: CI run tests + runs-on: ubuntu-latest + needs: config + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Build + uses: ./.github/actions/build + with: + go-version: ${{ env.GO_VERSION }} + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v2 + with: + terraform_wrapper: false + + - name: "Run go mod tidy" + if: ${{ github.event_name == 'pull_request' }} + run: go mod tidy + + - name: Testing + run: make test + + - name: Acceptance Testing + if: ${{ github.event_name == 'pull_request' }} + run: make test-acceptance-tf + + - name: Check coverage threshold + shell: bash + run: | + make coverage + COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//') + echo "Coverage: $COVERAGE%" + if (( $(echo "$COVERAGE < 80" | bc -l) )); then + echo "Coverage is below 80%" + # exit 1 + fi + + - name: Archive code coverage results + uses: actions/upload-artifact@v4 + with: + name: ${{ env.CODE_COVERAGE_ARTIFACT_NAME }} + path: "stackit/${{ env.CODE_COVERAGE_FILE_NAME }}" main: if: ${{ github.event_name != 'schedule' }} - name: CI + name: CI run build and linting runs-on: ubuntu-latest needs: config steps: @@ -145,29 +189,29 @@ jobs: run: make lint continue-on-error: true - - name: Testing - run: make test +# - name: Testing +# run: make test +# +# - name: Acceptance Testing +# if: ${{ github.event_name == 'pull_request' }} +# run: make test-acceptance-tf +# +# - name: Check coverage threshold +# shell: bash +# run: | +# make coverage +# COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//') +# echo "Coverage: $COVERAGE%" +# if (( $(echo "$COVERAGE < 80" | bc -l) )); then +# echo "Coverage is below 80%" +# # exit 1 +# fi - - name: Acceptance Testing - if: ${{ github.event_name == 'pull_request' }} - run: make test-acceptance-tf - - - name: Check coverage threshold - shell: bash - run: | - make coverage - COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//') - echo "Coverage: $COVERAGE%" - if (( $(echo "$COVERAGE < 80" | bc -l) )); then - echo "Coverage is below 80%" - # exit 1 - fi - - - name: Archive code coverage results - uses: actions/upload-artifact@v4 - with: - name: ${{ env.CODE_COVERAGE_ARTIFACT_NAME }} - path: "stackit/${{ env.CODE_COVERAGE_FILE_NAME }}" +# - name: Archive code coverage results +# uses: actions/upload-artifact@v4 +# with: +# name: ${{ env.CODE_COVERAGE_ARTIFACT_NAME }} +# path: "stackit/${{ env.CODE_COVERAGE_FILE_NAME }}" config: if: ${{ github.event_name != 'schedule' }}