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