|
| 1 | +--- |
1 | 2 | name: CI |
2 | | - |
3 | 3 | on: |
4 | 4 | pull_request: |
5 | 5 | push: |
6 | | - branches: [main, 'release-*'] |
| 6 | + branches: [main, master, 'release-*'] |
7 | 7 | tags: ['v*'] |
8 | 8 |
|
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
9 | 12 | jobs: |
10 | | - build: |
11 | | - name: Build for common architectures |
| 13 | + test_go: |
| 14 | + name: Go tests |
12 | 15 | runs-on: ubuntu-latest |
13 | | - if: | |
14 | | - !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) |
15 | | - && |
16 | | - !(github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-')) |
17 | | - && |
18 | | - !(github.event_name == 'push' && github.event.ref == 'refs/heads/main') |
19 | | - strategy: |
20 | | - matrix: |
21 | | - thread: [ 0, 1, 2 ] |
| 16 | + container: |
| 17 | + # Whenever the Go version is updated here, .promu.yml |
| 18 | + # should also be updated. |
| 19 | + image: quay.io/prometheus/golang-builder:1.26-base |
22 | 20 | steps: |
23 | 21 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
24 | | - - uses: prometheus/promci@42c3c84c865e5c1ab78543b929f7341eb2ef6123 # v0.6.1 |
25 | | - - uses: ./.github/promci/actions/build |
26 | | - with: |
27 | | - promu_opts: "-p linux/amd64 -p windows/amd64 -p darwin/amd64 -p linux/arm64 -p windows/arm64 -p darwin/arm64" |
28 | | - parallelism: 3 |
29 | | - thread: ${{ matrix.thread }} |
| 22 | + - uses: prometheus/promci-setup@5af30ba8c199a91d6c04ebdc3c48e630e355f62d # v0.1.0 |
| 23 | + - run: make GO_ONLY=1 SKIP_GOLANGCI_LINT=1 |
30 | 24 |
|
31 | | - build_all: |
32 | | - name: Build for all architectures |
| 25 | + build: |
| 26 | + name: Build |
33 | 27 | runs-on: ubuntu-latest |
34 | | - if: | |
35 | | - (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) |
36 | | - || |
37 | | - (github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-')) |
38 | | - || |
39 | | - (github.event_name == 'push' && github.event.ref == 'refs/heads/main') |
40 | 28 | strategy: |
41 | 29 | matrix: |
42 | | - thread: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ] |
| 30 | + thread: [ 0, 1, 2, 3] |
43 | 31 | steps: |
44 | 32 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
45 | | - - uses: prometheus/promci@42c3c84c865e5c1ab78543b929f7341eb2ef6123 # v0.6.1 |
46 | | - - uses: ./.github/promci/actions/build |
| 33 | + - uses: prometheus/promci/build@9c86752f3395e08c57719af549cc455d8e2c2514 # v0.7.0 |
47 | 34 | with: |
48 | | - parallelism: 12 |
| 35 | + parallelism: 4 |
49 | 36 | thread: ${{ matrix.thread }} |
50 | 37 |
|
51 | | - verify-example-configs: |
52 | | - name: Verify |
53 | | - runs-on: ubuntu-latest |
54 | | - container: |
55 | | - image: quay.io/prometheus/golang-builder:1.26-base |
56 | | - steps: |
57 | | - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
58 | | - - run: make build |
59 | | - - name: Verify example configs |
60 | | - run: find ./examples -name "*.yml" -print0 | xargs -0 -I % ./yace verify-config -config.file % |
61 | | - |
62 | 38 | publish_main: |
63 | 39 | name: Publish main branch artifacts |
64 | 40 | runs-on: ubuntu-latest |
65 | | - needs: [build_all, verify-example-configs] |
| 41 | + needs: [test_go, build] |
66 | 42 | if: | |
67 | | - (github.repository == 'prometheus-community/fortigate_exporter') |
68 | | - && |
69 | 43 | (github.event_name == 'push' && github.event.ref == 'refs/heads/main') |
| 44 | + || |
| 45 | + (github.event_name == 'push' && github.event.ref == 'refs/heads/master') |
70 | 46 | steps: |
71 | 47 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
72 | | - - uses: prometheus/promci@42c3c84c865e5c1ab78543b929f7341eb2ef6123 # v0.6.1 |
73 | | - - uses: ./.github/promci/actions/publish_main |
| 48 | + - uses: prometheus/promci/publish_main@9c86752f3395e08c57719af549cc455d8e2c2514 # v0.7.0 |
74 | 49 | with: |
75 | 50 | docker_hub_organization: prometheuscommunity |
76 | | - docker_hub_login: ${{ secrets.docker_hub_login }} |
77 | 51 | docker_hub_password: ${{ secrets.docker_hub_password }} |
78 | 52 | quay_io_organization: prometheuscommunity |
79 | | - quay_io_login: ${{ secrets.quay_io_login }} |
80 | 53 | quay_io_password: ${{ secrets.quay_io_password }} |
81 | 54 |
|
82 | 55 | publish_release: |
83 | | - name: Publish release artifacts |
| 56 | + name: Publish release artefacts |
84 | 57 | runs-on: ubuntu-latest |
85 | | - needs: [build_all, verify-example-configs] |
| 58 | + needs: [test_go, build] |
86 | 59 | if: | |
87 | | - (github.repository == 'prometheus-community/fortigate_exporter') |
88 | | - && |
89 | 60 | (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) |
90 | 61 | steps: |
91 | 62 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
92 | | - - uses: prometheus/promci@42c3c84c865e5c1ab78543b929f7341eb2ef6123 # v0.6.1 |
93 | | - - uses: ./.github/promci/actions/publish_release |
| 63 | + - uses: prometheus/promci/publish_release@9c86752f3395e08c57719af549cc455d8e2c2514 # v0.7.0 |
94 | 64 | with: |
95 | 65 | docker_hub_organization: prometheuscommunity |
96 | | - docker_hub_login: ${{ secrets.docker_hub_login }} |
97 | 66 | docker_hub_password: ${{ secrets.docker_hub_password }} |
98 | 67 | quay_io_organization: prometheuscommunity |
99 | | - quay_io_login: ${{ secrets.quay_io_login }} |
100 | 68 | quay_io_password: ${{ secrets.quay_io_password }} |
101 | 69 | github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }} |
0 commit comments