fix: fix lintings (#58)
## Description
<!-- **Please link some issue here describing what you are trying to achieve.**
In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->
relates to #1234
## Checklist
- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)
Reviewed-on: #58
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
This commit is contained in:
parent
843fc46f54
commit
e01ae1a920
85 changed files with 430 additions and 246 deletions
104
.github/workflows/ci.yaml
vendored
104
.github/workflows/ci.yaml
vendored
|
|
@ -104,11 +104,67 @@ jobs:
|
|||
--gpgPubKeyFile=public_key.pem \
|
||||
--version=${VERSION}
|
||||
|
||||
testing:
|
||||
name: CI run tests
|
||||
runs-on: ubuntu-latest
|
||||
needs: config
|
||||
env:
|
||||
TF_ACC_PROJECT_ID: ${{ vars.TF_ACC_PROJECT_ID }}
|
||||
TF_ACC_REGION: ${{ vars.TF_ACC_REGION }}
|
||||
TF_ACC_TEST_PROJECT_SERVICE_ACCOUNT_EMAIL: ${{ vars.TF_ACC_TEST_PROJECT_SERVICE_ACCOUNT_EMAIL }}
|
||||
TF_ACC_SERVICE_ACCOUNT_FILE: "~/service_account.json"
|
||||
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: Create service account json file
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
run: |
|
||||
echo "${{ secrets.TF_ACC_SERVICE_ACCOUNT_JSON }}" >~/service_account.json
|
||||
|
||||
- name: Run go mod tidy
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
run: go mod tidy
|
||||
|
||||
- name: Testing
|
||||
run: make test
|
||||
|
||||
- name: Acceptance Testing
|
||||
env:
|
||||
TF_ACC: "1"
|
||||
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:
|
||||
|
|
@ -137,31 +193,37 @@ jobs:
|
|||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v9
|
||||
with:
|
||||
version: v2.7
|
||||
version: v2.9
|
||||
args: --config=golang-ci.yaml --allow-parallel-runners --timeout=5m
|
||||
continue-on-error: true
|
||||
|
||||
- name: Lint
|
||||
- name: Linting
|
||||
run: make lint
|
||||
continue-on-error: true
|
||||
|
||||
- name: Test
|
||||
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: 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' }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue