adguard-exporter/.github/workflows/ci.yml
Jason Ross 066fbc22c1
ci(GitHub): update tooling and dependancies (#3)
* doc(readme): replace links from ebrianne to csfreak

ebrianne's repo is no longer available

* ci(GitHub): replace master with main

* ci(GitHub): update release workflow versions

* Update go.mod

* build(docker): change dockerfile to go 1.21

* doc(readme): add attribution

* package(main): rename

* package(main): rename

* package(adguard): rename

* build(depenancies): update go dependancies

* ci(github): remove deprecated versions

* ci(github): upgrade actions

* ci(github): typo

* ci(github): adjust build and remove docker actions

* doc(readme): update links

* doc(readme): update links
2023-09-15 11:26:38 -05:00

99 lines
2.2 KiB
YAML

name: Test/Build (main)
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
jobs:
changes:
runs-on: ubuntu-latest
outputs:
go: ${{ steps.filter.outputs.go }}
charts: ${{ steps.filter.outputs.charts }}
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
token: ${{ secrets.GITHUB_TOKEN }}
filters: |
go:
- '**/*.go'
- 'go.mod'
- 'go.sum'
test:
runs-on: ubuntu-latest
needs: changes
if: |
(needs.changes.outputs.go == 'true')
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Install go dependencies
run: go mod download
- name: Run go vet
run: go vet -v ./...
- name: Run go tests
run: go test -v -cover -race ./...
build:
runs-on: ubuntu-latest
needs: [changes, test]
if: |
(needs.changes.outputs.go == 'true')
strategy:
matrix:
include:
- os: linux
arch: 386
- os: linux
arch: amd64
- os: linux
arch: arm
- os: linux
arch: arm64
- os: darwin
arch: amd64
- os: freebsd
arch: 386
- os: freebsd
arch: amd64
- os: windows
arch: 386
extension: ".exe"
- os: windows
arch: amd64
extension: ".exe"
- os: darwin
arch: amd64
- os: darwin
arch: arm64
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Download go dependencies
run: go mod download
- 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 }} ./