2022-09-05 14:09:41 -07:00
|
|
|
---
|
2022-09-06 07:58:50 -07:00
|
|
|
name: CI
|
2022-10-03 03:52:57 -07:00
|
|
|
on: # yamllint disable-line rule:truthy
|
2022-09-05 14:09:41 -07:00
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
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
|
|
|
|
# Whenever the Go version is updated here, .promu.yml
|
|
|
|
# should also be updated.
|
|
|
|
container:
|
2022-09-07 02:30:48 -07:00
|
|
|
image: quay.io/prometheus/golang-builder:1.19-base
|
2022-09-05 14:09:41 -07:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2022-12-20 00:40:31 -08:00
|
|
|
- uses: prometheus/promci@v0.0.2
|
|
|
|
- uses: ./.github/promci/actions/setup_environment
|
2022-09-05 14:09:41 -07:00
|
|
|
- run: make GO_ONLY=1 SKIP_GOLANGCI_LINT=1
|
|
|
|
- run: go test ./tsdb/ -test.tsdb-isolation=false
|
2022-11-09 02:18:49 -08:00
|
|
|
- run: GOARCH=386 go test ./cmd/prometheus
|
2022-09-05 14:09:41 -07:00
|
|
|
- run: make -C documentation/examples/remote_storage
|
|
|
|
- run: make -C documentation/examples
|
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"
|
|
|
|
|
|
|
|
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:
|
2022-09-07 02:30:48 -07:00
|
|
|
image: quay.io/prometheus/golang-builder:1.19-base
|
2022-09-05 14:09:41 -07:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2022-12-20 00:40:31 -08:00
|
|
|
- uses: prometheus/promci@v0.0.2
|
|
|
|
- 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:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-go@v3
|
|
|
|
with:
|
2022-09-07 02:30:48 -07:00
|
|
|
go-version: '>=1.19 <1.20'
|
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_golang_oldest:
|
2022-09-06 07:58:50 -07:00
|
|
|
name: Go tests with previous Go version
|
2022-09-05 14:09:41 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
# The go verson in this image should be N-1 wrt test_go.
|
|
|
|
container:
|
2022-09-07 02:30:48 -07:00
|
|
|
image: quay.io/prometheus/golang-builder:1.18-base
|
2022-09-05 14:09:41 -07:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- run: make build
|
|
|
|
- run: go test ./tsdb/...
|
|
|
|
- run: go test ./tsdb/ -test.tsdb-isolation=false
|
|
|
|
|
|
|
|
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:
|
2022-09-07 02:30:48 -07:00
|
|
|
image: quay.io/prometheus/golang-builder:1.19-base
|
2022-09-05 14:09:41 -07:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- 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:
|
|
|
|
- uses: actions/checkout@v3
|
2022-12-20 00:40:31 -08:00
|
|
|
- uses: prometheus/promci@v0.0.2
|
|
|
|
- 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:
|
|
|
|
- uses: actions/checkout@v3
|
2022-12-20 00:40:31 -08:00
|
|
|
- uses: prometheus/promci@v0.0.2
|
|
|
|
- uses: ./.github/promci/actions/build
|
2022-09-05 14:09:41 -07:00
|
|
|
with:
|
|
|
|
parallelism: 12
|
|
|
|
thread: ${{ matrix.thread }}
|
2022-09-06 07:58:50 -07:00
|
|
|
golangci:
|
|
|
|
name: golangci-lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: '<1.19'
|
|
|
|
- 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
|
2022-12-21 18:35:11 -08:00
|
|
|
uses: golangci/golangci-lint-action@v3.3.1
|
2022-09-06 07:58:50 -07:00
|
|
|
with:
|
2022-12-21 18:35:11 -08:00
|
|
|
version: v1.50.1
|
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
|
2022-09-06 07:58:50 -07:00
|
|
|
needs: [test_ui, test_go, test_windows, golangci, codeql, build_all]
|
|
|
|
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main'
|
2022-09-05 14:09:41 -07:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2022-12-20 00:40:31 -08:00
|
|
|
- uses: prometheus/promci@v0.0.2
|
|
|
|
- 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:
|
2022-09-06 07:58:50 -07:00
|
|
|
name: Publish release arfefacts
|
2022-09-05 14:09:41 -07:00
|
|
|
runs-on: ubuntu-latest
|
2022-09-06 07:58:50 -07:00
|
|
|
needs: [test_ui, test_go, test_windows, golangci, codeql, build_all]
|
|
|
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v2.')
|
2022-09-05 14:09:41 -07:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2022-12-20 00:40:31 -08:00
|
|
|
- uses: prometheus/promci@v0.0.2
|
|
|
|
- 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
|
|
|
|
uses: actions/checkout@v3
|
2022-12-20 00:40:31 -08:00
|
|
|
- uses: prometheus/promci@v0.0.2
|
2022-09-06 07:58:50 -07:00
|
|
|
- name: Install nodejs
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version-file: "web/ui/.nvmrc"
|
|
|
|
registry-url: "https://registry.npmjs.org"
|
2022-11-08 12:29:32 -08:00
|
|
|
- uses: actions/cache@v3.0.11
|
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 }}
|