Merge pull request #19 from osodevops/fix/metadata-key-deletion #35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) OSO DevOps | |
| # SPDX-License-Identifier: MPL-2.0 | |
| name: Tests | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - 'README.md' | |
| - 'CHANGELOG.md' | |
| - 'docs/**' | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - 'README.md' | |
| - 'CHANGELOG.md' | |
| - 'docs/**' | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - name: Build | |
| run: go build -v . | |
| generate: | |
| name: Generate | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: '1.6.*' | |
| terraform_wrapper: false | |
| - name: Generate Documentation | |
| run: go generate ./... | |
| - name: Check for uncommitted changes | |
| run: | | |
| git diff --compact-summary --exit-code || \ | |
| (echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1) | |
| test: | |
| name: Unit Tests (Go ${{ matrix.go-version }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| go-version: | |
| - '1.21' | |
| - '1.22' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| cache: true | |
| - name: Run Tests | |
| run: go test -v -cover -coverprofile=coverage.out -timeout=120s -parallel=4 ./... | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-${{ matrix.go-version }} | |
| path: coverage.out | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v4 | |
| with: | |
| version: latest | |
| # Acceptance tests run on push to main only (requires secrets) | |
| acceptance: | |
| name: Acceptance Tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| needs: | |
| - build | |
| - test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: '1.6.*' | |
| terraform_wrapper: false | |
| - name: Run Acceptance Tests | |
| run: go test -v -cover -timeout=20m -parallel=4 ./... | |
| env: | |
| TF_ACC: '1' | |
| WORKOS_API_KEY: ${{ secrets.WORKOS_API_KEY }} | |
| WORKOS_CLIENT_ID: ${{ secrets.WORKOS_CLIENT_ID }} |