2020-05-05 08:47:24 +02:00
|
|
|
name: Build/Push (master)
|
2020-04-04 06:34:00 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2020-05-05 13:32:37 +02:00
|
|
|
branches:
|
|
|
|
- '*'
|
2020-04-04 06:34:00 +02:00
|
|
|
pull_request:
|
2020-05-05 13:32:37 +02:00
|
|
|
branches:
|
|
|
|
- '*'
|
2020-04-04 06:34:00 +02:00
|
|
|
|
|
|
|
jobs:
|
2020-05-05 08:47:24 +02:00
|
|
|
test:
|
2020-04-04 06:34:00 +02:00
|
|
|
runs-on: ubuntu-latest
|
2020-05-05 08:47:24 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
go_version: [ '1.12', '1.13', '1.14' ]
|
2020-04-04 06:34:00 +02:00
|
|
|
steps:
|
2020-05-05 08:47:24 +02:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-go@v1
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go_version }}
|
2020-05-05 13:32:37 +02:00
|
|
|
|
|
|
|
- name: Install go dependencies
|
|
|
|
run: go get -t -v ./...
|
|
|
|
|
|
|
|
- name: Run go tests
|
|
|
|
run: go test -v -cover -race ./...
|
2020-05-04 21:02:27 +02:00
|
|
|
|
2020-05-05 08:47:24 +02:00
|
|
|
build:
|
2020-05-04 21:02:27 +02:00
|
|
|
runs-on: ubuntu-latest
|
2020-05-05 08:47:24 +02:00
|
|
|
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
|
|
|
|
|
2020-05-04 21:02:27 +02:00
|
|
|
steps:
|
2020-05-05 08:47:24 +02:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
2020-05-05 13:32:37 +02:00
|
|
|
- name: Build and push docker image (${{ matrix.os }}/${{ matrix.arch }})
|
2020-05-05 08:47:24 +02:00
|
|
|
uses: docker/build-push-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
repository: ekofr/pihole-exporter
|
|
|
|
tags: ${{ matrix.arch }}
|
|
|
|
build_args: OS=${{ matrix.os }},ARCH=${{ matrix.arch }},IMAGE=${{ matrix.image }}
|
|
|
|
|