diff --git a/.circleci/config.yml b/.circleci/config.yml index 75ce7aa..965b273 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,83 +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 executors: - # Whenever the Go version is updated here, .promu.yml should also be updated. golang: docker: - - image: cimg/go:1.25 + - image: busybox jobs: - test: - executor: golang - - steps: - - setup_remote_docker - - checkout - - run: go build -o promu-intermediate - - run: make check_license style unused lint test build PROMU=./promu-intermediate - - store_artifacts: - path: promu - destination: /build/promu - - run: rm -v promu promu-intermediate - - run: git diff --exit-code - - build: - executor: golang - environment: - PROMU: ./promu-intermediate - working_directory: /home/circleci/.go_workspace/src/github.com/prometheus/promu - parallelism: 5 - - steps: - - setup_remote_docker - - checkout - - run: go build -o promu-intermediate - - run: ./promu-intermediate crossbuild -v --parallelism $CIRCLE_NODE_TOTAL --parallelism-thread $CIRCLE_NODE_INDEX - - persist_to_workspace: - root: . - paths: - - .build - - store_artifacts: - path: .build - destination: /build - - release_tags: + noopjob: executor: golang - environment: - PROMU: ./promu-intermediate steps: - - checkout - - attach_workspace: - at: . - - run: go build -o promu-intermediate - - run: ./promu-intermediate crossbuild tarballs - - run: ./promu-intermediate checksum .tarballs - - run: ./promu-intermediate release .tarballs - - store_artifacts: - path: .tarballs - destination: releases + - run: + command: "true" workflows: version: 2 - promu: + prometheus: jobs: - - test: - filters: - tags: - only: /.*/ - - build: - filters: - tags: - only: /.*/ - - release_tags: - context: org-context - requires: - - test - - build - filters: - tags: - only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ - branches: - ignore: /.*/ + - noopjob + triggers: + - schedule: + cron: "0 0 30 2 *" + filters: + branches: + only: + - main diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..deb4d38 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,93 @@ +name: CI + +on: + push: + tags: + - 'v*' + branches: + - master + pull_request: + workflow_call: + +jobs: + test_go: + name: Go tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - name: Install Go + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + with: + go-version: 1.25.x + - run: go build -o promu-intermediate + - run: make check_license style unused lint test build PROMU=./promu-intermediate + - run: rm -v promu promu-intermediate + - run: git diff --exit-code + + build: + name: Build for common architectures + runs-on: ubuntu-latest + environment: + PROMU: ./promu-intermediate + if: | + !(github.event_name == 'push' && github.event.ref == 'refs/heads/master') + && + !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) + strategy: + matrix: + thread: [ 0, 1, 2 ] + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - name: Install Go + uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + with: + go-version: 1.25.x + - run: go build -o promu-intermediate + - run: ./promu-intermediate crossbuild -v --parallelism 3 --parallelism-thread ${{ matrix.thread }} + + publish_master: + name: Publish master branch artifacts + runs-on: ubuntu-latest + needs: [test_go, build, verify-example-configs] + environment: + PROMU: ./promu-intermediate + if: | + (github.repository == 'prometheus/promu') + && + (github.event_name == 'push' && github.event.ref == 'refs/heads/master') + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7 + - run: go build -o promu-intermediate + - uses: ./.github/promci/actions/publish_main + with: + docker_hub_organization: prometheuscommunity + docker_hub_login: ${{ secrets.docker_hub_login }} + docker_hub_password: ${{ secrets.docker_hub_password }} + quay_io_organization: prometheuscommunity + 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, verify-example-configs] + environment: + PROMU: ./promu-intermediate + if: | + (github.repository == 'prometheus/promu') + && + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v0.')) + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + - uses: prometheus/promci@443c7fc2397e946bc9f5029e313a9c3441b9b86d # v0.4.7 + - run: go build -o promu-intermediate + - uses: ./.github/promci/actions/publish_release + with: + docker_hub_organization: prometheuscommunity + docker_hub_login: ${{ secrets.docker_hub_login }} + docker_hub_password: ${{ secrets.docker_hub_password }} + quay_io_organization: prometheuscommunity + quay_io_login: ${{ secrets.quay_io_login }} + quay_io_password: ${{ secrets.quay_io_password }} + github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }}