Skip to content

Commit 4ffee15

Browse files
authored
chore: switch to github action (prometheus#3602)
Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
1 parent f5f9e14 commit 4ffee15

3 files changed

Lines changed: 150 additions & 113 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -17,81 +17,8 @@ jobs:
1717
test:
1818
executor: golang
1919
steps:
20-
- prometheus/setup_environment
21-
- run: go mod download
22-
- run: make
23-
- prometheus/store_artifact:
24-
file: node_exporter
25-
test-arm:
26-
executor: arm
27-
steps:
28-
- prometheus/setup_environment
29-
- run: uname -a
30-
- run: make test-e2e
31-
test_mixins:
32-
executor: golang
33-
steps:
34-
- checkout
35-
- run: go install github.com/google/go-jsonnet/cmd/jsonnet@latest
36-
- run: go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest
37-
- run: go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
38-
- run: make promtool
39-
- run: make -C docs/node-mixin clean
40-
- run: make -C docs/node-mixin jb_install
41-
- run: make -C docs/node-mixin
42-
- run: git diff --exit-code
43-
build:
44-
machine:
45-
image: ubuntu-2404:current
46-
parallelism: 3
47-
steps:
48-
- prometheus/setup_environment
49-
- run: docker run --privileged linuxkit/binfmt:af88a591f9cc896a52ce596b9cf7ca26a061ef97
50-
- run: promu crossbuild -v --parallelism $CIRCLE_NODE_TOTAL --parallelism-thread $CIRCLE_NODE_INDEX
51-
- run: promu --config .promu-cgo.yml crossbuild -v --parallelism $CIRCLE_NODE_TOTAL --parallelism-thread $CIRCLE_NODE_INDEX
52-
# sign the darwin build so it doesn't get SIGKILLed on start, see: https://github.com/prometheus/node_exporter/issues/2539
53-
- run:
54-
command: |
55-
if [[ -f "$(pwd)/.build/darwin-arm64/node_exporter" ]]; then
56-
promu codesign "$(pwd)/.build/darwin-arm64/node_exporter"
57-
fi
20+
- run: "true"
5821

59-
if [[ -f "$(pwd)/.build/darwin-amd64/node_exporter" ]]; then
60-
promu codesign "$(pwd)/.build/darwin-amd64/node_exporter"
61-
fi
62-
- persist_to_workspace:
63-
root: .
64-
paths:
65-
- .build
66-
- store_artifacts:
67-
path: .build
68-
destination: /build
69-
test_docker:
70-
machine:
71-
image: ubuntu-2404:current
72-
environment:
73-
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.26-base
74-
REPO_PATH: github.com/prometheus/node_exporter
75-
steps:
76-
- prometheus/setup_environment
77-
- attach_workspace:
78-
at: .
79-
- run:
80-
command: |
81-
if [ -n "$CIRCLE_TAG" ]; then
82-
make docker DOCKER_IMAGE_TAG=$CIRCLE_TAG
83-
else
84-
make docker
85-
fi
86-
- run: docker images
87-
- run: docker run --rm -t -v "$(pwd):/app" "${DOCKER_TEST_IMAGE_NAME}" -i "${REPO_PATH}" -T
88-
- run:
89-
command: |
90-
if [ -n "$CIRCLE_TAG" ]; then
91-
make test-docker DOCKER_IMAGE_TAG=$CIRCLE_TAG
92-
else
93-
make test-docker
94-
fi
9522
workflows:
9623
version: 2
9724
node_exporter:
@@ -100,40 +27,3 @@ workflows:
10027
filters:
10128
tags:
10229
only: /.*/
103-
- test-arm:
104-
filters:
105-
tags:
106-
only: /.*/
107-
- build:
108-
filters:
109-
tags:
110-
only: /.*/
111-
- test_docker:
112-
requires:
113-
- test
114-
- build
115-
filters:
116-
tags:
117-
only: /.*/
118-
- test_mixins:
119-
filters:
120-
tags:
121-
only: /.*/
122-
- prometheus/publish_master:
123-
context: org-context
124-
requires:
125-
- test
126-
- build
127-
filters:
128-
branches:
129-
only: master
130-
- prometheus/publish_release:
131-
context: org-context
132-
requires:
133-
- test
134-
- build
135-
filters:
136-
tags:
137-
only: /^v.*/
138-
branches:
139-
ignore: /.*/

.github/workflows/bsd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,13 @@ jobs:
258258
ln -s $(which gsed) $(pwd)/bin/sed
259259
ln -s $(which gtar) $(pwd)/bin/tar
260260
export PATH=$(pwd)/bin:$PATH
261-
261+
262262
echo ">> building promu as it is not shipped for Solaris"
263263
git clone https://github.com/prometheus/promu.git
264264
cd promu
265265
go build .
266266
cd -
267-
267+
268268
mkdir -p $(go env GOPATH)/bin
269269
ln -s $(pwd)/promu/promu $(go env GOPATH)/bin/promu
270270
export PATH=$(go env GOPATH)/bin:$PATH

.github/workflows/ci.yml

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
---
2+
name: CI
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master, '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 and .promu-cgo.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+
- run: go mod download
25+
- run: make
26+
27+
test_go_arm:
28+
name: Go ARM tests
29+
runs-on: ubuntu-24.04-arm
30+
steps:
31+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
32+
with:
33+
persist-credentials: false
34+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
35+
with:
36+
go-version: 1.26.x
37+
- run: uname -a
38+
- run: make test-e2e
39+
40+
test_mixins:
41+
name: Mixins tests
42+
runs-on: ubuntu-latest
43+
container:
44+
# Whenever the Go version is updated here, .promu.yml and .promu-cgo.yml
45+
# should also be updated.
46+
image: quay.io/prometheus/golang-builder:1.26-base
47+
steps:
48+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
49+
with:
50+
persist-credentials: false
51+
- run: go install github.com/google/go-jsonnet/cmd/jsonnet@latest
52+
- run: go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest
53+
- run: go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
54+
- run: make promtool
55+
- run: make -C docs/node-mixin clean
56+
- run: make -C docs/node-mixin jb_install
57+
- run: make -C docs/node-mixin
58+
- run: git diff --exit-code
59+
60+
build:
61+
name: Build node_exporter for all architectures
62+
runs-on: ubuntu-latest
63+
strategy:
64+
matrix:
65+
thread: [ 0, 1, 2 ]
66+
steps:
67+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
68+
with:
69+
persist-credentials: false
70+
- uses: prometheus/promci-setup@5af30ba8c199a91d6c04ebdc3c48e630e355f62d # v0.1.0
71+
- name: Crossbuild
72+
run: ~/go/bin/promu crossbuild -v --parallelism 3 --parallelism-thread ${{ matrix.thread }}
73+
- name: CGO crossbuild
74+
run: ~/go/bin/promu --config .promu-cgo.yml crossbuild -v --parallelism 3 --parallelism-thread ${{ matrix.thread }}
75+
- name: Codesign darwin binaries
76+
run: |
77+
if [[ -f "$(pwd)/.build/darwin-arm64/node_exporter" ]]; then
78+
~/go/bin/promu codesign "$(pwd)/.build/darwin-arm64/node_exporter"
79+
fi
80+
if [[ -f "$(pwd)/.build/darwin-amd64/node_exporter" ]]; then
81+
~/go/bin/promu codesign "$(pwd)/.build/darwin-amd64/node_exporter"
82+
fi
83+
- uses: prometheus/promci-artifacts/save@f9a587dbc0b2c78a0c54f8ad1cde71ea29a4b76f # v0.1.0
84+
with:
85+
directory: .build
86+
87+
test_docker:
88+
name: Test docker image
89+
runs-on: ubuntu-latest
90+
needs: [test_go, build_all]
91+
env:
92+
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.26-base
93+
REPO_PATH: github.com/prometheus/node_exporter
94+
steps:
95+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
96+
with:
97+
persist-credentials: false
98+
- uses: prometheus/promci-artifacts/restore@f9a587dbc0b2c78a0c54f8ad1cde71ea29a4b76f # v0.1.0
99+
- name: Build docker image
100+
run: |
101+
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
102+
make docker DOCKER_IMAGE_TAG=${{ github.ref_name }}
103+
else
104+
make docker
105+
fi
106+
- run: docker images
107+
- run: docker run --rm -t -v "$(pwd):/app" "${DOCKER_TEST_IMAGE_NAME}" -i "${REPO_PATH}" -T
108+
- name: Test docker image
109+
run: |
110+
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
111+
make test-docker DOCKER_IMAGE_TAG=${{ github.ref_name }}
112+
else
113+
make test-docker
114+
fi
115+
116+
publish_main:
117+
name: Publish main branch artifacts
118+
runs-on: ubuntu-latest
119+
needs: [test_go, test_go_arm, build_all]
120+
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'
121+
steps:
122+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
123+
with:
124+
persist-credentials: false
125+
- uses: prometheus/promci/publish_main@769ee18070cd21cfc2a24fa912349fd3e48dee58 # v0.6.0
126+
with:
127+
docker_hub_login: ${{ secrets.docker_hub_login }}
128+
docker_hub_password: ${{ secrets.docker_hub_password }}
129+
quay_io_login: ${{ secrets.quay_io_login }}
130+
quay_io_password: ${{ secrets.quay_io_password }}
131+
132+
publish_release:
133+
name: Publish release artifacts
134+
runs-on: ubuntu-latest
135+
needs: [test_go, test_go_arm, build_all]
136+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
137+
steps:
138+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
139+
with:
140+
persist-credentials: false
141+
- uses: prometheus/promci/publish_release@769ee18070cd21cfc2a24fa912349fd3e48dee58 # v0.6.0
142+
with:
143+
docker_hub_login: ${{ secrets.docker_hub_login }}
144+
docker_hub_password: ${{ secrets.docker_hub_password }}
145+
quay_io_login: ${{ secrets.quay_io_login }}
146+
quay_io_password: ${{ secrets.quay_io_password }}
147+
github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }}

0 commit comments

Comments
 (0)