2022-09-05 14:09:41 -07:00
|
|
|
---
|
2022-09-06 07:58:50 -07:00
|
|
|
name: CI
|
2023-01-25 11:12:02 -08:00
|
|
|
on:
|
2022-09-05 14:09:41 -07:00
|
|
|
pull_request:
|
|
|
|
push:
|
2023-04-03 00:05:10 -07:00
|
|
|
|
2022-09-05 14:09:41 -07:00
|
|
|
jobs:
|
|
|
|
test_go:
|
2022-09-06 07:58:50 -07:00
|
|
|
name: Go tests
|
2022-09-05 14:09:41 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
2024-02-16 05:21:10 -08:00
|
|
|
# Whenever the Go version is updated here, .promu.yml
|
|
|
|
# should also be updated.
|
2024-02-19 03:40:00 -08:00
|
|
|
image: quay.io/prometheus/golang-builder:1.22-base
|
2022-09-05 14:09:41 -07:00
|
|
|
steps:
|
2024-06-01 16:15:35 -07:00
|
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
2024-09-01 16:07:53 -07:00
|
|
|
- uses: prometheus/promci@45166329da36d74895901808f1c8c97efafc7f84 # v0.3.0
|
2022-12-20 00:40:31 -08:00
|
|
|
- uses: ./.github/promci/actions/setup_environment
|
2024-03-06 02:32:11 -08:00
|
|
|
- run: make GOOPTS=--tags=stringlabels GO_ONLY=1 SKIP_GOLANGCI_LINT=1
|
|
|
|
- run: go test --tags=stringlabels ./tsdb/ -test.tsdb-isolation=false
|
2022-09-05 14:09:41 -07:00
|
|
|
- run: make -C documentation/examples/remote_storage
|
|
|
|
- run: make -C documentation/examples
|
2024-03-06 11:05:53 -08:00
|
|
|
|
|
|
|
test_go_more:
|
|
|
|
name: More Go tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
|
|
image: quay.io/prometheus/golang-builder:1.22-base
|
|
|
|
steps:
|
2024-06-01 16:15:35 -07:00
|
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
2024-09-01 16:07:53 -07:00
|
|
|
- uses: prometheus/promci@45166329da36d74895901808f1c8c97efafc7f84 # v0.3.0
|
2024-03-06 11:05:53 -08:00
|
|
|
- uses: ./.github/promci/actions/setup_environment
|
|
|
|
- run: go test --tags=dedupelabels ./...
|
|
|
|
- run: GOARCH=386 go test ./cmd/prometheus
|
2022-12-20 00:40:31 -08:00
|
|
|
- uses: ./.github/promci/actions/check_proto
|
2022-09-05 14:09:41 -07:00
|
|
|
with:
|
|
|
|
version: "3.15.8"
|
|
|
|
|
2024-02-16 05:21:10 -08:00
|
|
|
test_go_oldest:
|
|
|
|
name: Go tests with previous Go version
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
|
|
# The go version in this image should be N-1 wrt test_go.
|
|
|
|
image: quay.io/prometheus/golang-builder:1.21-base
|
|
|
|
steps:
|
2024-06-01 16:15:35 -07:00
|
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
2024-02-16 05:21:10 -08:00
|
|
|
- run: make build
|
2024-03-08 02:37:28 -08:00
|
|
|
# Don't run NPM build; don't run race-detector.
|
|
|
|
- run: make test GO_ONLY=1 test-flags=""
|
2024-02-16 05:21:10 -08:00
|
|
|
|
2022-09-05 14:09:41 -07:00
|
|
|
test_ui:
|
2022-09-06 07:58:50 -07:00
|
|
|
name: UI tests
|
2022-09-05 14:09:41 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
# Whenever the Go version is updated here, .promu.yml
|
|
|
|
# should also be updated.
|
|
|
|
container:
|
2024-02-19 03:40:00 -08:00
|
|
|
image: quay.io/prometheus/golang-builder:1.22-base
|
2022-09-05 14:09:41 -07:00
|
|
|
|
|
|
|
steps:
|
2024-06-01 16:15:35 -07:00
|
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
2024-09-01 16:07:53 -07:00
|
|
|
- uses: prometheus/promci@45166329da36d74895901808f1c8c97efafc7f84 # v0.3.0
|
2022-12-20 00:40:31 -08:00
|
|
|
- uses: ./.github/promci/actions/setup_environment
|
2022-09-05 14:09:41 -07:00
|
|
|
with:
|
|
|
|
enable_go: false
|
|
|
|
enable_npm: true
|
|
|
|
- run: make assets-tarball
|
|
|
|
- run: make ui-lint
|
|
|
|
- run: make ui-test
|
2022-12-20 00:40:31 -08:00
|
|
|
- uses: ./.github/promci/actions/save_artifacts
|
2022-09-05 14:09:41 -07:00
|
|
|
with:
|
2022-09-06 03:27:31 -07:00
|
|
|
directory: .tarballs
|
2022-09-05 14:09:41 -07:00
|
|
|
|
|
|
|
test_windows:
|
2022-09-06 07:58:50 -07:00
|
|
|
name: Go tests on Windows
|
2022-09-05 14:09:41 -07:00
|
|
|
runs-on: windows-latest
|
|
|
|
steps:
|
2024-06-01 16:15:35 -07:00
|
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
2024-08-01 16:46:27 -07:00
|
|
|
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
|
2022-09-05 14:09:41 -07:00
|
|
|
with:
|
2024-02-19 03:40:00 -08:00
|
|
|
go-version: 1.22.x
|
2022-09-05 14:09:41 -07:00
|
|
|
- run: |
|
|
|
|
$TestTargets = go list ./... | Where-Object { $_ -NotMatch "(github.com/prometheus/prometheus/discovery.*|github.com/prometheus/prometheus/config|github.com/prometheus/prometheus/web)"}
|
|
|
|
go test $TestTargets -vet=off -v
|
|
|
|
shell: powershell
|
|
|
|
|
|
|
|
test_mixins:
|
2022-09-06 07:58:50 -07:00
|
|
|
name: Mixins tests
|
2022-09-05 14:09:41 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
# Whenever the Go version is updated here, .promu.yml
|
|
|
|
# should also be updated.
|
|
|
|
container:
|
2024-02-16 05:21:10 -08:00
|
|
|
image: quay.io/prometheus/golang-builder:1.22-base
|
2022-09-05 14:09:41 -07:00
|
|
|
steps:
|
2024-06-01 16:15:35 -07:00
|
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
2022-09-05 14:09:41 -07:00
|
|
|
- run: go install ./cmd/promtool/.
|
|
|
|
- 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 -C documentation/prometheus-mixin clean
|
|
|
|
- run: make -C documentation/prometheus-mixin jb_install
|
|
|
|
- run: make -C documentation/prometheus-mixin
|
|
|
|
- run: git diff --exit-code
|
|
|
|
|
|
|
|
build:
|
2022-09-06 07:58:50 -07:00
|
|
|
name: Build Prometheus for common architectures
|
2022-09-05 14:09:41 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: |
|
2022-09-06 07:58:50 -07:00
|
|
|
!(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v2.'))
|
2022-09-05 14:09:41 -07:00
|
|
|
&&
|
|
|
|
!(github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-'))
|
|
|
|
&&
|
|
|
|
!(github.event_name == 'push' && github.event.ref == 'refs/heads/main')
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
thread: [ 0, 1, 2 ]
|
|
|
|
steps:
|
2024-06-01 16:15:35 -07:00
|
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
2024-09-01 16:07:53 -07:00
|
|
|
- uses: prometheus/promci@45166329da36d74895901808f1c8c97efafc7f84 # v0.3.0
|
2022-12-20 00:40:31 -08:00
|
|
|
- uses: ./.github/promci/actions/build
|
2022-09-05 14:09:41 -07:00
|
|
|
with:
|
|
|
|
promu_opts: "-p linux/amd64 -p windows/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64 -p linux/386"
|
|
|
|
parallelism: 3
|
|
|
|
thread: ${{ matrix.thread }}
|
|
|
|
build_all:
|
2022-09-06 07:58:50 -07:00
|
|
|
name: Build Prometheus for all architectures
|
2022-09-05 14:09:41 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
if: |
|
2022-09-06 07:58:50 -07:00
|
|
|
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v2.'))
|
2022-09-05 14:09:41 -07:00
|
|
|
||
|
|
|
|
(github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-'))
|
|
|
|
||
|
|
|
|
(github.event_name == 'push' && github.event.ref == 'refs/heads/main')
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
thread: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]
|
|
|
|
|
|
|
|
# Whenever the Go version is updated here, .promu.yml
|
|
|
|
# should also be updated.
|
|
|
|
steps:
|
2024-06-01 16:15:35 -07:00
|
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
2024-09-01 16:07:53 -07:00
|
|
|
- uses: prometheus/promci@45166329da36d74895901808f1c8c97efafc7f84 # v0.3.0
|
2022-12-20 00:40:31 -08:00
|
|
|
- uses: ./.github/promci/actions/build
|
2022-09-05 14:09:41 -07:00
|
|
|
with:
|
|
|
|
parallelism: 12
|
|
|
|
thread: ${{ matrix.thread }}
|
2024-06-25 00:15:09 -07:00
|
|
|
build_all_status:
|
|
|
|
name: Report status of build Prometheus for all architectures
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [build_all]
|
|
|
|
if: github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-')
|
|
|
|
steps:
|
|
|
|
- name: Successful build
|
|
|
|
if: ${{ !(contains(needs.*.result, 'failure')) && !(contains(needs.*.result, 'cancelled')) }}
|
|
|
|
run: exit 0
|
|
|
|
- name: Failing or cancelled build
|
|
|
|
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
|
|
|
|
run: exit 1
|
2024-04-30 07:22:16 -07:00
|
|
|
check_generated_parser:
|
|
|
|
name: Check generated parser
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2024-06-01 16:15:35 -07:00
|
|
|
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
2024-04-30 07:22:16 -07:00
|
|
|
- name: Install Go
|
2024-08-01 16:46:27 -07:00
|
|
|
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
|
2024-04-30 07:22:16 -07:00
|
|
|
with:
|
|
|
|
cache: false
|
|
|
|
go-version: 1.22.x
|
|
|
|
- name: Run goyacc and check for diff
|
|
|
|
run: make install-goyacc check-generated-parser
|
2022-09-06 07:58:50 -07:00
|
|
|
golangci:
|
|
|
|
name: golangci-lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2024-05-28 01:06:08 -07:00
|
|
|
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
2022-09-06 07:58:50 -07:00
|
|
|
- name: Install Go
|
2024-08-01 16:46:27 -07:00
|
|
|
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
|
2022-09-06 07:58:50 -07:00
|
|
|
with:
|
2024-02-19 03:40:00 -08:00
|
|
|
go-version: 1.22.x
|
2022-09-06 07:58:50 -07:00
|
|
|
- name: Install snmp_exporter/generator dependencies
|
|
|
|
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
|
|
|
|
if: github.repository == 'prometheus/snmp_exporter'
|
|
|
|
- name: Lint
|
2024-08-01 16:46:44 -07:00
|
|
|
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
|
2022-09-06 07:58:50 -07:00
|
|
|
with:
|
2023-04-09 00:08:40 -07:00
|
|
|
args: --verbose
|
2023-12-08 02:01:38 -08:00
|
|
|
# Make sure to sync this with Makefile.common and scripts/golangci-lint.yml.
|
2024-08-21 09:55:28 -07:00
|
|
|
version: v1.60.2
|
2022-09-06 07:58:50 -07:00
|
|
|
fuzzing:
|
|
|
|
uses: ./.github/workflows/fuzzing.yml
|
|
|
|
if: github.event_name == 'pull_request'
|
|
|
|
codeql:
|
|
|
|
uses: ./.github/workflows/codeql-analysis.yml
|
2022-09-05 14:09:41 -07:00
|
|
|
|
|
|
|
publish_main:
|
2022-09-08 06:46:32 -07:00
|
|
|
name: Publish main branch artifacts
|
2022-09-05 14:09:41 -07:00
|
|
|
runs-on: ubuntu-latest
|
2024-03-28 03:05:10 -07:00
|
|
|
needs: [test_ui, test_go, test_go_more, test_go_oldest, test_windows, golangci, codeql, build_all]
|
2022-09-06 07:58:50 -07:00
|
|
|
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main'
|
2022-09-05 14:09:41 -07:00
|
|
|
steps:
|
2024-06-01 16:15:35 -07:00
|
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
2024-09-01 16:07:53 -07:00
|
|
|
- uses: prometheus/promci@45166329da36d74895901808f1c8c97efafc7f84 # v0.3.0
|
2022-12-20 00:40:31 -08:00
|
|
|
- uses: ./.github/promci/actions/publish_main
|
2022-09-05 14:09:41 -07:00
|
|
|
with:
|
|
|
|
docker_hub_login: ${{ secrets.docker_hub_login }}
|
|
|
|
docker_hub_password: ${{ secrets.docker_hub_password }}
|
|
|
|
quay_io_login: ${{ secrets.quay_io_login }}
|
|
|
|
quay_io_password: ${{ secrets.quay_io_password }}
|
|
|
|
publish_release:
|
2023-07-22 06:29:34 -07:00
|
|
|
name: Publish release artefacts
|
2022-09-05 14:09:41 -07:00
|
|
|
runs-on: ubuntu-latest
|
2024-03-28 03:05:10 -07:00
|
|
|
needs: [test_ui, test_go, test_go_more, test_go_oldest, test_windows, golangci, codeql, build_all]
|
2022-09-06 07:58:50 -07:00
|
|
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v2.')
|
2022-09-05 14:09:41 -07:00
|
|
|
steps:
|
2024-06-01 16:15:35 -07:00
|
|
|
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
2024-09-01 16:07:53 -07:00
|
|
|
- uses: prometheus/promci@45166329da36d74895901808f1c8c97efafc7f84 # v0.3.0
|
2022-12-20 00:40:31 -08:00
|
|
|
- uses: ./.github/promci/actions/publish_release
|
2022-09-05 14:09:41 -07:00
|
|
|
with:
|
|
|
|
docker_hub_login: ${{ secrets.docker_hub_login }}
|
|
|
|
docker_hub_password: ${{ secrets.docker_hub_password }}
|
|
|
|
quay_io_login: ${{ secrets.quay_io_login }}
|
|
|
|
quay_io_password: ${{ secrets.quay_io_password }}
|
2022-09-30 01:54:26 -07:00
|
|
|
github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }}
|
2022-09-06 07:58:50 -07:00
|
|
|
publish_ui_release:
|
|
|
|
name: Publish UI on npm Registry
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [test_ui, codeql]
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-06-01 16:15:35 -07:00
|
|
|
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
2024-09-01 16:07:53 -07:00
|
|
|
- uses: prometheus/promci@45166329da36d74895901808f1c8c97efafc7f84 # v0.3.0
|
2022-09-06 07:58:50 -07:00
|
|
|
- name: Install nodejs
|
2024-03-21 01:14:40 -07:00
|
|
|
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
2022-09-06 07:58:50 -07:00
|
|
|
with:
|
|
|
|
node-version-file: "web/ui/.nvmrc"
|
|
|
|
registry-url: "https://registry.npmjs.org"
|
2024-03-21 01:14:36 -07:00
|
|
|
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
2022-09-06 07:58:50 -07:00
|
|
|
with:
|
|
|
|
path: ~/.npm
|
|
|
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-node-
|
|
|
|
- name: Check libraries version
|
|
|
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v2.')
|
|
|
|
run: ./scripts/ui_release.sh --check-package "$(echo ${{ github.ref_name }}|sed s/v2/v0/)"
|
|
|
|
- name: build
|
|
|
|
run: make assets
|
|
|
|
- name: Copy files before publishing libs
|
|
|
|
run: ./scripts/ui_release.sh --copy
|
|
|
|
- name: Publish dry-run libraries
|
|
|
|
if: "!(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v2.'))"
|
|
|
|
run: ./scripts/ui_release.sh --publish dry-run
|
|
|
|
- name: Publish libraries
|
|
|
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v2.')
|
|
|
|
run: ./scripts/ui_release.sh --publish
|
|
|
|
env:
|
|
|
|
# The setup-node action writes an .npmrc file with this env variable
|
|
|
|
# as the placeholder for the auth token
|
|
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|