diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 320007e..d8b5c42 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - go_version: [ '1.12', '1.13', '1.14' ] + go_version: [ '1.12', '1.13', '1.14', '1.15' ] steps: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 @@ -19,7 +19,7 @@ jobs: - run: go get -t -v ./... - run: go test -v -race ./... - build: + docker-build: runs-on: ubuntu-latest needs: test steps: @@ -70,41 +70,45 @@ jobs: upload_url: ${{ steps.create.outputs.upload_url }} upload: - runs-on: ubuntu-latest needs: release strategy: matrix: include: - - os: linux - arch: 386 - - os: linux - arch: amd64 - - os: linux - arch: arm - - os: darwin - arch: 386 - - os: darwin - arch: amd64 - - os: windows - arch: 386 + - os: ubuntu-latest + goos: linux + goarch: 386 + - os: ubuntu-latest + goos: linux + goarch: amd64 + - os: ubuntu-latest + goos: linux + goarch: arm + - os: macos-latest + goos: darwin + goarch: amd64 + - os: macos-latest + goos: darwin + goarch: arm64 + - os: ubuntu-latest + goos: windows + goarch: 386 extension: '.exe' - - os: windows - arch: amd64 + - os: ubuntu-latest + goos: windows + goarch: amd64 extension: '.exe' + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: 1.14 + go-version: 1.15 - name: Download go dependencies run: go get -t -v ./... - - name: Install mitchellh/gox to create platform specific releases - run: go install github.com/mitchellh/gox - - name: Create release - run: gox -ldflags "-s -w" -os="${{ matrix.os }}" -arch="${{ matrix.arch }}" -output="pihole_exporter-{{.OS}}-{{.Arch}}" -verbose ./... + run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags "-s -w" -o pihole_exporter-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.extension }} ./ - name: Upload release assets id: upload-release-asset @@ -113,6 +117,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ needs.release.outputs.upload_url }}${{ matrix.extension }} - asset_path: ./pihole_exporter-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }} - asset_name: pihole_exporter-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }} + asset_path: ./pihole_exporter-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.extension }} + asset_name: pihole_exporter-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.extension }} asset_content_type: application/octet-stream diff --git a/Dockerfile b/Dockerfile index 52c2a54..54ca1c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,11 +7,10 @@ FROM golang:1.15-alpine3.12 as builder WORKDIR /go/src/github.com/eko/pihole-exporter COPY . . -RUN apk --no-cache add git alpine-sdk upx +RUN apk --no-cache add git alpine-sdk RUN GO111MODULE=on go mod vendor RUN CGO_ENABLED=0 GOOS=$OS GOARCH=$ARCH go build -ldflags '-s -w' -o binary ./ -RUN upx -f --brute binary FROM $IMAGE diff --git a/README.md b/README.md index 824a64e..3c35378 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,6 @@ Grafana dashboard is [available here](https://grafana.com/dashboards/10176) on t You can download the latest version of the binary built for your architecture here: * Architecture **i386** [ - [Darwin](https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-darwin-386) / [Linux](https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-linux-386) / [Windows](https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-windows-386.exe) ] @@ -31,6 +30,7 @@ You can download the latest version of the binary built for your architecture he [Windows](https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-windows-amd64.exe) ] * Architecture **arm** [ + [Darwin](https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-darwin-arm64) / [Linux](https://github.com/eko/pihole-exporter/releases/latest/download/pihole_exporter-linux-arm) ] diff --git a/go.sum b/go.sum index d1b7619..96205c0 100644 --- a/go.sum +++ b/go.sum @@ -261,8 +261,7 @@ github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= -github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= +github.com/prometheus/client_golang v1.9.0 h1:Rrch9mh17XcxvEu9D9DEpb4isxjGBtcevQjKvxPRQIU= github.com/prometheus/client_golang v1.9.0/go.mod h1:FqZLKOZnGdFAhOK4nqGHa7D66IdsO+O441Eve7ptJDU= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= @@ -280,8 +279,7 @@ github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= -github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= +github.com/prometheus/common v0.15.0 h1:4fgOnadei3EZvgRwxJ7RMpG1k1pOZth5Pc13tyspaKM= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= @@ -409,8 +407,7 @@ golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= -golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e h1:AyodaIpKjppX+cBfTASF2E1US3H2JFBj920Ot3rtDjs= golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=