Investigate slow pipelines #4
Workflow file for this run
This file contains 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: Code Quality | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
deps: | |
runs-on: ubuntu-latest | |
name: Cache dependencies | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.work | |
cache-dependency-path: | | |
*.sum | |
**/*.sum | |
- run: make tidy | |
name: Download dependencies | |
lint: | |
runs-on: ubuntu-latest | |
needs: deps | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.work | |
cache-dependency-path: | | |
*.sum | |
**/*.sum | |
- run: make lint | |
- name: Check for changes | |
id: check-changed-files | |
uses: tj-actions/[email protected] | |
with: | |
files: | | |
* | |
- name: Diff | |
if: steps.check-changed-files.outputs.files_changed == 'true' | |
run: git diff | |
- name: Fail if code needs linting | |
if: steps.check-changed-files.outputs.files_changed == 'true' | |
run: | | |
echo "Changed files: ${{ steps.check-changed-files.outputs.changed_files }}" | |
echo "Run make lint-fix or make generate to attempt to fix linter errors." | |
exit 1 | |
test: | |
runs-on: ubuntu-latest | |
needs: deps | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: go.work | |
cache-dependency-path: | | |
*.sum | |
**/*.sum | |
- name: Install JUnit Reporter | |
run: | | |
go install github.com/jstemmer/go-junit-report@latest | |
- name: Test | |
run: | | |
GOBIN=$PWD/hack/bin go install github.com/jstemmer/go-junit-report/v2@f50ae24655f6484f175ceb0672505dfec6565637 | |
go test -count=1 -v ./... ./adapters/azuread/... ./adapters/github/... ./adapters/google/... ./adapters/opsgenie/... ./adapters/slack/... ./adapters/terraformcloud/... 2>&1 | hack/bin/go-junit-report -iocopy -out report.xml -set-exit-code | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Test Results | |
path: | | |
report.xml | |
event_file: | |
name: "Event File" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Event File | |
path: ${{ github.event_path }} |