File: ci.yml

package info (click to toggle)
prometheus-postgres-exporter 0.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 996 kB
  • sloc: sh: 374; makefile: 54
file content (147 lines) | stat: -rw-r--r-- 5,556 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
---
name: CI
on:
  pull_request:
  push:

jobs:
  test_go:
    name: Go tests
    runs-on: ubuntu-latest
    container:
      # Whenever the Go version is updated here, .promu.yml
      # should also be updated.
      image: quay.io/prometheus/golang-builder:1.25-base
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
      - uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
      - uses: ./.github/promci/actions/setup_environment
      - run: make test
      - run: make GO_ONLY=1 SKIP_GOLANGCI_LINT=1
  integration_tests:
    name: Integration tests
    runs-on: ubuntu-latest
    strategy:
      matrix:
        # Define Postgres versions to test against.
        postgres_version:
          - 13.22
          - 14.19
          - 15.14
          - 16.10
          - 17.6
          - 18.1
    services:
      postgres:
        image: postgres:${{ matrix.postgres_version }}
        env:
          POSTGRES_DB: circle_test
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: test
        # options: >-
        #   --health-cmd="pg_isready -U postgres -d circle_test"
        #   --health-interval=10s
        #   --health-timeout=5s
        #   --health-retries=5
    container:
      # Whenever the Go version is updated here, .promu.yml
      # should also be updated.
      image: quay.io/prometheus/golang-builder:1.25-base
    env:
      DATA_SOURCE_NAME: 'postgresql://postgres:test@postgres:5432/circle_test?sslmode=disable'
      GOOPTS: '-v -tags integration'
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
      - uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
      - uses: ./.github/promci/actions/setup_environment
      - run: make build
      - run: make test


  build:
    name: Build Prometheus for common architectures
    runs-on: ubuntu-latest
    if: |
      !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
      &&
      !(github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-'))
      &&
      !(github.event_name == 'push' && github.event.ref == 'refs/heads/main')
      &&
      !(github.event_name == 'push' && github.event.ref == 'refs/heads/master')
    strategy:
      matrix:
        thread: [ 0, 1, 2 ]
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
      - uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
      - uses: ./.github/promci/actions/build
        with:
          promu_opts: "-p linux/amd64 -p windows/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64 -p linux/386"
          parallelism: 3
          thread: ${{ matrix.thread }}

  build_all:
    name: Build Prometheus for all architectures
    runs-on: ubuntu-latest
    if: |
      (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
      ||
      (github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-'))
      ||
      (github.event_name == 'push' && github.event.ref == 'refs/heads/main')
      ||
      (github.event_name == 'push' && github.event.ref == 'refs/heads/master')
    strategy:
      matrix:
        thread: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]

    # Whenever the Go version is updated here, .promu.yml
    # should also be updated.
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
      - uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
      - uses: ./.github/promci/actions/build
        with:
          parallelism: 12
          thread: ${{ matrix.thread }}

  publish_main:
    # https://github.com/prometheus/promci/blob/52c7012f5f0070d7281b8db4a119e21341d43c91/actions/publish_main/action.yml
    name: Publish main branch artifacts
    runs-on: ubuntu-latest
    needs: [test_go, build_all]
    if: |
      (github.event_name == 'push' && github.event.ref == 'refs/heads/main')
      ||
      (github.event_name == 'push' && github.event.ref == 'refs/heads/master')
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
      - uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
      - uses: ./.github/promci/actions/publish_main
        with:
          docker_hub_organization: prometheuscommunity
          docker_hub_login: ${{ secrets.docker_hub_login }}
          docker_hub_password: ${{ secrets.docker_hub_password }}
          quay_io_organization: prometheuscommunity
          quay_io_login: ${{ secrets.quay_io_login }}
          quay_io_password: ${{ secrets.quay_io_password }}

  publish_release:
    name: Publish release artefacts
    runs-on: ubuntu-latest
    needs: [test_go, build_all]
    if: |
      (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
    steps:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
      - uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
      - uses: ./.github/promci/actions/publish_release
        with:
          docker_hub_organization: prometheuscommunity
          docker_hub_login: ${{ secrets.docker_hub_login }}
          docker_hub_password: ${{ secrets.docker_hub_password }}
          quay_io_organization: prometheuscommunity
          quay_io_login: ${{ secrets.quay_io_login }}
          quay_io_password: ${{ secrets.quay_io_password }}
          github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }}