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