dlc.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. name: Dependency License Checks
  2. on:
  3. push:
  4. branches:
  5. - main
  6. - release-*
  7. paths:
  8. - "go.mod"
  9. pull_request:
  10. paths:
  11. - "go.mod"
  12. workflow_dispatch: {}
  13. env:
  14. # Common versions
  15. GO_VERSION: '1.17'
  16. GOLANGCI_VERSION: 'v1.42.1'
  17. KUBERNETES_VERSION: '1.23.x'
  18. DOCKER_BUILDX_VERSION: 'v0.4.2'
  19. # Common users. We can't run a step 'if secrets.GHCR_USERNAME != ""' but we can run
  20. # a step 'if env.GHCR_USERNAME' != ""', so we copy these to succinctly test whether
  21. # credentials have been provided before trying to run steps that need them.
  22. GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
  23. # Sonar
  24. SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
  25. jobs:
  26. license-check:
  27. runs-on: ubuntu-18.04
  28. steps:
  29. - name: Checkout
  30. uses: actions/checkout@v3
  31. - name: Setup Go
  32. uses: actions/setup-go@v3
  33. with:
  34. go-version: ${{ env.GO_VERSION }}
  35. - name: Find the Go Cache
  36. id: go
  37. run: |
  38. echo "::set-output name=build-cache::$(go env GOCACHE)"
  39. echo "::set-output name=mod-cache::$(go env GOMODCACHE)"
  40. - name: Cache the Go Build Cache
  41. uses: actions/cache@v3
  42. with:
  43. path: ${{ steps.go.outputs.build-cache }}
  44. key: ${{ runner.os }}-build-check-diff-${{ hashFiles('**/go.sum') }}
  45. restore-keys: ${{ runner.os }}-build-check-diff-
  46. - name: Cache Go Dependencies
  47. uses: actions/cache@v3
  48. with:
  49. path: ${{ steps.go.outputs.mod-cache }}
  50. key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
  51. restore-keys: ${{ runner.os }}-pkg-
  52. - name: License Checks
  53. run: |
  54. go install github.com/google/go-licenses@latest
  55. make license.check