diff --git a/.circleci/config.yml b/.circleci/config.yml index 26e26c26..051da513 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,101 +1,33 @@ --- +# Prometheus has switched to GitHub action. +# Circle CI is not disabled repository-wise so that previous pull requests +# continue working. +# This file does not generate any CircleCI workflow. + version: 2.1 -orbs: - prometheus: prometheus/prometheus@0.17.1 + executors: - # Whenever the Go version is updated here, .promu.yml - # should also be updated. golang: docker: - - image: cimg/go:1.26 + - image: busybox + jobs: - test: + noopjob: executor: golang + steps: - - prometheus/setup_environment - - run: make check_license style staticcheck unused build test-short - - prometheus/store_artifact: - file: mysqld_exporter - integration: - docker: - - image: cimg/go:1.26 - - image: << parameters.mysql_image >> - environment: - MYSQL_ALLOW_EMPTY_PASSWORD: "yes" - MYSQL_ROOT_HOST: '%' - parameters: - mysql_image: - type: string - steps: - - checkout - - setup_remote_docker - - run: docker version - - run: docker-compose --version - - run: make build - - run: make test - mixin: - executor: golang - steps: - - checkout - - run: go install github.com/monitoring-mixins/mixtool/cmd/mixtool@latest - - run: go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest - - run: make -C mysqld-mixin lint build + - run: + command: "true" + workflows: version: 2 mysqld_exporter: jobs: - - test: - filters: - tags: - only: /.*/ - - integration: - matrix: - parameters: - mysql_image: - - percona:5.6 - - mysql:5.7.33 - - mysql:8.0 - - mysql:8.4 - - mariadb:10.5 - - mariadb:10.6 - - mariadb:10.11 - - mariadb:11.4 - - prometheus/build: - name: build - parallelism: 3 - promu_opts: "-p linux/amd64 -p windows/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64 -p linux/386" - filters: - tags: - ignore: /^v.*/ - branches: - ignore: /^(main|release-.*|.*build-all.*)$/ - - prometheus/build: - name: build_all - parallelism: 12 - filters: - branches: - only: /^(main|release-.*|.*build-all.*)$/ - tags: - only: /^v.*/ - - mixin: - filters: - tags: - only: /.*/ - - prometheus/publish_main: - context: org-context - requires: - - test - - build_all - filters: - branches: - only: main - - prometheus/publish_release: - context: org-context - requires: - - test - - build_all + - noopjob + triggers: + - schedule: + cron: "0 0 30 2 *" filters: - tags: - only: /^v.*/ branches: - ignore: /.*/ + only: + - main diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 202ae236..76e99715 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,3 +4,11 @@ updates: directory: "/" schedule: interval: "monthly" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" + # Exclude configs synced from upstream prometheus/prometheus. + exclude-paths: + - .github/workflows/container_description.yml + - .github/workflows/golangci-lint.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..dcf13a0e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,126 @@ +--- +name: CI +on: + pull_request: + push: + branches: [main, '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 + # should also be updated. + image: quay.io/prometheus/golang-builder:1.26-base + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - uses: prometheus/promci-setup@5af30ba8c199a91d6c04ebdc3c48e630e355f62d # v0.1.0 + - run: make + - run: git diff --exit-code + + mixins: + name: Test mixins + runs-on: ubuntu-latest + container: + # Whenever the Go version is updated here, .promu.yml + # should also be updated. + image: quay.io/prometheus/golang-builder:1.26-base + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - run: go install github.com/monitoring-mixins/mixtool/cmd/mixtool@latest + - run: go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest + - run: make -C mysqld-mixin lint build + + integration: + name: Integration tests + runs-on: ubuntu-latest + container: + # Whenever the Go version is updated here, .promu.yml + # should also be updated. + image: quay.io/prometheus/golang-builder:1.26-base + services: + mysqld: + image: ${{ matrix.mysql_image }} + env: + MYSQL_ALLOW_EMPTY_PASSWORD: "yes" + MYSQL_ROOT_HOST: '%' + options: >- + --health-cmd="mysqladmin ping" + --health-interval=10s + --health-timeout=5s + --health-retries=10 + strategy: + matrix: + mysql_image: + - percona:5.6 + - mysql:5.7.33 + - mysql:8.0 + - mysql:8.4 + - mariadb:10.5 + - mariadb:10.6 + - mariadb:10.11 + - mariadb:11.4 + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - run: make build + - run: make test + - run: git diff --exit-code + + build: + name: Build mysqld_exporter for all architectures + runs-on: ubuntu-latest + strategy: + matrix: + thread: [ 0, 1, 2, 3] + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - uses: prometheus/promci/build@769ee18070cd21cfc2a24fa912349fd3e48dee58 # v0.6.0 + with: + parallelism: 4 + thread: ${{ matrix.thread }} + + publish_main: + name: Publish main branch artifacts + runs-on: ubuntu-latest + needs: [test_go, build, integration] + if: (github.event_name == 'push' && github.event.ref == 'refs/heads/main') + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - uses: prometheus/promci/publish_main@42c3c84c865e5c1ab78543b929f7341eb2ef6123 # v0.6.1 + 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: + name: Publish release artifacts + runs-on: ubuntu-latest + needs: [test_go, build, integration] + if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - uses: prometheus/promci/publish_release@42c3c84c865e5c1ab78543b929f7341eb2ef6123 # v0.6.1 + 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 }} + github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }}