Skip to content

Commit ef0466b

Browse files
committed
Migrate to GitHub Actions
Migrate CI to GitHub Actions. * Enable dependabot for GitHub Actions. Signed-off-by: SuperQ <superq@gmail.com>
1 parent 2082f04 commit ef0466b

File tree

3 files changed

+148
-87
lines changed

3 files changed

+148
-87
lines changed

.circleci/config.yml

Lines changed: 19 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +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
7-
# should also be updated.
810
golang:
911
docker:
10-
- image: cimg/go:1.26
12+
- image: busybox
13+
1114
jobs:
12-
test:
15+
noopjob:
1316
executor: golang
17+
1418
steps:
15-
- prometheus/setup_environment
16-
- run: make check_license style staticcheck unused build test-short
17-
- prometheus/store_artifact:
18-
file: mysqld_exporter
19-
integration:
20-
docker:
21-
- image: cimg/go:1.26
22-
- image: << parameters.mysql_image >>
23-
environment:
24-
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
25-
MYSQL_ROOT_HOST: '%'
26-
parameters:
27-
mysql_image:
28-
type: string
29-
steps:
30-
- checkout
31-
- setup_remote_docker
32-
- run: docker version
33-
- run: docker-compose --version
34-
- run: make build
35-
- run: make test
36-
mixin:
37-
executor: golang
38-
steps:
39-
- checkout
40-
- run: go install github.com/monitoring-mixins/mixtool/cmd/mixtool@latest
41-
- run: go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest
42-
- run: make -C mysqld-mixin lint build
19+
- run:
20+
command: "true"
21+
4322
workflows:
4423
version: 2
4524
mysqld_exporter:
4625
jobs:
47-
- test:
48-
filters:
49-
tags:
50-
only: /.*/
51-
- integration:
52-
matrix:
53-
parameters:
54-
mysql_image:
55-
- percona:5.6
56-
- mysql:5.7.33
57-
- mysql:8.0
58-
- mysql:8.4
59-
- mariadb:10.5
60-
- mariadb:10.6
61-
- mariadb:10.11
62-
- mariadb:11.4
63-
- prometheus/build:
64-
name: build
65-
parallelism: 3
66-
promu_opts: "-p linux/amd64 -p windows/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64 -p linux/386"
67-
filters:
68-
tags:
69-
ignore: /^v.*/
70-
branches:
71-
ignore: /^(main|release-.*|.*build-all.*)$/
72-
- prometheus/build:
73-
name: build_all
74-
parallelism: 12
75-
filters:
76-
branches:
77-
only: /^(main|release-.*|.*build-all.*)$/
78-
tags:
79-
only: /^v.*/
80-
- mixin:
81-
filters:
82-
tags:
83-
only: /.*/
84-
- prometheus/publish_main:
85-
context: org-context
86-
requires:
87-
- test
88-
- build_all
89-
filters:
90-
branches:
91-
only: main
92-
- prometheus/publish_release:
93-
context: org-context
94-
requires:
95-
- test
96-
- build_all
26+
- noopjob
27+
triggers:
28+
- schedule:
29+
cron: "0 0 30 2 *"
9730
filters:
98-
tags:
99-
only: /^v.*/
10031
branches:
101-
ignore: /.*/
32+
only:
33+
- main

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "monthly"
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "monthly"
11+
# Exclude configs synced from upstream prometheus/prometheus.
12+
exclude-paths:
13+
- .github/workflows/container_description.yml
14+
- .github/workflows/golangci-lint.yml

.github/workflows/ci.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
name: CI
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main, 'release-*']
7+
tags: ['v*']
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test_go:
14+
name: Go tests
15+
runs-on: ubuntu-latest
16+
container:
17+
# Whenever the Go version is updated here, .promu.yml
18+
# should also be updated.
19+
image: quay.io/prometheus/golang-builder:1.26-base
20+
steps:
21+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
22+
with:
23+
persist-credentials: false
24+
- uses: prometheus/promci-setup@5af30ba8c199a91d6c04ebdc3c48e630e355f62d # v0.1.0
25+
- run: make
26+
- run: git diff --exit-code
27+
28+
mixins:
29+
name: Test mixins
30+
runs-on: ubuntu-latest
31+
container:
32+
# Whenever the Go version is updated here, .promu.yml
33+
# should also be updated.
34+
image: quay.io/prometheus/golang-builder:1.26-base
35+
steps:
36+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
37+
with:
38+
persist-credentials: false
39+
- run: go install github.com/monitoring-mixins/mixtool/cmd/mixtool@latest
40+
- run: go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest
41+
- run: make -C mysqld-mixin lint build
42+
43+
integration:
44+
name: Integration tests
45+
runs-on: ubuntu-latest
46+
container:
47+
# Whenever the Go version is updated here, .promu.yml
48+
# should also be updated.
49+
image: quay.io/prometheus/golang-builder:1.26-base
50+
services:
51+
mysqld:
52+
image: ${{ matrix.mysql_image }}
53+
env:
54+
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
55+
MYSQL_ROOT_HOST: '%'
56+
strategy:
57+
matrix:
58+
mysql_image:
59+
- percona:5.6
60+
- mysql:5.7.33
61+
- mysql:8.0
62+
- mysql:8.4
63+
- mariadb:10.5
64+
- mariadb:10.6
65+
- mariadb:10.11
66+
- mariadb:11.4
67+
steps:
68+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
69+
with:
70+
persist-credentials: false
71+
- run: make build
72+
- run: make test
73+
- run: git diff --exit-code
74+
75+
build:
76+
name: Build mysqld_exporter for all architectures
77+
runs-on: ubuntu-latest
78+
strategy:
79+
matrix:
80+
thread: [ 0, 1, 2, 3]
81+
steps:
82+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
83+
with:
84+
persist-credentials: false
85+
- uses: prometheus/promci/build@769ee18070cd21cfc2a24fa912349fd3e48dee58 # v0.6.0
86+
with:
87+
parallelism: 4
88+
thread: ${{ matrix.thread }}
89+
90+
publish_main:
91+
name: Publish main branch artifacts
92+
runs-on: ubuntu-latest
93+
needs: [test_go, build]
94+
if: (github.event_name == 'push' && github.event.ref == 'refs/heads/main')
95+
steps:
96+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
97+
with:
98+
persist-credentials: false
99+
- uses: prometheus/promci/publish_main@42c3c84c865e5c1ab78543b929f7341eb2ef6123 # v0.6.1
100+
with:
101+
docker_hub_login: ${{ secrets.docker_hub_login }}
102+
docker_hub_password: ${{ secrets.docker_hub_password }}
103+
quay_io_login: ${{ secrets.quay_io_login }}
104+
quay_io_password: ${{ secrets.quay_io_password }}
105+
106+
publish_release:
107+
name: Publish release artifacts
108+
runs-on: ubuntu-latest
109+
needs: [test_go, build]
110+
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
111+
steps:
112+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
113+
with:
114+
persist-credentials: false
115+
- uses: prometheus/promci/publish_release@42c3c84c865e5c1ab78543b929f7341eb2ef6123 # v0.6.1
116+
with:
117+
docker_hub_login: ${{ secrets.docker_hub_login }}
118+
docker_hub_password: ${{ secrets.docker_hub_password }}
119+
quay_io_login: ${{ secrets.quay_io_login }}
120+
quay_io_password: ${{ secrets.quay_io_password }}
121+
github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }}

0 commit comments

Comments
 (0)