prometheusmetricsnode-metricsprocfsprometheus-exportersystem-informationhost-metricssystem-metricsmachine-metrics
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
148 lines
5.2 KiB
148 lines
5.2 KiB
---
|
|
name: CI
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [master, 'release-*']
|
|
tags: ['v*']
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test_go:
|
|
name: Go tests
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
# Whenever the Go version is updated here, .promu.yml and .promu-cgo.yml
|
|
# should also be updated.
|
|
image: quay.io/prometheus/golang-builder:1.26-base
|
|
steps:
|
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
with:
|
|
persist-credentials: false
|
|
- run: go mod download
|
|
- run: make
|
|
|
|
test_go_arm:
|
|
name: Go ARM tests
|
|
runs-on: ubuntu-24.04-arm
|
|
steps:
|
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
|
with:
|
|
go-version: 1.26.x
|
|
- run: uname -a
|
|
- run: make test-e2e
|
|
|
|
test_mixins:
|
|
name: Mixins tests
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
# Whenever the Go version is updated here, .promu.yml and .promu-cgo.yml
|
|
# should also be updated.
|
|
image: quay.io/prometheus/golang-builder:1.26-base
|
|
steps:
|
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
with:
|
|
persist-credentials: false
|
|
- run: go install github.com/google/go-jsonnet/cmd/jsonnet@latest
|
|
- run: go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest
|
|
- run: go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
|
|
- run: make promtool
|
|
- run: make -C docs/node-mixin clean
|
|
- run: make -C docs/node-mixin jb_install
|
|
- run: make -C docs/node-mixin
|
|
- run: git diff --exit-code
|
|
|
|
build:
|
|
name: Build node_exporter for all architectures
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
thread: [ 0, 1, 2 ]
|
|
steps:
|
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
with:
|
|
persist-credentials: false
|
|
- uses: prometheus/promci-setup@5af30ba8c199a91d6c04ebdc3c48e630e355f62d # v0.1.0
|
|
- name: Crossbuild
|
|
run: ~/go/bin/promu crossbuild -v --parallelism 3 --parallelism-thread ${{ matrix.thread }}
|
|
- name: CGO crossbuild
|
|
run: ~/go/bin/promu --config .promu-cgo.yml crossbuild -v --parallelism 3 --parallelism-thread ${{ matrix.thread }}
|
|
- name: Codesign darwin binaries
|
|
run: |
|
|
if [[ -f "$(pwd)/.build/darwin-arm64/node_exporter" ]]; then
|
|
~/go/bin/promu codesign "$(pwd)/.build/darwin-arm64/node_exporter"
|
|
fi
|
|
if [[ -f "$(pwd)/.build/darwin-amd64/node_exporter" ]]; then
|
|
~/go/bin/promu codesign "$(pwd)/.build/darwin-amd64/node_exporter"
|
|
fi
|
|
- uses: prometheus/promci-artifacts/save@f9a587dbc0b2c78a0c54f8ad1cde71ea29a4b76f # v0.1.0
|
|
with:
|
|
directory: .build
|
|
|
|
test_docker:
|
|
name: Test docker image
|
|
runs-on: ubuntu-latest
|
|
needs: [test_go, build]
|
|
env:
|
|
DOCKER_TEST_IMAGE_NAME: quay.io/prometheus/golang-builder:1.26-base
|
|
REPO_PATH: github.com/prometheus/node_exporter
|
|
steps:
|
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
with:
|
|
persist-credentials: false
|
|
- uses: prometheus/promci-artifacts/restore@f9a587dbc0b2c78a0c54f8ad1cde71ea29a4b76f # v0.1.0
|
|
- name: Build docker image
|
|
run: |
|
|
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
|
make docker DOCKER_IMAGE_TAG=${{ github.ref_name }}
|
|
else
|
|
make docker
|
|
fi
|
|
- run: docker images
|
|
- run: docker run --rm -t -v "$(pwd):/app" "${DOCKER_TEST_IMAGE_NAME}" -i "${REPO_PATH}" -T
|
|
- name: Test docker image
|
|
run: |
|
|
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
|
make test-docker DOCKER_IMAGE_TAG=${{ github.ref_name }}
|
|
else
|
|
make test-docker
|
|
fi
|
|
|
|
publish_main:
|
|
name: Publish main branch artifacts
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
packages: write
|
|
needs: [test_go, test_go_arm, build]
|
|
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'
|
|
steps:
|
|
- uses: prometheus/promci/publish_main@d9d4f5688814f0b77bf003d07fb8c00507390634 # v0.8.2
|
|
with:
|
|
docker_hub_login: ${{ secrets.docker_hub_login }}
|
|
docker_hub_password: ${{ secrets.docker_hub_password }}
|
|
ghcr_io_password: ${{ github.token }}
|
|
quay_io_login: ${{ secrets.quay_io_login }}
|
|
quay_io_password: ${{ secrets.quay_io_password }}
|
|
|
|
publish_release:
|
|
name: Publish release artifacts
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
needs: [test_go, test_go_arm, build]
|
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
|
steps:
|
|
- uses: prometheus/promci/publish_release@d9d4f5688814f0b77bf003d07fb8c00507390634 # v0.8.2
|
|
with:
|
|
docker_hub_login: ${{ secrets.docker_hub_login }}
|
|
docker_hub_password: ${{ secrets.docker_hub_password }}
|
|
ghcr_io_password: ${{ github.token }}
|
|
quay_io_login: ${{ secrets.quay_io_login }}
|
|
quay_io_password: ${{ secrets.quay_io_password }}
|
|
github_token: ${{ github.token }}
|
|
|