2020-11-01 11:23:39 +00:00
|
|
|
---
|
|
|
|
name: build
|
|
|
|
|
|
|
|
# Trigger the workflow on push or pull request
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- '*'
|
|
|
|
tags:
|
|
|
|
- '*'
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
timeout-minutes: 60
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
job_name: ['linux', 'mac', 'windows_amd64']
|
|
|
|
|
|
|
|
include:
|
|
|
|
- job_name: linux
|
|
|
|
os: ubuntu-latest
|
|
|
|
|
|
|
|
- job_name: mac
|
2023-02-14 17:12:21 +00:00
|
|
|
os: macOS-11
|
2020-11-01 11:23:39 +00:00
|
|
|
|
|
|
|
- job_name: windows_amd64
|
|
|
|
os: windows-latest
|
2021-12-17 22:44:42 +00:00
|
|
|
|
2020-11-01 11:23:39 +00:00
|
|
|
name: ${{ matrix.job_name }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-03-07 10:28:29 +00:00
|
|
|
uses: actions/checkout@v3
|
2020-11-01 11:23:39 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Install Go
|
2023-03-23 19:13:59 +00:00
|
|
|
uses: actions/setup-go@v4
|
2020-11-01 11:23:39 +00:00
|
|
|
with:
|
2021-12-17 22:44:42 +00:00
|
|
|
go-version: ^1.17
|
2020-11-01 16:24:08 +00:00
|
|
|
|
2020-11-01 11:23:39 +00:00
|
|
|
- name: Install Libraries on Linux
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
sudo modprobe fuse
|
|
|
|
sudo chmod 666 /dev/fuse
|
|
|
|
sudo chown root:$USER /etc/fuse.conf
|
|
|
|
sudo apt-get install fuse libfuse-dev rpm pkg-config
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
|
|
|
|
- name: Install Libraries on macOS
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
brew update
|
2020-12-24 18:54:27 +00:00
|
|
|
brew install --cask osxfuse
|
2023-02-14 17:12:21 +00:00
|
|
|
if: matrix.os == 'macOS-11'
|
2020-11-01 11:23:39 +00:00
|
|
|
|
|
|
|
- name: Install Libraries on Windows
|
|
|
|
shell: powershell
|
|
|
|
run: |
|
|
|
|
$ProgressPreference = 'SilentlyContinue'
|
|
|
|
choco install -y winfsp zip
|
|
|
|
echo "CPATH=C:\Program Files\WinFsp\inc\fuse;C:\Program Files (x86)\WinFsp\inc\fuse" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
|
|
if ($env:GOARCH -eq "386") {
|
|
|
|
choco install -y mingw --forcex86 --force
|
|
|
|
echo "C:\\ProgramData\\chocolatey\\lib\\mingw\\tools\\install\\mingw32\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
|
|
}
|
|
|
|
# Copy mingw32-make.exe to make.exe so the same command line
|
|
|
|
# can be used on Windows as on macOS and Linux
|
|
|
|
$path = (get-command mingw32-make.exe).Path
|
|
|
|
Copy-Item -Path $path -Destination (Join-Path (Split-Path -Path $path) 'make.exe')
|
|
|
|
if: matrix.os == 'windows-latest'
|
|
|
|
|
|
|
|
- name: Print Go version and environment
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
printf "Using go at: $(which go)\n"
|
|
|
|
printf "Go version: $(go version)\n"
|
|
|
|
printf "\n\nGo environment:\n\n"
|
|
|
|
go env
|
|
|
|
printf "\n\nSystem environment:\n\n"
|
|
|
|
env
|
|
|
|
|
|
|
|
- name: Go module cache
|
2023-03-23 19:14:17 +00:00
|
|
|
uses: actions/cache@v3.3.1
|
2020-11-01 11:23:39 +00:00
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
|
|
|
|
2020-11-14 13:00:56 +00:00
|
|
|
- name: Run tests
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2021-12-17 22:44:42 +00:00
|
|
|
make test-race
|
2020-11-14 13:00:56 +00:00
|
|
|
- name: Convert coverage.out to coverage.lcov
|
2022-10-08 16:26:13 +00:00
|
|
|
uses: jandelgado/gcov2lcov-action@v1.0.9
|
2020-11-14 13:00:56 +00:00
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
- name: Coveralls
|
2023-07-19 09:57:46 +00:00
|
|
|
uses: coverallsapp/github-action@v2.2.1
|
2020-11-14 13:00:56 +00:00
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
path-to-lcov: coverage.lcov
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
|
2020-11-01 11:23:39 +00:00
|
|
|
- name: Build
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
make build
|
2020-11-14 13:00:56 +00:00
|
|
|
|
2020-11-01 11:23:39 +00:00
|
|
|
- name: Upload artifacts
|
2022-10-08 16:30:20 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2020-11-01 11:23:39 +00:00
|
|
|
with:
|
|
|
|
if-no-files-found: error
|
|
|
|
name: build-${{ matrix.job_name }}
|
|
|
|
path: bin/*
|
2021-12-01 18:59:21 +00:00
|
|
|
|
2020-11-01 11:23:39 +00:00
|
|
|
- name: Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
2020-12-24 18:54:27 +00:00
|
|
|
files: bin/*
|