|
6 | 6 | - master |
7 | 7 | pull_request: |
8 | 8 | jobs: |
| 9 | + build-tools: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + name: Build Go Tools |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 14 | + with: |
| 15 | + persist-credentials: false |
| 16 | + - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 |
| 17 | + with: |
| 18 | + go-version-file: scripts/go.mod |
| 19 | + cache-dependency-path: scripts/go.sum |
| 20 | + - name: Build Go tools |
| 21 | + run: | |
| 22 | + mkdir -p tmp/bin |
| 23 | + cd scripts && go list -e -mod=mod -tags tools -f '{{ range .Imports }}{{ printf "%s\n" .}}{{end}}' ./ | xargs -tI % go build -mod=mod -o ../tmp/bin % |
| 24 | + - name: Upload built tools |
| 25 | + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 |
| 26 | + with: |
| 27 | + name: go-tools |
| 28 | + path: tmp/bin/ |
| 29 | + retention-days: 1 |
| 30 | + if-no-files-found: error |
| 31 | + |
9 | 32 | matrix: |
10 | 33 | runs-on: ubuntu-latest |
11 | 34 | name: ${{ matrix.name }} |
| 35 | + needs: build-tools |
12 | 36 | strategy: |
13 | 37 | fail-fast: false |
14 | 38 | matrix: |
15 | 39 | include: |
16 | 40 | - name: Lint Alerts |
17 | | - run: make --always-make alerts-lint |
| 41 | + run: make alerts-lint |
18 | 42 | - name: Generate YAML |
19 | | - run: make --always-make generate && git diff --exit-code |
| 43 | + run: make generate && git diff --exit-code |
20 | 44 | - name: Lint Grafana Dashboards |
21 | | - run: make --always-make dashboards-lint |
| 45 | + run: make dashboards-lint |
22 | 46 | - name: Format JSONNET |
23 | | - run: make --always-make jsonnet-fmt && git diff --exit-code |
| 47 | + run: make jsonnet-fmt && git diff --exit-code |
24 | 48 | - name: Lint JSONNET |
25 | | - run: make --always-make jsonnet-lint |
| 49 | + run: make jsonnet-lint |
26 | 50 | - name: Format MD |
27 | | - run: make --always-make markdownfmt && git diff --exit-code |
| 51 | + run: make markdownfmt && git diff --exit-code |
28 | 52 | - name: Lint MD |
29 | | - run: make --always-make vale && git diff --exit-code |
| 53 | + run: make vale && git diff --exit-code |
30 | 54 | - name: Lint YAML |
31 | | - run: make --always-make pint-lint |
| 55 | + run: make pint-lint |
32 | 56 | - name: Run unit tests |
33 | | - run: make --always-make test |
| 57 | + run: make test |
34 | 58 |
|
35 | 59 | steps: |
36 | 60 | - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
37 | 61 | with: |
38 | 62 | persist-credentials: false |
39 | | - - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 |
| 63 | + - name: Download built tools |
| 64 | + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 |
40 | 65 | with: |
41 | | - go-version-file: scripts/go.mod |
42 | | - cache-dependency-path: scripts/go.sum |
| 66 | + name: go-tools |
| 67 | + path: tmp/bin/ |
| 68 | + - name: Make tools executable and update timestamps |
| 69 | + run: | |
| 70 | + chmod +x tmp/bin/* |
| 71 | + touch tmp/bin/* |
43 | 72 | - run: ${{ matrix.run }} |
0 commit comments