ci: run golangci-lint #17
Workflow file for this run
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: Tests | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ['ubuntu-latest', 'macos-latest'] | |
go-version: ['stable', 'oldstable'] | |
env: | |
GOEXPERIMENT: cgocheck2 | |
name: Go (${{ matrix.os }}, Go ${{ matrix.go-version }}) | |
steps: | |
- | |
uses: actions/checkout@v4 | |
- | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- | |
name: Fetch fswatch version | |
id: fswatch-version | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: echo "version=$(gh release view --repo emcrisostomo/fswatch --json tagName --jq .tagName)" >> "$GITHUB_OUTPUT" | |
- | |
name: Cache libfswatch | |
id: libfswatch | |
uses: actions/cache@v4 | |
with: | |
path: fswatch/target | |
key: ${{ runner.os }}-${{ steps.fswatch-version.outputs.version }}-fswatch | |
- | |
name: Compile libfswatch | |
if: steps.libfswatch.outputs.cache-hit != 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
mkdir fswatch/ | |
gh release download "${{ steps.fswatch-version.outputs.version }}" --repo emcrisostomo/fswatch --pattern 'fswatch-*.tar.gz' --output - | tar -xz -C fswatch --strip-components=1 | |
cd fswatch/ | |
./configure --prefix=$(pwd)/target | |
make -j"$(getconf _NPROCESSORS_ONLN)" | |
make install | |
- | |
name: Run tests | |
env: | |
PKG_CONFIG_PATH: ${{ github.workspace }}/fswatch/target/lib/pkgconfig | |
LD_LIBRARY_PATH: ${{ github.workspace }}/fswatch/target/lib | |
DYLD_LIBRARY_PATH: ${{ github.workspace }}/fswatch/target/lib | |
run: go test -race | |
- | |
name: Lint | |
if: matrix.go-version == 'stable' && matrix.os == 'ubuntu-latest' | |
uses: golangci/golangci-lint-action@v6 |