|
| 1 | +name: Build Test |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + pull_request: null |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + pull-requests: read |
| 11 | + actions: read |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: ci-${{ github.event.pull_request.number || github.ref_name }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + changes: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + outputs: |
| 21 | + paths: ${{ steps.filter.outputs.changes }} |
| 22 | + steps: |
| 23 | + |
| 24 | + with: |
| 25 | + ref: ${{ github.event.pull_request.head.sha }} |
| 26 | + - name: Harden Runner |
| 27 | + uses: step-security/harden-runner@v2 |
| 28 | + with: |
| 29 | + disable-sudo: true |
| 30 | + egress-policy: block |
| 31 | + allowed-endpoints: > |
| 32 | + api.github.com:443 |
| 33 | + github.com:443 |
| 34 | + - uses: dorny/paths-filter@v3 |
| 35 | + id: filter |
| 36 | + with: |
| 37 | + base: ${{ github.ref }} |
| 38 | + filters: .github/filters.yml |
| 39 | + |
| 40 | + build-test: |
| 41 | + runs-on: ubuntu-latest |
| 42 | + needs: changes |
| 43 | + if: ${{ contains(fromJSON(needs.changes.outputs.paths), 'src') }} |
| 44 | + steps: |
| 45 | + - name: Harden Runner |
| 46 | + uses: step-security/harden-runner@v2 |
| 47 | + with: |
| 48 | + disable-sudo: true |
| 49 | + egress-policy: block |
| 50 | + allowed-endpoints: > |
| 51 | + api.github.com:443 |
| 52 | + github.com:443 |
| 53 | + golang.org:443 |
| 54 | + proxy.golang.org:443 |
| 55 | + sum.golang.org:443 |
| 56 | + objects.githubusercontent.com:443 |
| 57 | + storage.googleapis.com:443 |
| 58 | + cli.codecov.io:443 |
| 59 | + api.codecov.io:443 |
| 60 | + ingest.codecov.io:443 |
| 61 | + raw.githubusercontent.com:443 |
| 62 | + get.helm.sh:443 |
| 63 | + golangci-lint.run:443 |
| 64 | +
|
| 65 | + |
| 66 | + with: |
| 67 | + fetch-depth: 0 |
| 68 | + - uses: actions/setup-go@v5 |
| 69 | + with: |
| 70 | + go-version-file: go.mod |
| 71 | + check-latest: true |
| 72 | + |
| 73 | + - name: Vet |
| 74 | + run: make vet |
| 75 | + |
| 76 | + - name: lint |
| 77 | + uses: golangci/golangci-lint-action@v6 |
| 78 | + with: |
| 79 | + version: v1.64.5 |
| 80 | + |
| 81 | + - name: Helm Lint |
| 82 | + run: make helm-lint |
| 83 | + |
| 84 | + - name: Test |
| 85 | + run: make test |
| 86 | + |
| 87 | + - name: Build |
| 88 | + run: make build |
| 89 | + |
| 90 | + docker-build: |
| 91 | + runs-on: ubuntu-latest |
| 92 | + steps: |
| 93 | + |
| 94 | + with: |
| 95 | + fetch-depth: 0 |
| 96 | + - name: Docker Meta |
| 97 | + id: meta |
| 98 | + uses: docker/metadata-action@v5 |
| 99 | + with: |
| 100 | + images: | |
| 101 | + linode/linode-cloud-controller-manager |
| 102 | + tags: | |
| 103 | + type=raw,value=pr-${{ github.event.pull_request.number }},enable=${{ github.event_name == 'pull_request' }} |
| 104 | + type=raw,value=latest,enable=${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} |
| 105 | + - name: Build Dockerfile |
| 106 | + uses: docker/build-push-action@v6 |
| 107 | + with: |
| 108 | + context: . |
| 109 | + push: false |
| 110 | + tags: ${{ steps.meta.outputs.tags }} |
| 111 | + labels: ${{ steps.meta.outputs.labels }} |
| 112 | + build-args: | |
| 113 | + REV=${{ github.ref_name }} |
0 commit comments