Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]

jobs:
ci:
name: CI Check
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.23.x

- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.4.0
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH

- name: Install tools
run: make tools

- name: Run CI
run: make ci

format-check:
name: Format Check
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.23.x

- name: Check formatting
run: |
make fmt
if [ -n "$(git status --porcelain)" ]; then
echo "Code is not formatted. Please run 'make fmt'"
git diff
exit 1
fi
63 changes: 57 additions & 6 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,72 @@ jobs:
test:
strategy:
matrix:
go-version: [1.22.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
go-version: 1.23.x

- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: make deps

- name: Install tools
run: make tools

- name: Build
run: go build -v ./...
run: make build

- name: Run go vet
run: make vet

- name: Test
run: go test ./...
run: make test

coverage:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push'

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.23.x

- name: Install dependencies
run: make deps

- name: Generate coverage report
run: make coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.out
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

verify-mod:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.23.x

- name: Check go.mod
run: make check-mod
41 changes: 39 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
pull_request:
branches: [ main, master ]

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read

jobs:
golangci:
name: lint
Expand All @@ -15,5 +20,37 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: golangci-lint
uses: golangci/golangci-lint-action@v8
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.23.x

- name: Install golangci-lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.4.0
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH

- name: Run golangci-lint
run: |
# For PRs, only check new issues
if [ "${{ github.event_name }}" = "pull_request" ]; then
golangci-lint run --new-from-rev=${{ github.event.pull_request.base.sha }}
else
golangci-lint run
fi
env:
# Ensure colored output for better readability
FORCE_COLOR: true

# Optional: if set to true, then all caching functionality will be completely disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true, then the action won't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true, then the action won't cache or restore ~/.cache/go-build.
# skip-build-cache: true

# Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
# install-mode: "goinstall"
Loading