diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 95ab683..76e9971 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,12 +1,14 @@ version: 2 updates: - - package-ecosystem: gomod - directory: / + - package-ecosystem: "gomod" + directory: "/" schedule: - interval: monthly - open-pull-requests-limit: 10 - - package-ecosystem: github-actions - directory: / + interval: "monthly" + - package-ecosystem: "github-actions" + directory: "/" schedule: - interval: monthly - open-pull-requests-limit: 10 + 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 index ef9758c..06ad115 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,101 +1,69 @@ +--- name: CI - on: pull_request: push: - branches: [main, 'release-*'] + branches: [main, master, 'release-*'] tags: ['v*'] +permissions: + contents: read + jobs: - build: - name: Build for common architectures + test_go: + name: Go tests runs-on: ubuntu-latest - if: | - !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) - && - !(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 ] + 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 - - uses: prometheus/promci@42c3c84c865e5c1ab78543b929f7341eb2ef6123 # v0.6.1 - - uses: ./.github/promci/actions/build - with: - promu_opts: "-p linux/amd64 -p windows/amd64 -p darwin/amd64 -p linux/arm64 -p windows/arm64 -p darwin/arm64" - parallelism: 3 - thread: ${{ matrix.thread }} + - uses: prometheus/promci-setup@5af30ba8c199a91d6c04ebdc3c48e630e355f62d # v0.1.0 + - run: make GO_ONLY=1 SKIP_GOLANGCI_LINT=1 - build_all: - name: Build for all architectures + build: + name: Build runs-on: ubuntu-latest - if: | - (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) - || - (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 ] + thread: [ 0, 1, 2, 3] steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: prometheus/promci@42c3c84c865e5c1ab78543b929f7341eb2ef6123 # v0.6.1 - - uses: ./.github/promci/actions/build + - uses: prometheus/promci/build@9c86752f3395e08c57719af549cc455d8e2c2514 # v0.7.0 with: - parallelism: 12 + parallelism: 4 thread: ${{ matrix.thread }} - verify-example-configs: - name: Verify - runs-on: ubuntu-latest - container: - image: quay.io/prometheus/golang-builder:1.26-base - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - run: make build - - name: Verify example configs - run: find ./examples -name "*.yml" -print0 | xargs -0 -I % ./yace verify-config -config.file % - publish_main: name: Publish main branch artifacts runs-on: ubuntu-latest - needs: [build_all, verify-example-configs] + needs: [test_go, build] if: | - (github.repository == 'prometheus-community/fortigate_exporter') - && (github.event_name == 'push' && github.event.ref == 'refs/heads/main') + || + (github.event_name == 'push' && github.event.ref == 'refs/heads/master') steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: prometheus/promci@42c3c84c865e5c1ab78543b929f7341eb2ef6123 # v0.6.1 - - uses: ./.github/promci/actions/publish_main + - uses: prometheus/promci/publish_main@9c86752f3395e08c57719af549cc455d8e2c2514 # v0.7.0 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 + name: Publish release artefacts runs-on: ubuntu-latest - needs: [build_all, verify-example-configs] + needs: [test_go, build] if: | - (github.repository == 'prometheus-community/fortigate_exporter') - && (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: prometheus/promci@42c3c84c865e5c1ab78543b929f7341eb2ef6123 # v0.6.1 - - uses: ./.github/promci/actions/publish_release + - uses: prometheus/promci/publish_release@9c86752f3395e08c57719af549cc455d8e2c2514 # v0.7.0 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 }}