Skip to content

Merge pull request #122 from babarot/babarot/refactor-file-storage-cl… #96

Merge pull request #122 from babarot/babarot/refactor-file-storage-cl…

Merge pull request #122 from babarot/babarot/refactor-file-storage-cl… #96

Workflow file for this run

name: Go
on:
push:
branches:
- main
pull_request:
paths:
- '**/*.go'
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v7
with:
version: latest
build:
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
runs-on: ${{ matrix.os }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
pull-requests: write
actions: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Run tests
if: runner.os != 'Linux'
run: go test ./...
- name: Run tests with coverage
if: runner.os == 'Linux'
run: |
COVERPKG=$(go list ./... | grep -v -E '(/cli|/ui|/utils/log)' | paste -sd, -)
go test ./... -coverprofile=coverage.out -covermode=count -coverpkg="$COVERPKG"
- name: Run octocov
if: runner.os == 'Linux'
uses: k1LoW/octocov-action@73d561f65d59e66899ed5c87e4621a913b5d5c20 # v1.5.0
- name: Extract coverage
if: runner.os == 'Linux' && github.ref == 'refs/heads/main'
run: |
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV
- name: Update coverage badge
if: runner.os == 'Linux' && github.ref == 'refs/heads/main'
uses: Schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 09e491ead047d9430c6b40cc7d4107c8
filename: gomi-coverage.json
label: coverage
message: ${{ env.COVERAGE }}%
valColorRange: ${{ env.COVERAGE }}
minColorRange: 0
maxColorRange: 100