|
| 1 | +--- |
| 2 | +name: CI |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: [main, master, 'release-*'] |
| 7 | + tags: ['v*'] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + test_go: |
| 14 | + name: Go tests |
| 15 | + runs-on: ubuntu-latest |
| 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 |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 22 | + - uses: prometheus/promci-setup@5af30ba8c199a91d6c04ebdc3c48e630e355f62d # v0.1.0 |
| 23 | + - run: make GO_ONLY=1 SKIP_GOLANGCI_LINT=1 |
| 24 | + |
| 25 | + build: |
| 26 | + name: Build |
| 27 | + runs-on: ubuntu-latest |
| 28 | + strategy: |
| 29 | + matrix: |
| 30 | + thread: [ 0, 1, 2, 3] |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 33 | + - uses: prometheus/promci/build@9c86752f3395e08c57719af549cc455d8e2c2514 # v0.7.0 |
| 34 | + with: |
| 35 | + parallelism: 4 |
| 36 | + thread: ${{ matrix.thread }} |
| 37 | + |
| 38 | + publish_main: |
| 39 | + name: Publish main branch artifacts |
| 40 | + runs-on: ubuntu-latest |
| 41 | + needs: [test_go, build] |
| 42 | + if: | |
| 43 | + (github.event_name == 'push' && github.event.ref == 'refs/heads/main') |
| 44 | + || |
| 45 | + (github.event_name == 'push' && github.event.ref == 'refs/heads/master') |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 48 | + - uses: prometheus/promci/publish_main@9c86752f3395e08c57719af549cc455d8e2c2514 # v0.7.0 |
| 49 | + with: |
| 50 | + docker_hub_organization: prometheuscommunity |
| 51 | + docker_hub_password: ${{ secrets.docker_hub_password }} |
| 52 | + quay_io_organization: prometheuscommunity |
| 53 | + quay_io_password: ${{ secrets.quay_io_password }} |
| 54 | + |
| 55 | + publish_release: |
| 56 | + name: Publish release artefacts |
| 57 | + runs-on: ubuntu-latest |
| 58 | + needs: [test_go, build] |
| 59 | + if: | |
| 60 | + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 63 | + - uses: prometheus/promci/publish_release@9c86752f3395e08c57719af549cc455d8e2c2514 # v0.7.0 |
| 64 | + with: |
| 65 | + docker_hub_organization: prometheuscommunity |
| 66 | + docker_hub_password: ${{ secrets.docker_hub_password }} |
| 67 | + quay_io_organization: prometheuscommunity |
| 68 | + quay_io_password: ${{ secrets.quay_io_password }} |
| 69 | + github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }} |
0 commit comments