Skip to content

Commit fbce5ef

Browse files
authored
Merge pull request #243 from prometheus-community/superq/gh_actions
Migrate CI to GitHub Actions
2 parents 4cc849e + d17ca18 commit fbce5ef

File tree

2 files changed

+124
-52
lines changed

2 files changed

+124
-52
lines changed

.circleci/config.yml

Lines changed: 16 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +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: make
20-
- prometheus/store_artifact:
21-
file: pgbouncer_exporter
19+
- run:
20+
command: "true"
2221

2322
workflows:
2423
version: 2
25-
pgbouncer_exporter:
24+
prometheus:
2625
jobs:
27-
- test:
28-
filters:
29-
tags:
30-
only: /.*/
31-
- prometheus/build:
32-
name: build
33-
parallelism: 3
34-
promu_opts: "-p linux/amd64 -p windows/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64 -p linux/386"
35-
filters:
36-
tags:
37-
ignore: /^v.*/
38-
branches:
39-
ignore: /^(main|master|release-.*|.*build-all.*)$/
40-
- prometheus/build:
41-
name: build_all
42-
parallelism: 12
43-
filters:
44-
branches:
45-
only: /^(main|master|release-.*|.*build-all.*)$/
46-
tags:
47-
only: /^v.*/
48-
- prometheus/publish_master:
49-
context: org-context
50-
docker_hub_organization: prometheuscommunity
51-
quay_io_organization: prometheuscommunity
52-
requires:
53-
- test
54-
- build_all
55-
filters:
56-
branches:
57-
only: master
58-
- prometheus/publish_release:
59-
context: org-context
60-
docker_hub_organization: prometheuscommunity
61-
quay_io_organization: prometheuscommunity
62-
requires:
63-
- test
64-
- build_all
26+
- noopjob
27+
triggers:
28+
- schedule:
29+
cron: "0 0 30 2 *"
6530
filters:
66-
tags:
67-
only: /^v.*/
6831
branches:
69-
ignore: /.*/
32+
only:
33+
- main

.github/workflows/ci.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
name: CI
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master, 'release-*']
7+
8+
jobs:
9+
test_go:
10+
name: Go tests
11+
runs-on: ubuntu-latest
12+
container:
13+
# Whenever the Go version is updated here, .promu.yml
14+
# should also be updated.
15+
image: quay.io/prometheus/golang-builder:1.25-base
16+
steps:
17+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
18+
- uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
19+
- uses: ./.github/promci/actions/setup_environment
20+
- run: make
21+
22+
build:
23+
name: Build Prometheus for common architectures
24+
runs-on: ubuntu-latest
25+
if: |
26+
!(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
27+
&&
28+
!(github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-'))
29+
&&
30+
!(github.event_name == 'push' && github.event.ref == 'refs/heads/main')
31+
&&
32+
!(github.event_name == 'push' && github.event.ref == 'refs/heads/master')
33+
strategy:
34+
matrix:
35+
thread: [ 0, 1, 2 ]
36+
steps:
37+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
38+
- uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
39+
- uses: ./.github/promci/actions/build
40+
with:
41+
promu_opts: "-p linux/amd64 -p windows/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64 -p linux/386"
42+
parallelism: 3
43+
thread: ${{ matrix.thread }}
44+
45+
build_all:
46+
name: Build Prometheus for all architectures
47+
runs-on: ubuntu-latest
48+
if: |
49+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
50+
||
51+
(github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-'))
52+
||
53+
(github.event_name == 'push' && github.event.ref == 'refs/heads/main')
54+
||
55+
(github.event_name == 'push' && github.event.ref == 'refs/heads/master')
56+
strategy:
57+
matrix:
58+
thread: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]
59+
60+
# Whenever the Go version is updated here, .promu.yml
61+
# should also be updated.
62+
steps:
63+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
64+
- uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
65+
- uses: ./.github/promci/actions/build
66+
with:
67+
parallelism: 12
68+
thread: ${{ matrix.thread }}
69+
70+
publish_main:
71+
# https://github.com/prometheus/promci/blob/52c7012f5f0070d7281b8db4a119e21341d43c91/actions/publish_main/action.yml
72+
name: Publish main branch artifacts
73+
runs-on: ubuntu-latest
74+
needs: [test_go, build_all]
75+
if: |
76+
(github.event_name == 'push' && github.event.ref == 'refs/heads/main')
77+
||
78+
(github.event_name == 'push' && github.event.ref == 'refs/heads/master')
79+
steps:
80+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
81+
- uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
82+
- uses: ./.github/promci/actions/publish_main
83+
with:
84+
docker_hub_organization: prometheuscommunity
85+
docker_hub_login: ${{ secrets.docker_hub_login }}
86+
docker_hub_password: ${{ secrets.docker_hub_password }}
87+
quay_io_organization: prometheuscommunity
88+
quay_io_login: ${{ secrets.quay_io_login }}
89+
quay_io_password: ${{ secrets.quay_io_password }}
90+
91+
publish_release:
92+
name: Publish release artefacts
93+
runs-on: ubuntu-latest
94+
needs: [test_go, build_all]
95+
if: |
96+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
97+
steps:
98+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
99+
- uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7
100+
- uses: ./.github/promci/actions/publish_release
101+
with:
102+
docker_hub_organization: prometheuscommunity
103+
docker_hub_login: ${{ secrets.docker_hub_login }}
104+
docker_hub_password: ${{ secrets.docker_hub_password }}
105+
quay_io_organization: prometheuscommunity
106+
quay_io_login: ${{ secrets.quay_io_login }}
107+
quay_io_password: ${{ secrets.quay_io_password }}
108+
github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }}

0 commit comments

Comments
 (0)