chore(ci): update golangci-lint action to v8 and remove unused steps #3
This file contains hidden or 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: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
GO_VERSION: '1.25' | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v8 | |
with: | |
version: latest | |
args: --timeout=5m | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Download dependencies | |
run: go mod download | |
- name: Verify dependencies | |
run: go mod verify | |
- name: Run Go tests (JSON + coverage) | |
run: | | |
go test -json -coverprofile=coverage.out -covermode=atomic ./... | tee test2json.log | |
- name: Convert test output to CTRF | |
run: | | |
go run github.com/ctrf-io/go-ctrf-json-reporter/cmd/go-ctrf-json-reporter@latest \ | |
--input test2json.log --output ctrf/tests.json | |
- name: Publish Test Report | |
uses: ctrf-io/github-test-reporter@v1 | |
if: always() | |
with: | |
report-path: './ctrf/tests.json' | |
github-report: true | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
needs: [lint, test] | |
strategy: | |
matrix: | |
goos: [linux, windows, darwin] | |
goarch: [amd64, arm64] | |
exclude: | |
- goos: windows | |
goarch: arm64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Build binary | |
env: | |
GOOS: ${{ matrix.goos }} | |
GOARCH: ${{ matrix.goarch }} | |
run: | | |
mkdir -p dist | |
binary_name="md2notion" | |
if [ "$GOOS" = "windows" ]; then | |
binary_name="${binary_name}.exe" | |
fi | |
go build -ldflags='-s -w' -o "dist/${binary_name}-${GOOS}-${GOARCH}" ./cmd/notion-md | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-${{ matrix.goos }}-${{ matrix.goarch }} | |
path: dist/ | |
security: | |
name: Security | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Run Gosec Security Scanner | |
uses: securego/gosec@master | |
with: | |
args: ./... |