build(task): simplify and make more DRY #53
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
env: | |
GO_VERSION: '1.21' | |
TASK_VERSION: 'v3.28' | |
jobs: | |
bsd: | |
runs-on: ${{ matrix.os.host }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- name: freebsd | |
architecture: x86-64 | |
version: '14.1' | |
host: ubuntu-latest | |
- name: openbsd | |
architecture: x86-64 | |
version: '7.5' | |
host: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Run CI script on ${{ matrix.os.name }} | |
uses: cross-platform-actions/[email protected] | |
with: | |
operating_system: ${{ matrix.os.name }} | |
architecture: ${{ matrix.os.architecture }} | |
version: ${{ matrix.os.version }} | |
shell: bash | |
run: | | |
case "$(uname)" in | |
FreeBSD) | |
sudo pkg install -y go | |
;; | |
NetBSD) | |
sudo pkgin -y install go | |
for bin in /usr/pkg/bin/go1*; do | |
src=$bin | |
done | |
sudo ln -s "$src" /usr/pkg/bin/go | |
;; | |
OpenBSD) | |
sudo pkg_add -I go | |
;; | |
esac | |
PATH=$(go env GOPATH)/bin:$PATH | |
go install 'github.com/go-task/task/v3/cmd/task@${{ env.TASK_VERSION }}' | |
task | |
linux: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Install Task | |
run: | | |
go install github.com/go-task/task/v3/cmd/task@"$TASK_VERSION" | |
- name: Build and test | |
run: | | |
task | |
mac: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Install Task | |
run: | | |
go install github.com/go-task/task/v3/cmd/task@"$TASK_VERSION" | |
- name: Build and test | |
run: | | |
task | |
windows: | |
runs-on: windows-latest | |
steps: | |
- name: 'Disable `autocrlf` in Git' | |
run: git config --global core.autocrlf false | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Install Task | |
run: | | |
go install github.com/go-task/task/v3/cmd/task@$env:TASK_VERSION | |
- name: Build and test | |
run: | | |
task | |
- name: Upload Windows binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: memsparkline-windows-amd64 | |
path: | | |
memsparkline.exe |