diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 8031912..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,65 +0,0 @@ -version: 2.1 - -# DRY -x_ref: - docker_golang: &docker_golang - image: circleci/golang:1.16 - docker_goreleaser: &docker_goreleaser - image: goreleaser/goreleaser - work_dir: &work_dir - working_directory: ~/dnsbl_exporter - -workflows: - pr: - jobs: - - build - - integration: - requires: - - build - -jobs: - build: - <<: *work_dir - docker: - - *docker_goreleaser - steps: - - checkout - - run: - name: Check config for goreleaser - command: goreleaser check - - run: - name: Build snapshot - command: goreleaser release --snapshot --rm-dist - - run: - name: Copy .ini files next to the snapshot - command: cp targets.ini rbls.ini ./dist/dnsbl_exporter_linux_amd64 - - persist_to_workspace: - root: dist - paths: - - dnsbl_exporter_linux_amd64 - integration: - <<: *work_dir - docker: - - *docker_golang - # starts a service "unbound" - - image: klutchell/unbound - name: unbound - steps: - - attach_workspace: - at: ~/dnsbl_exporter/dist - - run: - name: Where am I? - command: ls -lah ./dist/ - - run: - name: Start dnsbl_exporter - command: cd ./dist/dnsbl_exporter_linux_amd64/ && ./dnsbl-exporter --config.dns-resolver=unbound - background: true - - run: - name: Test "/" exists - command: curl -I http://127.0.0.1:9211/ - - run: - name: Test "/metrics" exists - command: curl -I http://127.0.0.1:9211/metrics - - run: - name: Test "/metrics" with targets - command: curl -i http://127.0.0.1:9211/metrics diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 0000000..25b0591 --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,56 @@ +--- +name: integration + +on: + pull_request: + +jobs: + snapshot: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --config ./.goreleaser.ci.yml --rm-dist --snapshot + - name: Copy .ini files + run: cp targets.ini rbls.ini ./dist/dnsbl_exporter_linux_amd64 + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: dnsbl_exporter + path: dist/dnsbl_exporter_linux_amd64 + + integration: + runs-on: ubuntu-latest + needs: + - snapshot + services: + unbound: + image: klutchell/unbound:latest + ports: + - 5053:5053 + - 5053:5053/udp + steps: + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: dnsbl_exporter + - name: Allow running exporter + run: chmod +x ./dnsbl-exporter + - name: Start dnsbl_exporter + run: ./dnsbl-exporter --config.dns-resolver=unbound:5053 & + - name: Test "/" exists + run: curl -I http://127.0.0.1:9211/ + - name: Test "/metrics" exists + run: curl -I http://127.0.0.1:9211/metrics + - name: Test "/metrics" with targets + run: curl -i http://127.0.0.1:9211/metrics diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index d314b32..3d27cba 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -19,55 +19,3 @@ jobs: uses: actions/checkout@v2 - name: Test run: go test ./... - - snapshot: - runs-on: ubuntu-latest - needs: - - test - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.16 - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 - with: - version: latest - args: release --config ./.goreleaser.ci.yml --rm-dist --snapshot - - name: Copy .ini files - run: cp targets.ini rbls.ini ./dist/dnsbl_exporter_linux_amd64 - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: dnsbl_exporter - path: dist/dnsbl_exporter_linux_amd64 - - integration: - runs-on: ubuntu-latest - needs: - - snapshot - services: - unbound: - image: klutchell/unbound:latest - ports: - - 5053:5053 - - 5053:5053/udp - steps: - - name: Download artifact - uses: actions/download-artifact@v2 - with: - name: dnsbl_exporter - - name: Allow running exporter - run: chmod +x ./dnsbl-exporter - - name: Start dnsbl_exporter - run: ./dnsbl-exporter --config.dns-resolver=unbound:5053 & - - name: Test "/" exists - run: curl -I http://127.0.0.1:9211/ - - name: Test "/metrics" exists - run: curl -I http://127.0.0.1:9211/metrics - - name: Test "/metrics" with targets - run: curl -i http://127.0.0.1:9211/metrics