|
| 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 | + - run: git diff --exit-code |
| 25 | + |
| 26 | + build: |
| 27 | + name: Build |
| 28 | + runs-on: ubuntu-latest |
| 29 | + strategy: |
| 30 | + matrix: |
| 31 | + thread: [ 0, 1, 2, 3] |
| 32 | + steps: |
| 33 | + - uses: prometheus/promci/build@d9d4f5688814f0b77bf003d07fb8c00507390634 # v0.8.2 |
| 34 | + with: |
| 35 | + parallelism: 4 |
| 36 | + thread: ${{ matrix.thread }} |
| 37 | + |
| 38 | + integration: |
| 39 | + name: Integration test |
| 40 | + runs-on: ubuntu-latest |
| 41 | + needs: [test_go, build] |
| 42 | + container: |
| 43 | + # Whenever the Go version is updated here, .promu.yml |
| 44 | + # should also be updated. |
| 45 | + image: quay.io/prometheus/golang-builder:1.26-base |
| 46 | + services: |
| 47 | + node-exporter: |
| 48 | + image: quay.io/prometheus/node-exporter:latest |
| 49 | + env: |
| 50 | + NODE_EXPORTER_HOST: node-exporter |
| 51 | + PROMETHEUS_HOST: localhost |
| 52 | + PROM_VERSION: 3.12.0 |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 55 | + - uses: prometheus/promci-artifacts/restore@f9a587dbc0b2c78a0c54f8ad1cde71ea29a4b76f # v0.1.0 |
| 56 | + - run: cp -v .build/linux-amd64/pushprox-client ./ |
| 57 | + - run: cp -v .build/linux-amd64/pushprox-proxy ./ |
| 58 | + - run: curl -sSf -L https://github.com/prometheus/prometheus/releases/download/v${PROM_VERSION}/prometheus-${PROM_VERSION}.linux-amd64.tar.gz | tar xz |
| 59 | + - run: echo ${PATH} |
| 60 | + - run: cp -v prometheus-${PROM_VERSION}.linux-amd64/prometheus /bin/prometheus |
| 61 | + - run: ./end-to-end/test.sh |
| 62 | + |
| 63 | + publish_default: |
| 64 | + name: Publish default branch artifacts |
| 65 | + runs-on: ubuntu-latest |
| 66 | + permissions: |
| 67 | + packages: write |
| 68 | + needs: [test_go, build] |
| 69 | + if: | |
| 70 | + (github.event_name == 'push' && github.event.ref == 'refs/heads/main') |
| 71 | + || |
| 72 | + (github.event_name == 'push' && github.event.ref == 'refs/heads/master') |
| 73 | + steps: |
| 74 | + - uses: prometheus/promci/publish_main@d9d4f5688814f0b77bf003d07fb8c00507390634 # v0.8.2 |
| 75 | + with: |
| 76 | + docker_hub_organization: prometheuscommunity |
| 77 | + docker_hub_password: ${{ secrets.docker_hub_password }} |
| 78 | + ghcr_io_password: ${{ github.token }} |
| 79 | + quay_io_organization: prometheuscommunity |
| 80 | + quay_io_password: ${{ secrets.quay_io_password }} |
| 81 | + |
| 82 | + publish_release: |
| 83 | + name: Publish release artefacts |
| 84 | + permissions: |
| 85 | + contents: write |
| 86 | + packages: write |
| 87 | + runs-on: ubuntu-latest |
| 88 | + needs: [test_go, build] |
| 89 | + if: | |
| 90 | + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) |
| 91 | + steps: |
| 92 | + - uses: prometheus/promci/publish_release@d9d4f5688814f0b77bf003d07fb8c00507390634 # v0.8.2 |
| 93 | + with: |
| 94 | + docker_hub_organization: prometheuscommunity |
| 95 | + docker_hub_password: ${{ secrets.docker_hub_password }} |
| 96 | + ghcr_io_password: ${{ github.token }} |
| 97 | + quay_io_organization: prometheuscommunity |
| 98 | + quay_io_password: ${{ secrets.quay_io_password }} |
| 99 | + github_token: ${{ github.token }} |
0 commit comments