Skip to content

Commit d613418

Browse files
authored
Update GitHub Actions to run all CI (#1231)
* Update GitHub Actions config to run tests Signed-off-by: Joe Adams <github@joeadams.io> * Add CI steps for release and include all postgres versions Signed-off-by: Joe Adams <github@joeadams.io> * Disable circleci jobs This will stop the CI jobs but leave existing PRs in place until we can get those updated. Signed-off-by: Joe Adams <github@joeadams.io> --------- Signed-off-by: Joe Adams <github@joeadams.io>
1 parent 7c167f7 commit d613418

File tree

3 files changed

+165
-89
lines changed

3 files changed

+165
-89
lines changed

.circleci/config.yml

Lines changed: 18 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,33 @@
11
---
2-
version: 2.1
2+
# Prometheus has switched to GitHub action.
3+
# Circle CI is not disabled repository-wise so that previous pull requests
4+
# continue working.
5+
# This file does not generate any CircleCI workflow.
36

4-
orbs:
5-
prometheus: prometheus/prometheus@0.17.1
7+
version: 2.1
68

79
executors:
8-
# This must match .promu.yml.
910
golang:
1011
docker:
11-
- image: cimg/go:1.25
12+
- image: busybox
1213

1314
jobs:
14-
test:
15+
noopjob:
1516
executor: golang
1617

1718
steps:
18-
- prometheus/setup_environment
19-
- run: GOHOSTARCH=386 GOARCH=386 make test
20-
- run: make
21-
- prometheus/store_artifact:
22-
file: postgres_exporter
23-
24-
integration:
25-
docker:
26-
- image: cimg/go:1.25
27-
- image: << parameters.postgres_image >>
28-
environment:
29-
POSTGRES_DB: circle_test
30-
POSTGRES_USER: postgres
31-
POSTGRES_PASSWORD: test
32-
33-
parameters:
34-
postgres_image:
35-
type: string
36-
37-
environment:
38-
DATA_SOURCE_NAME: 'postgresql://postgres:test@localhost:5432/circle_test?sslmode=disable'
39-
GOOPTS: '-v -tags integration'
40-
41-
steps:
42-
- checkout
43-
- setup_remote_docker
44-
- run: docker version
45-
- run: make build
46-
- run: make test
19+
- run:
20+
command: "true"
4721

4822
workflows:
4923
version: 2
50-
postgres_exporter:
24+
prometheus:
5125
jobs:
52-
- test:
53-
filters:
54-
tags:
55-
only: /.*/
56-
- integration:
57-
matrix:
58-
parameters:
59-
postgres_image:
60-
- cimg/postgres:13.22
61-
- cimg/postgres:14.19
62-
- cimg/postgres:15.14
63-
- cimg/postgres:16.10
64-
- cimg/postgres:17.6
65-
- prometheus/build:
66-
name: build
67-
parallelism: 3
68-
promu_opts: "-p linux/amd64 -p windows/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64 -p linux/386"
69-
filters:
70-
tags:
71-
ignore: /^v.*/
72-
branches:
73-
ignore: /^(main|master|release-.*|.*build-all.*)$/
74-
- prometheus/build:
75-
name: build_all
76-
parallelism: 12
77-
filters:
78-
branches:
79-
only: /^(main|master|release-.*|.*build-all.*)$/
80-
tags:
81-
only: /^v.*/
82-
- prometheus/publish_master:
83-
context: org-context
84-
docker_hub_organization: prometheuscommunity
85-
quay_io_organization: prometheuscommunity
86-
requires:
87-
- test
88-
- build_all
89-
filters:
90-
branches:
91-
only: master
92-
- prometheus/publish_release:
93-
context: org-context
94-
docker_hub_organization: prometheuscommunity
95-
quay_io_organization: prometheuscommunity
96-
requires:
97-
- test
98-
- build_all
99-
filters:
100-
tags:
101-
only: /^v.*/
102-
branches:
103-
ignore: /.*/
26+
- noopjob
27+
triggers:
28+
- schedule:
29+
cron: "0 0 30 2 *"
30+
filters:
31+
branches:
32+
only:
33+
- main

.github/workflows/ci.yml

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
---
2+
name: CI
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
test_go:
9+
name: Go tests
10+
runs-on: ubuntu-latest
11+
container:
12+
# Whenever the Go version is updated here, .promu.yml
13+
# should also be updated.
14+
image: quay.io/prometheus/golang-builder:1.25-base
15+
steps:
16+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
17+
- uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
18+
- uses: ./.github/promci/actions/setup_environment
19+
- run: make test
20+
- run: make GO_ONLY=1 SKIP_GOLANGCI_LINT=1
21+
integration_tests:
22+
name: Integration tests
23+
runs-on: ubuntu-latest
24+
strategy:
25+
matrix:
26+
# Define Postgres versions to test against.
27+
postgres_version:
28+
- 13.22
29+
- 14.19
30+
- 15.14
31+
- 16.10
32+
- 17.6
33+
services:
34+
postgres:
35+
image: postgres:${{ matrix.postgres_version }}
36+
env:
37+
POSTGRES_DB: circle_test
38+
POSTGRES_USER: postgres
39+
POSTGRES_PASSWORD: test
40+
# options: >-
41+
# --health-cmd="pg_isready -U postgres -d circle_test"
42+
# --health-interval=10s
43+
# --health-timeout=5s
44+
# --health-retries=5
45+
container:
46+
# Whenever the Go version is updated here, .promu.yml
47+
# should also be updated.
48+
image: quay.io/prometheus/golang-builder:1.25-base
49+
env:
50+
DATA_SOURCE_NAME: 'postgresql://postgres:test@postgres:5432/circle_test?sslmode=disable'
51+
GOOPTS: '-v -tags integration'
52+
steps:
53+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
54+
- uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
55+
- uses: ./.github/promci/actions/setup_environment
56+
- run: make build
57+
- run: make test
58+
59+
60+
build:
61+
name: Build Prometheus for common architectures
62+
runs-on: ubuntu-latest
63+
if: |
64+
!(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
65+
&&
66+
!(github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-'))
67+
&&
68+
!(github.event_name == 'push' && github.event.ref == 'refs/heads/main')
69+
&&
70+
!(github.event_name == 'push' && github.event.ref == 'refs/heads/master')
71+
strategy:
72+
matrix:
73+
thread: [ 0, 1, 2 ]
74+
steps:
75+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
76+
- uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
77+
- uses: ./.github/promci/actions/build
78+
with:
79+
promu_opts: "-p linux/amd64 -p windows/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64 -p linux/386"
80+
parallelism: 3
81+
thread: ${{ matrix.thread }}
82+
83+
build_all:
84+
name: Build Prometheus for all architectures
85+
runs-on: ubuntu-latest
86+
if: |
87+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
88+
||
89+
(github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-'))
90+
||
91+
(github.event_name == 'push' && github.event.ref == 'refs/heads/main')
92+
||
93+
(github.event_name == 'push' && github.event.ref == 'refs/heads/master')
94+
strategy:
95+
matrix:
96+
thread: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]
97+
98+
# Whenever the Go version is updated here, .promu.yml
99+
# should also be updated.
100+
steps:
101+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
102+
- uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
103+
- uses: ./.github/promci/actions/build
104+
with:
105+
parallelism: 12
106+
thread: ${{ matrix.thread }}
107+
108+
publish_main:
109+
# https://github.com/prometheus/promci/blob/52c7012f5f0070d7281b8db4a119e21341d43c91/actions/publish_main/action.yml
110+
name: Publish main branch artifacts
111+
runs-on: ubuntu-latest
112+
needs: [test_go, build_all]
113+
if: |
114+
(github.event_name == 'push' && github.event.ref == 'refs/heads/main')
115+
||
116+
(github.event_name == 'push' && github.event.ref == 'refs/heads/master')
117+
steps:
118+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
119+
- uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
120+
- uses: ./.github/promci/actions/publish_main
121+
with:
122+
docker_hub_organization: prometheuscommunity
123+
docker_hub_login: ${{ secrets.docker_hub_login }}
124+
docker_hub_password: ${{ secrets.docker_hub_password }}
125+
quay_io_organization: prometheuscommunity
126+
quay_io_login: ${{ secrets.quay_io_login }}
127+
quay_io_password: ${{ secrets.quay_io_password }}
128+
129+
publish_release:
130+
name: Publish release artefacts
131+
runs-on: ubuntu-latest
132+
needs: [test_go, build_all]
133+
if: |
134+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
135+
steps:
136+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
137+
- uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
138+
- uses: ./.github/promci/actions/publish_release
139+
with:
140+
docker_hub_organization: prometheuscommunity
141+
docker_hub_login: ${{ secrets.docker_hub_login }}
142+
docker_hub_password: ${{ secrets.docker_hub_password }}
143+
quay_io_organization: prometheuscommunity
144+
quay_io_login: ${{ secrets.quay_io_login }}
145+
quay_io_password: ${{ secrets.quay_io_password }}
146+
github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }}

queries.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Adding queries to this file is deprecated
2-
# Example queries have been transformed into collectors.
2+
# Example queries have been transformed into collectors.

0 commit comments

Comments
 (0)