feat: implement merge request approval rules and settings, #52 #99
Workflow file for this run
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
| name: ci | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| run_integration: | |
| description: "Run integration tests with GitLab Testcontainers" | |
| required: false | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| golangci: | |
| name: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go from go.mod | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Install golangci-lint | |
| run: | | |
| go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | |
| echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" | |
| - name: Run golangci-lint | |
| run: golangci-lint run --timeout=10m | |
| test-fast: | |
| name: test (fast) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code into the Go module directory | |
| uses: actions/checkout@v4 | |
| - name: Set up Go from go.mod | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Run fast tests | |
| run: go test -v ./... | |
| coverage: | |
| name: coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code into the Go module directory | |
| uses: actions/checkout@v4 | |
| - name: Set up Go from go.mod | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Generate coverage | |
| id: coverage-output | |
| run: | | |
| go test ./... -coverprofile=coverage.out | |
| go tool cover -func=coverage.out | tee coverage.txt | |
| { | |
| echo 'coverage_text<<EOF_TEXT' | |
| cat coverage.txt | |
| echo EOF_TEXT | |
| } >> "$GITHUB_OUTPUT" | |
| echo "## Coverage" >> "$GITHUB_STEP_SUMMARY" | |
| echo '```text' >> "$GITHUB_STEP_SUMMARY" | |
| cat coverage.txt >> "$GITHUB_STEP_SUMMARY" | |
| echo '```' >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload coverage artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: go-coverage | |
| path: | | |
| coverage.out | |
| coverage.txt | |
| - name: Comment coverage on PR | |
| if: github.event_name == 'pull_request' | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| header: coverage | |
| message: | | |
| ## Coverage | |
| ```text | |
| ${{ steps.coverage-output.outputs.coverage_text }} | |
| ``` | |
| test-integration: | |
| name: test (integration) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 90 | |
| if: >- | |
| github.ref == 'refs/heads/main' || | |
| (github.event_name == 'workflow_dispatch' && github.event.inputs.run_integration == 'true') | |
| steps: | |
| - name: Check out code into the Go module directory | |
| uses: actions/checkout@v4 | |
| - name: Set up Go from go.mod | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Run integration tests | |
| env: | |
| GLABS_RUN_GITLAB_TC: "1" | |
| run: | | |
| go test -tags=integration ./gitlab/... -count=1 -v -run '^TestIntegration_' | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - golangci | |
| - test-fast | |
| - coverage | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - uses: go-semantic-release/action@v1 | |
| with: | |
| changelog-generator-opt: "emojis=true" | |
| allow-initial-development-versions: true | |
| hooks: goreleaser | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |