mirror of
https://github.com/ebrianne/adguard-exporter.git
synced 2025-01-03 10:37:33 +01:00
b591f09028
Added docker-compose method and secrets Added master action and added arm64 build Added badge and updated workflows Removed gox in workflow, added upx Fixes conditional if in UPX workflow
110 lines
2.7 KiB
YAML
110 lines
2.7 KiB
YAML
name: Build/Push (master)
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'master'
|
|
pull_request:
|
|
branches:
|
|
- 'master'
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-go@v1
|
|
with:
|
|
go-version: 1.14
|
|
|
|
- name: Install go dependencies
|
|
run: go get -t -v ./...
|
|
|
|
- name: Run go tests
|
|
run: go test -v -cover -race ./...
|
|
|
|
build-docker:
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Build and push docker image
|
|
id: docker_build
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64
|
|
push: true
|
|
tags: ebrianne/adguard-exporter:latest
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: linux
|
|
arch: 386
|
|
- os: linux
|
|
arch: amd64
|
|
- os: linux
|
|
arch: arm
|
|
- os: linux
|
|
arch: arm64
|
|
- os: darwin
|
|
arch: 386
|
|
- os: darwin
|
|
arch: amd64
|
|
- os: freebsd
|
|
arch: 386
|
|
- os: freebsd
|
|
arch: amd64
|
|
- os: windows
|
|
arch: 386
|
|
extension: '.exe'
|
|
- os: windows
|
|
arch: amd64
|
|
extension: '.exe'
|
|
|
|
steps:
|
|
- name: Checkout
|
|
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 the needed vendors
|
|
run: GO111MODULE=on go mod vendor
|
|
|
|
- name: Create release (${{ matrix.os }}-${{ matrix.arch }})
|
|
run: CGO_ENABLED=0 GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -a -ldflags '-s -w' -o adguard_exporter-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }} ./
|
|
|
|
- if: matrix.os != 'freebsd'
|
|
name: Run UPX (${{ matrix.os }}-${{ matrix.arch }})
|
|
uses: crazy-max/ghaction-upx@v1
|
|
with:
|
|
version: latest
|
|
file: ./adguard_exporter-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }}
|
|
args: -fq --brute |