commit
6115c12e88
3 changed files with 144 additions and 114 deletions
81
.github/workflows/master.yml
vendored
81
.github/workflows/master.yml
vendored
|
@ -1,47 +1,56 @@
|
||||||
name: Build and Publish (master)
|
name: Build/Push (master)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches:
|
||||||
|
- '*'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
branches:
|
||||||
|
- '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-amd64:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go_version: [ '1.12', '1.13', '1.14' ]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Build and Push Docker Image (Linux - AMD64)
|
- uses: actions/setup-go@v1
|
||||||
uses: docker/build-push-action@v1
|
with:
|
||||||
with:
|
go-version: ${{ matrix.go_version }}
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
repository: ekofr/pihole-exporter
|
|
||||||
tags: amd64
|
|
||||||
build_args: OS=linux,ARCH=amd64,IMAGE=scratch
|
|
||||||
|
|
||||||
build-arm32:
|
- name: Install go dependencies
|
||||||
|
run: go get -t -v ./...
|
||||||
|
|
||||||
|
- name: Run go tests
|
||||||
|
run: go test -v -cover -race ./...
|
||||||
|
|
||||||
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: test
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: linux
|
||||||
|
arch: amd64
|
||||||
|
image: scratch
|
||||||
|
- os: linux
|
||||||
|
arch: arm
|
||||||
|
image: arm32v7/alpine:3.11
|
||||||
|
- os: linux
|
||||||
|
arch: arm64
|
||||||
|
image: arm64v8/alpine:3.11
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Build and Push Docker Image (Linux - ARM32)
|
|
||||||
uses: docker/build-push-action@v1
|
- name: Build and push docker image (${{ matrix.os }}/${{ matrix.arch }})
|
||||||
with:
|
uses: docker/build-push-action@v1
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
with:
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
repository: ekofr/pihole-exporter
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
tags: arm32
|
repository: ekofr/pihole-exporter
|
||||||
build_args: OS=linux,ARCH=arm,IMAGE=arm32v7/alpine:3.11
|
tags: ${{ matrix.arch }}
|
||||||
|
build_args: OS=${{ matrix.os }},ARCH=${{ matrix.arch }},IMAGE=${{ matrix.image }}
|
||||||
build-arm64:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Build and Push Docker Image (Linux - ARM64)
|
|
||||||
uses: docker/build-push-action@v1
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
repository: ekofr/pihole-exporter
|
|
||||||
tags: arm64
|
|
||||||
build_args: OS=linux,ARCH=arm64,IMAGE=arm64v8/alpine:3.11
|
|
||||||
|
|
135
.github/workflows/tag.yml
vendored
135
.github/workflows/tag.yml
vendored
|
@ -1,4 +1,4 @@
|
||||||
name: Build and Publish (tag)
|
name: Build/Push (tag)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -6,50 +6,113 @@ on:
|
||||||
- '*'
|
- '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-amd64:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go_version: [ '1.12', '1.13', '1.14' ]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Get the version
|
- uses: actions/setup-go@v2
|
||||||
id: get_version
|
with:
|
||||||
run: echo ::set-output name=TAG_NAME::${GITHUB_REF/refs\/tags\//}
|
go-version: ${{ matrix.go_version }}
|
||||||
- name: Build and Push Docker Image (Linux - AMD64)
|
- run: go get -t -v ./...
|
||||||
uses: docker/build-push-action@v1
|
- run: go test -v -race ./...
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
repository: ekofr/pihole-exporter
|
|
||||||
tags: amd64,${{ steps.get_version.outputs.TAG_NAME }}
|
|
||||||
build_args: OS=linux,ARCH=amd64,IMAGE=scratch
|
|
||||||
|
|
||||||
build-arm32:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: test
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Get the version
|
|
||||||
id: get_version
|
- uses: azure/docker-login@v1
|
||||||
run: echo ::set-output name=TAG_NAME::${GITHUB_REF/refs\/tags\//}
|
|
||||||
- name: Build and Push Docker Image (Linux - ARM32)
|
|
||||||
uses: docker/build-push-action@v1
|
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
repository: ekofr/pihole-exporter
|
|
||||||
tags: arm32,${{ steps.get_version.outputs.TAG_NAME }}
|
- name: Set up docker buildx
|
||||||
build_args: OS=linux,ARCH=arm,IMAGE=arm32v7/alpine:3.11
|
id: buildx
|
||||||
|
uses: crazy-max/ghaction-docker-buildx@v1
|
||||||
build-arm64:
|
with:
|
||||||
runs-on: ubuntu-latest
|
buildx-version: latest
|
||||||
steps:
|
qemu-version: latest
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
- name: Docker buildx available platforms
|
||||||
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||||
|
|
||||||
- name: Get the version
|
- name: Get the version
|
||||||
id: get_version
|
id: get_version
|
||||||
run: echo ::set-output name=TAG_NAME::${GITHUB_REF/refs\/tags\//}
|
run: echo ::set-output name=TAG_NAME::${GITHUB_REF/refs\/tags\//}
|
||||||
- name: Build and Push Docker Image (Linux - ARM64)
|
|
||||||
uses: docker/build-push-action@v1
|
- name: Run docker buildx build
|
||||||
with:
|
run: |
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
docker buildx build \
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
--platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 \
|
||||||
repository: ekofr/pihole-exporter
|
--output=type=registry \
|
||||||
tags: arm64,${{ steps.get_version.outputs.TAG_NAME }}
|
--tag ekofr/pihole-exporter:${{ steps.get_version.outputs.TAG_NAME }} \
|
||||||
build_args: OS=linux,ARCH=arm64,IMAGE=arm64v8/alpine:3.11
|
.
|
||||||
|
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: test
|
||||||
|
steps:
|
||||||
|
- name: Create release
|
||||||
|
id: create
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.ref }}
|
||||||
|
release_name: ${{ github.ref }}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
outputs:
|
||||||
|
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
|
||||||
|
extension: '.exe'
|
||||||
|
- os: windows
|
||||||
|
arch: amd64
|
||||||
|
extension: '.exe'
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.14
|
||||||
|
|
||||||
|
- 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 ./...
|
||||||
|
|
||||||
|
- name: Upload release assets
|
||||||
|
id: upload-release-asset
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
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_content_type: application/octet-stream
|
||||||
|
|
42
.travis.yml
42
.travis.yml
|
@ -1,42 +0,0 @@
|
||||||
language: go
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- go: 1.x
|
|
||||||
env: LATEST=true
|
|
||||||
- go: 1.9.x
|
|
||||||
- go: 1.10.x
|
|
||||||
- go: 1.11.x
|
|
||||||
- go: 1.12.x
|
|
||||||
- go: 1.13.x
|
|
||||||
- go: tip
|
|
||||||
allow_failures:
|
|
||||||
- go: tip
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- go get github.com/mitchellh/gox
|
|
||||||
|
|
||||||
install:
|
|
||||||
- export GO111MODULE=on
|
|
||||||
- go get -t -v ./...
|
|
||||||
|
|
||||||
script:
|
|
||||||
- go test -v -race ./...
|
|
||||||
- if [ "${LATEST}" = "true" ]; then gox -ldflags "-s -w" -os="linux darwin windows" -arch="386 amd64" -osarch="linux/arm" -output="pihole_exporter-{{.OS}}-{{.Arch}}" -verbose ./...; fi
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
provider: releases
|
|
||||||
skip_cleanup: true
|
|
||||||
api_key:
|
|
||||||
secure: $GITHUB_TOKEN
|
|
||||||
file:
|
|
||||||
- pihole_exporter-windows-386.exe
|
|
||||||
- pihole_exporter-windows-amd64.exe
|
|
||||||
- pihole_exporter-darwin-386
|
|
||||||
- pihole_exporter-darwin-amd64
|
|
||||||
- pihole_exporter-linux-386
|
|
||||||
- pihole_exporter-linux-amd64
|
|
||||||
- pihole_exporter-linux-arm
|
|
||||||
on:
|
|
||||||
repo: eko/pihole-exporter
|
|
||||||
tags: true
|
|
||||||
condition: $LATEST = true
|
|
Loading…
Reference in a new issue