Skip to content

Commit 51464df

Browse files
committed
Migrate CI to Actions
* Switch from CircleCI to GitHub Actions. * Enable dependabot for GitHub Actions. Signed-off-by: SuperQ <superq@gmail.com>
1 parent 4aa85f9 commit 51464df

File tree

3 files changed

+131
-40
lines changed

3 files changed

+131
-40
lines changed

.circleci/config.yml

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +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
7-
# also be updated.
810
golang:
911
docker:
10-
- image: cimg/go:1.25
12+
- image: busybox
13+
1114
jobs:
12-
test:
15+
noopjob:
1316
executor: golang
17+
1418
steps:
15-
- prometheus/setup_environment
16-
- run: make
17-
- prometheus/store_artifact:
18-
file: ipmi_exporter
19+
- run:
20+
command: "true"
21+
1922
workflows:
2023
version: 2
21-
ipmi_exporter:
24+
prometheus:
2225
jobs:
23-
- test:
26+
- noopjob
27+
triggers:
28+
- schedule:
29+
cron: "0 0 30 2 *"
2430
filters:
25-
tags:
26-
only: /.*/
27-
- prometheus/build:
28-
name: build
29-
filters:
30-
tags:
31-
only: /.*/
32-
- prometheus/publish_master:
33-
context: org-context
34-
docker_hub_organization: prometheuscommunity
35-
quay_io_organization: prometheuscommunity
36-
requires:
37-
- test
38-
- build
39-
filters:
40-
branches:
41-
only: master
42-
- prometheus/publish_release:
43-
context: org-context
44-
docker_hub_organization: prometheuscommunity
45-
quay_io_organization: prometheuscommunity
46-
requires:
47-
- test
48-
- build
49-
filters:
50-
tags:
51-
only: /^v.*/
5231
branches:
53-
ignore: /.*/
32+
only:
33+
- main

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

0 commit comments

Comments
 (0)