Merge pull request #4 from wiremind/feat/add-dry-run-and-fix-notion-b… #17
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: | |
pull_request: | |
workflow_call: | |
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 | |
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: ./... |