Skip to content

Commit b48e9e6

Browse files
authored
Merge pull request #796 from prometheus/superq/gh_ci
Migrate CI to GitHub Actions
2 parents dcd3fd1 + 9b4d100 commit b48e9e6

File tree

3 files changed

+126
-34
lines changed

3 files changed

+126
-34
lines changed

.circleci/config.yml

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,33 @@
11
---
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.
6+
27
version: 2.1
3-
orbs:
4-
prometheus: "prometheus/prometheus@0.17.1"
8+
59
executors:
6-
# Whenever the Go version is updated here, .promu.yml should also be updated.
710
golang:
811
docker:
9-
- image: cimg/go:1.25
12+
- image: busybox
13+
1014
jobs:
11-
test:
15+
noopjob:
1216
executor: golang
17+
1318
steps:
14-
- prometheus/setup_environment
15-
- run: make
16-
- prometheus/store_artifact:
17-
file: pushgateway
19+
- run:
20+
command: "true"
21+
1822
workflows:
1923
version: 2
2024
pushgateway:
2125
jobs:
22-
- test:
26+
- noopjob
27+
triggers:
28+
- schedule:
29+
cron: "0 0 30 2 *"
2330
filters:
24-
tags:
25-
only: /.*/
26-
- prometheus/build:
27-
name: build
28-
filters:
29-
tags:
30-
only: /.*/
31-
- prometheus/publish_master:
32-
context: org-context
33-
requires:
34-
- test
35-
- build
36-
filters:
37-
branches:
38-
only: master
39-
- prometheus/publish_release:
40-
context: org-context
41-
requires:
42-
- test
43-
- build
44-
filters:
45-
tags:
46-
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
4731
branches:
48-
ignore: /.*/
32+
only:
33+
- master

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "monthly"
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "monthly"

.github/workflows/ci.yml

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

0 commit comments

Comments
 (0)