2022-11-07 08:49:05 +03:00
|
|
|
name: Main pipeline
|
2022-12-17 08:04:22 +03:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
paths-ignore:
|
|
|
|
- '**.md'
|
2022-12-17 08:31:22 +03:00
|
|
|
- 'sq.json' # This is updated by scoop; no need to run a new build
|
2022-11-07 08:49:05 +03:00
|
|
|
|
2022-12-31 06:20:54 +03:00
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
|
|
workflow_dispatch:
|
|
|
|
|
2022-11-07 08:49:05 +03:00
|
|
|
env:
|
|
|
|
GO_VERSION: 1.19.3
|
2022-12-25 09:57:41 +03:00
|
|
|
GORELEASER_VERSION: 1.13.1
|
2022-12-25 07:40:46 +03:00
|
|
|
GOLANGCI_LINT_VERSION: v1.50.1
|
2020-03-03 13:19:04 +03:00
|
|
|
|
2020-08-06 20:58:47 +03:00
|
|
|
jobs:
|
2022-12-25 07:20:04 +03:00
|
|
|
|
2022-12-25 10:16:21 +03:00
|
|
|
go-test-linux:
|
|
|
|
# Linux is the core test platform. We only execute on macOS/Windows
|
|
|
|
# when it's time to publish.
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: go build -v ./...
|
|
|
|
|
|
|
|
- name: Test
|
|
|
|
run: go test -v ./...
|
|
|
|
|
|
|
|
go-test-others:
|
|
|
|
# MacOS and (particularly) Windows take significantly
|
|
|
|
# longer to build/test. So, we're only running on these OSes
|
|
|
|
# when it's time to publish/release.
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
2020-08-06 20:58:47 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-12-25 10:16:21 +03:00
|
|
|
os: [ macos-12, windows-2022 ]
|
2020-08-06 20:58:47 +03:00
|
|
|
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
2020-03-03 13:19:04 +03:00
|
|
|
steps:
|
2022-11-07 08:49:05 +03:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v3
|
2020-08-06 20:58:47 +03:00
|
|
|
with:
|
2022-11-07 08:49:05 +03:00
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: go build -v ./...
|
2020-08-06 20:58:47 +03:00
|
|
|
|
2022-11-07 08:49:05 +03:00
|
|
|
- name: Test
|
|
|
|
run: go test -v ./...
|
|
|
|
|
|
|
|
|
2022-12-25 07:20:04 +03:00
|
|
|
go-lint:
|
2022-12-25 10:16:21 +03:00
|
|
|
runs-on: ubuntu-22.04
|
2022-12-25 07:20:04 +03:00
|
|
|
steps:
|
2022-12-25 07:24:17 +03:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v3
|
2022-12-25 07:20:04 +03:00
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2022-12-25 07:24:17 +03:00
|
|
|
|
2022-12-25 07:20:04 +03:00
|
|
|
- name: golangci-lint
|
|
|
|
uses: golangci/golangci-lint-action@v3
|
|
|
|
with:
|
|
|
|
version: ${{ env.GOLANGCI_LINT_VERSION }}
|
|
|
|
|
|
|
|
|
2022-11-07 08:49:05 +03:00
|
|
|
build-binaries-darwin:
|
2022-12-17 08:22:58 +03:00
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
2022-11-07 08:49:05 +03:00
|
|
|
runs-on: macos-12
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
|
|
|
|
- name: GoReleaser (build darwin binaries)
|
|
|
|
uses: goreleaser/goreleaser-action@v3
|
|
|
|
with:
|
|
|
|
distribution: goreleaser-pro
|
|
|
|
version: ${{ env.GORELEASER_VERSION }}
|
|
|
|
args: build --skip-validate --rm-dist -f .goreleaser-darwin.yml
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
|
|
|
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
|
|
|
|
|
|
|
- name: Upload assets (darwin)
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: dist-darwin
|
|
|
|
path: dist-darwin
|
|
|
|
|
|
|
|
build-binaries-linux-amd64:
|
2022-12-17 08:22:58 +03:00
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
2022-11-07 08:49:05 +03:00
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
|
|
|
|
- name: GoReleaser (build linux-amd64 binaries)
|
|
|
|
uses: goreleaser/goreleaser-action@v3
|
|
|
|
with:
|
|
|
|
distribution: goreleaser-pro
|
|
|
|
version: ${{ env.GORELEASER_VERSION }}
|
|
|
|
args: build --skip-validate --rm-dist -f .goreleaser-linux-amd64.yml
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
|
|
|
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
|
|
|
|
|
|
|
- name: Upload assets (linux-amd64)
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: dist-linux-amd64
|
|
|
|
path: dist-linux
|
|
|
|
|
|
|
|
build-binaries-linux-arm64:
|
2022-12-17 08:22:58 +03:00
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
2022-11-07 08:49:05 +03:00
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2020-08-06 20:58:47 +03:00
|
|
|
|
2022-11-07 08:49:05 +03:00
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v3
|
2020-08-09 00:23:30 +03:00
|
|
|
with:
|
2022-11-07 08:49:05 +03:00
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2020-08-09 00:23:30 +03:00
|
|
|
|
2022-11-07 08:49:05 +03:00
|
|
|
- name: Install toolchain dependencies
|
2020-08-06 20:58:47 +03:00
|
|
|
run: |
|
2022-11-07 08:49:05 +03:00
|
|
|
sudo apt update
|
|
|
|
sudo apt install -y gcc-aarch64-linux-gnu
|
2020-08-06 20:58:47 +03:00
|
|
|
|
2022-11-07 08:49:05 +03:00
|
|
|
- name: GoReleaser (build linux-arm64 binaries)
|
|
|
|
uses: goreleaser/goreleaser-action@v3
|
|
|
|
with:
|
|
|
|
distribution: goreleaser-pro
|
|
|
|
version: ${{ env.GORELEASER_VERSION }}
|
|
|
|
args: build --skip-validate --rm-dist -f .goreleaser-linux-arm64.yml
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
|
|
|
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
2020-08-06 20:58:47 +03:00
|
|
|
|
2022-11-07 08:49:05 +03:00
|
|
|
- name: Upload assets (linux-arm64)
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: dist-linux-arm64
|
|
|
|
path: dist-linux
|
|
|
|
|
|
|
|
|
|
|
|
build-binaries-windows:
|
2022-12-17 08:22:58 +03:00
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
2022-11-07 08:49:05 +03:00
|
|
|
runs-on: windows-2022
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
|
|
|
|
- name: GoReleaser (build windows binaries)
|
|
|
|
uses: goreleaser/goreleaser-action@v3
|
|
|
|
with:
|
|
|
|
distribution: goreleaser-pro
|
|
|
|
version: ${{ env.GORELEASER_VERSION }}
|
|
|
|
args: build --skip-validate --rm-dist -f .goreleaser-windows.yml
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
|
|
|
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
|
|
|
|
|
|
|
|
|
|
|
- name: Upload assets (windows)
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: dist-windows
|
|
|
|
path: dist-windows
|
|
|
|
|
|
|
|
publish:
|
|
|
|
runs-on: ubuntu-22.04
|
2022-12-25 10:08:04 +03:00
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
needs:
|
|
|
|
- go-lint
|
2022-12-25 10:16:21 +03:00
|
|
|
- go-test-linux
|
|
|
|
- go-test-others
|
2022-12-25 10:08:04 +03:00
|
|
|
- build-binaries-darwin
|
|
|
|
- build-binaries-linux-amd64
|
|
|
|
- build-binaries-linux-arm64
|
|
|
|
- build-binaries-windows
|
2022-11-07 08:49:05 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
|
|
|
|
- name: Download darwin artifacts
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: dist-darwin
|
|
|
|
path: dist-darwin
|
|
|
|
|
|
|
|
- name: Download linux-amd64 artifacts
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: dist-linux-amd64
|
|
|
|
path: dist-linux
|
|
|
|
|
|
|
|
- name: Download linux-arm64 artifacts
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: dist-linux-arm64
|
|
|
|
path: dist-linux
|
|
|
|
|
|
|
|
- name: Download windows artifacts
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: dist-windows
|
|
|
|
path: dist-windows
|
|
|
|
|
|
|
|
- name: GoReleaser (publish)
|
|
|
|
uses: goreleaser/goreleaser-action@v3
|
|
|
|
with:
|
|
|
|
distribution: goreleaser-pro
|
|
|
|
version: ${{ env.GORELEASER_VERSION }}
|
|
|
|
args: release -f .goreleaser.yml
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
|
|
|
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
|
|
|
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
|
2022-12-30 01:00:45 +03:00
|
|
|
AUR_PRIVATE_KEY: ${{ secrets.AUR_PRIVATE_KEY }}
|
2022-12-31 08:58:08 +03:00
|
|
|
|
|
|
|
call-test-install:
|
|
|
|
needs: publish
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
uses: ./.github/workflows/test-install.yml
|