mirror of
https://github.com/kjanat/articulate-parser.git
synced 2026-01-16 08:22:09 +01:00
chore: enable CGO for race detection, update deps, drop old Go versions
This commit is contained in:
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@ -38,9 +38,6 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go:
|
go:
|
||||||
- 1.21.x
|
|
||||||
- 1.22.x
|
|
||||||
- 1.23.x
|
|
||||||
- 1.24.x
|
- 1.24.x
|
||||||
- 1.25.x
|
- 1.25.x
|
||||||
|
|
||||||
|
|||||||
70
Taskfile.yml
70
Taskfile.yml
@ -1,7 +1,7 @@
|
|||||||
# yaml-language-server: $schema=https://taskfile.dev/schema.json
|
# yaml-language-server: $schema=https://taskfile.dev/schema.json
|
||||||
# Articulate Parser - Task Automation
|
# Articulate Parser - Task Automation
|
||||||
# https://taskfile.dev
|
# https://taskfile.dev
|
||||||
version: '3'
|
version: "3"
|
||||||
|
|
||||||
# Global output settings
|
# Global output settings
|
||||||
output: prefixed
|
output: prefixed
|
||||||
@ -47,11 +47,11 @@ vars:
|
|||||||
|
|
||||||
# Environment variables
|
# Environment variables
|
||||||
env:
|
env:
|
||||||
CGO_ENABLED: '{{.CGO_ENABLED}}'
|
CGO_ENABLED: "{{.CGO_ENABLED}}"
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
|
|
||||||
# Load .env files if present
|
# Load .env files if present
|
||||||
dotenv: ['.env', '.env.local']
|
dotenv: [".env", ".env.local"]
|
||||||
|
|
||||||
# Task definitions
|
# Task definitions
|
||||||
tasks:
|
tasks:
|
||||||
@ -69,12 +69,12 @@ tasks:
|
|||||||
interactive: true
|
interactive: true
|
||||||
watch: true
|
watch: true
|
||||||
sources:
|
sources:
|
||||||
- '**/*.go'
|
- "**/*.go"
|
||||||
- go.mod
|
- go.mod
|
||||||
- go.sum
|
- go.sum
|
||||||
cmds:
|
cmds:
|
||||||
- task: build
|
- task: build
|
||||||
- '{{.OUTPUT_DIR}}/{{.APP_NAME}}{{.EXE_EXT}} --help'
|
- "{{.OUTPUT_DIR}}/{{.APP_NAME}}{{.EXE_EXT}} --help"
|
||||||
|
|
||||||
# Build tasks
|
# Build tasks
|
||||||
build:
|
build:
|
||||||
@ -82,14 +82,14 @@ tasks:
|
|||||||
aliases: [b]
|
aliases: [b]
|
||||||
deps: [clean-bin]
|
deps: [clean-bin]
|
||||||
sources:
|
sources:
|
||||||
- '**/*.go'
|
- "**/*.go"
|
||||||
- go.mod
|
- go.mod
|
||||||
- go.sum
|
- go.sum
|
||||||
generates:
|
generates:
|
||||||
- '{{.OUTPUT_DIR}}/{{.APP_NAME}}{{.EXE_EXT}}'
|
- "{{.OUTPUT_DIR}}/{{.APP_NAME}}{{.EXE_EXT}}"
|
||||||
cmds:
|
cmds:
|
||||||
- task: mkdir
|
- task: mkdir
|
||||||
vars: { DIR: '{{.OUTPUT_DIR}}' }
|
vars: { DIR: "{{.OUTPUT_DIR}}" }
|
||||||
- go build {{.GO_FLAGS}} -ldflags="{{.LDFLAGS}}" -o {{.OUTPUT_DIR}}/{{.APP_NAME}}{{.EXE_EXT}} {{.MAIN_FILE}}
|
- go build {{.GO_FLAGS}} -ldflags="{{.LDFLAGS}}" -o {{.OUTPUT_DIR}}/{{.APP_NAME}}{{.EXE_EXT}} {{.MAIN_FILE}}
|
||||||
method: checksum
|
method: checksum
|
||||||
|
|
||||||
@ -99,25 +99,25 @@ tasks:
|
|||||||
deps: [clean-bin]
|
deps: [clean-bin]
|
||||||
cmds:
|
cmds:
|
||||||
- task: mkdir
|
- task: mkdir
|
||||||
vars: { DIR: '{{.OUTPUT_DIR}}' }
|
vars: { DIR: "{{.OUTPUT_DIR}}" }
|
||||||
- for:
|
- for:
|
||||||
matrix:
|
matrix:
|
||||||
GOOS: [linux, darwin, windows]
|
GOOS: [linux, darwin, windows]
|
||||||
GOARCH: [amd64, arm64]
|
GOARCH: [amd64, arm64]
|
||||||
task: build:platform
|
task: build:platform
|
||||||
vars:
|
vars:
|
||||||
TARGET_GOOS: '{{.ITEM.GOOS}}'
|
TARGET_GOOS: "{{.ITEM.GOOS}}"
|
||||||
TARGET_GOARCH: '{{.ITEM.GOARCH}}'
|
TARGET_GOARCH: "{{.ITEM.GOARCH}}"
|
||||||
- echo "Built binaries for all platforms in {{.OUTPUT_DIR}}/"
|
- echo "Built binaries for all platforms in {{.OUTPUT_DIR}}/"
|
||||||
|
|
||||||
build:platform:
|
build:platform:
|
||||||
internal: true
|
internal: true
|
||||||
vars:
|
vars:
|
||||||
TARGET_EXT: '{{if eq .TARGET_GOOS "windows"}}.exe{{end}}'
|
TARGET_EXT: '{{if eq .TARGET_GOOS "windows"}}.exe{{end}}'
|
||||||
OUTPUT_FILE: '{{.OUTPUT_DIR}}/{{.APP_NAME}}-{{.TARGET_GOOS}}-{{.TARGET_GOARCH}}{{.TARGET_EXT}}'
|
OUTPUT_FILE: "{{.OUTPUT_DIR}}/{{.APP_NAME}}-{{.TARGET_GOOS}}-{{.TARGET_GOARCH}}{{.TARGET_EXT}}"
|
||||||
env:
|
env:
|
||||||
GOOS: '{{.TARGET_GOOS}}'
|
GOOS: "{{.TARGET_GOOS}}"
|
||||||
GOARCH: '{{.TARGET_GOARCH}}'
|
GOARCH: "{{.TARGET_GOARCH}}"
|
||||||
cmds:
|
cmds:
|
||||||
- echo "Building {{.OUTPUT_FILE}}..."
|
- echo "Building {{.OUTPUT_FILE}}..."
|
||||||
- go build {{.GO_FLAGS}} -ldflags="{{.LDFLAGS}}" -o "{{.OUTPUT_FILE}}" {{.MAIN_FILE}}
|
- go build {{.GO_FLAGS}} -ldflags="{{.LDFLAGS}}" -o "{{.OUTPUT_FILE}}" {{.MAIN_FILE}}
|
||||||
@ -134,6 +134,8 @@ tasks:
|
|||||||
test:
|
test:
|
||||||
desc: Run all tests
|
desc: Run all tests
|
||||||
aliases: [t]
|
aliases: [t]
|
||||||
|
env:
|
||||||
|
CGO_ENABLED: 1
|
||||||
cmds:
|
cmds:
|
||||||
- go test {{.GO_FLAGS}} -race -timeout {{.TEST_TIMEOUT}} ./...
|
- go test {{.GO_FLAGS}} -race -timeout {{.TEST_TIMEOUT}} ./...
|
||||||
|
|
||||||
@ -141,9 +143,11 @@ tasks:
|
|||||||
desc: Run tests with coverage report
|
desc: Run tests with coverage report
|
||||||
aliases: [cover, cov]
|
aliases: [cover, cov]
|
||||||
deps: [clean-coverage]
|
deps: [clean-coverage]
|
||||||
|
env:
|
||||||
|
CGO_ENABLED: 1
|
||||||
cmds:
|
cmds:
|
||||||
- task: mkdir
|
- task: mkdir
|
||||||
vars: { DIR: '{{.COVERAGE_DIR}}' }
|
vars: { DIR: "{{.COVERAGE_DIR}}" }
|
||||||
- go test {{.GO_FLAGS}} -race -coverprofile={{.COVERAGE_DIR}}/coverage.out -covermode=atomic -timeout {{.TEST_TIMEOUT}} ./...
|
- go test {{.GO_FLAGS}} -race -coverprofile={{.COVERAGE_DIR}}/coverage.out -covermode=atomic -timeout {{.TEST_TIMEOUT}} ./...
|
||||||
- go tool cover -html={{.COVERAGE_DIR}}/coverage.out -o {{.COVERAGE_DIR}}/coverage.html
|
- go tool cover -html={{.COVERAGE_DIR}}/coverage.out -o {{.COVERAGE_DIR}}/coverage.html
|
||||||
- go tool cover -func={{.COVERAGE_DIR}}/coverage.out
|
- go tool cover -func={{.COVERAGE_DIR}}/coverage.out
|
||||||
@ -152,6 +156,8 @@ tasks:
|
|||||||
test:verbose:
|
test:verbose:
|
||||||
desc: Run tests with verbose output
|
desc: Run tests with verbose output
|
||||||
aliases: [tv]
|
aliases: [tv]
|
||||||
|
env:
|
||||||
|
CGO_ENABLED: 1
|
||||||
cmds:
|
cmds:
|
||||||
- go test -v -race -timeout {{.TEST_TIMEOUT}} ./...
|
- go test -v -race -timeout {{.TEST_TIMEOUT}} ./...
|
||||||
|
|
||||||
@ -160,7 +166,7 @@ tasks:
|
|||||||
aliases: [tw]
|
aliases: [tw]
|
||||||
watch: true
|
watch: true
|
||||||
sources:
|
sources:
|
||||||
- '**/*.go'
|
- "**/*.go"
|
||||||
cmds:
|
cmds:
|
||||||
- task: test
|
- task: test
|
||||||
|
|
||||||
@ -172,6 +178,8 @@ tasks:
|
|||||||
|
|
||||||
test:integration:
|
test:integration:
|
||||||
desc: Run integration tests
|
desc: Run integration tests
|
||||||
|
env:
|
||||||
|
CGO_ENABLED: 1
|
||||||
status:
|
status:
|
||||||
- '{{if eq OS "windows"}}if not exist "main_test.go" exit 1{{else}}test ! -f "main_test.go"{{end}}'
|
- '{{if eq OS "windows"}}if not exist "main_test.go" exit 1{{else}}test ! -f "main_test.go"{{end}}'
|
||||||
cmds:
|
cmds:
|
||||||
@ -352,14 +360,14 @@ tasks:
|
|||||||
internal: true
|
internal: true
|
||||||
cmds:
|
cmds:
|
||||||
- task: rmdir
|
- task: rmdir
|
||||||
vars: { DIR: '{{.OUTPUT_DIR}}' }
|
vars: { DIR: "{{.OUTPUT_DIR}}" }
|
||||||
|
|
||||||
clean-coverage:
|
clean-coverage:
|
||||||
desc: Remove coverage files
|
desc: Remove coverage files
|
||||||
internal: true
|
internal: true
|
||||||
cmds:
|
cmds:
|
||||||
- task: rmdir
|
- task: rmdir
|
||||||
vars: { DIR: '{{.COVERAGE_DIR}}' }
|
vars: { DIR: "{{.COVERAGE_DIR}}" }
|
||||||
|
|
||||||
clean-cache:
|
clean-cache:
|
||||||
desc: Clean Go build and test cache
|
desc: Clean Go build and test cache
|
||||||
@ -410,10 +418,10 @@ tasks:
|
|||||||
requires:
|
requires:
|
||||||
vars: [VERSION]
|
vars: [VERSION]
|
||||||
preconditions:
|
preconditions:
|
||||||
- sh: 'git diff --exit-code'
|
- sh: "git diff --exit-code"
|
||||||
msg: 'Working directory is not clean'
|
msg: "Working directory is not clean"
|
||||||
- sh: 'git diff --cached --exit-code'
|
- sh: "git diff --cached --exit-code"
|
||||||
msg: 'Staging area is not clean'
|
msg: "Staging area is not clean"
|
||||||
cmds:
|
cmds:
|
||||||
- git tag -a v{{.VERSION}} -m "Release v{{.VERSION}}"
|
- git tag -a v{{.VERSION}} -m "Release v{{.VERSION}}"
|
||||||
- echo "Tagged v{{.VERSION}}"
|
- echo "Tagged v{{.VERSION}}"
|
||||||
@ -498,11 +506,11 @@ tasks:
|
|||||||
- '{{if eq OS "windows"}}if not exist "articulate-sample.json" exit 1{{else}}test ! -f "articulate-sample.json"{{end}}'
|
- '{{if eq OS "windows"}}if not exist "articulate-sample.json" exit 1{{else}}test ! -f "articulate-sample.json"{{end}}'
|
||||||
deps: [build]
|
deps: [build]
|
||||||
cmds:
|
cmds:
|
||||||
- '{{.OUTPUT_DIR}}/{{.APP_NAME}}{{.EXE_EXT}} articulate-sample.json md output-demo.md'
|
- "{{.OUTPUT_DIR}}/{{.APP_NAME}}{{.EXE_EXT}} articulate-sample.json md output-demo.md"
|
||||||
- echo "Demo Markdown created{{:}} output-demo.md"
|
- echo "Demo Markdown created{{:}} output-demo.md"
|
||||||
- defer:
|
- defer:
|
||||||
task: rmfile
|
task: rmfile
|
||||||
vars: { FILE: 'output-demo.md' }
|
vars: { FILE: "output-demo.md" }
|
||||||
|
|
||||||
demo:html:
|
demo:html:
|
||||||
desc: Demo - Convert sample to HTML
|
desc: Demo - Convert sample to HTML
|
||||||
@ -510,11 +518,11 @@ tasks:
|
|||||||
- '{{if eq OS "windows"}}if not exist "articulate-sample.json" exit 1{{else}}test ! -f "articulate-sample.json"{{end}}'
|
- '{{if eq OS "windows"}}if not exist "articulate-sample.json" exit 1{{else}}test ! -f "articulate-sample.json"{{end}}'
|
||||||
deps: [build]
|
deps: [build]
|
||||||
cmds:
|
cmds:
|
||||||
- '{{.OUTPUT_DIR}}/{{.APP_NAME}}{{.EXE_EXT}} articulate-sample.json html output-demo.html'
|
- "{{.OUTPUT_DIR}}/{{.APP_NAME}}{{.EXE_EXT}} articulate-sample.json html output-demo.html"
|
||||||
- echo "Demo HTML created{{:}} output-demo.html"
|
- echo "Demo HTML created{{:}} output-demo.html"
|
||||||
- defer:
|
- defer:
|
||||||
task: rmfile
|
task: rmfile
|
||||||
vars: { FILE: 'output-demo.html' }
|
vars: { FILE: "output-demo.html" }
|
||||||
|
|
||||||
demo:docx:
|
demo:docx:
|
||||||
desc: Demo - Convert sample to DOCX
|
desc: Demo - Convert sample to DOCX
|
||||||
@ -522,11 +530,11 @@ tasks:
|
|||||||
- '{{if eq OS "windows"}}if not exist "articulate-sample.json" exit 1{{else}}test ! -f "articulate-sample.json"{{end}}'
|
- '{{if eq OS "windows"}}if not exist "articulate-sample.json" exit 1{{else}}test ! -f "articulate-sample.json"{{end}}'
|
||||||
deps: [build]
|
deps: [build]
|
||||||
cmds:
|
cmds:
|
||||||
- '{{.OUTPUT_DIR}}/{{.APP_NAME}}{{.EXE_EXT}} articulate-sample.json docx output-demo.docx'
|
- "{{.OUTPUT_DIR}}/{{.APP_NAME}}{{.EXE_EXT}} articulate-sample.json docx output-demo.docx"
|
||||||
- echo "Demo DOCX created{{:}} output-demo.docx"
|
- echo "Demo DOCX created{{:}} output-demo.docx"
|
||||||
- defer:
|
- defer:
|
||||||
task: rmfile
|
task: rmfile
|
||||||
vars: { FILE: 'output-demo.docx' }
|
vars: { FILE: "output-demo.docx" }
|
||||||
|
|
||||||
# Performance profiling
|
# Performance profiling
|
||||||
profile:cpu:
|
profile:cpu:
|
||||||
@ -536,7 +544,7 @@ tasks:
|
|||||||
- go tool pprof -http=:8080 cpu.prof
|
- go tool pprof -http=:8080 cpu.prof
|
||||||
- defer:
|
- defer:
|
||||||
task: rmfile
|
task: rmfile
|
||||||
vars: { FILE: 'cpu.prof' }
|
vars: { FILE: "cpu.prof" }
|
||||||
|
|
||||||
profile:mem:
|
profile:mem:
|
||||||
desc: Run memory profiling
|
desc: Run memory profiling
|
||||||
@ -545,14 +553,14 @@ tasks:
|
|||||||
- go tool pprof -http=:8080 mem.prof
|
- go tool pprof -http=:8080 mem.prof
|
||||||
- defer:
|
- defer:
|
||||||
task: rmfile
|
task: rmfile
|
||||||
vars: { FILE: 'mem.prof' }
|
vars: { FILE: "mem.prof" }
|
||||||
|
|
||||||
# Git hooks
|
# Git hooks
|
||||||
hooks:install:
|
hooks:install:
|
||||||
desc: Install git hooks
|
desc: Install git hooks
|
||||||
cmds:
|
cmds:
|
||||||
- task: mkdir
|
- task: mkdir
|
||||||
vars: { DIR: '.git/hooks' }
|
vars: { DIR: ".git/hooks" }
|
||||||
- '{{if eq OS "windows"}}echo "#!/bin/sh" > .git/hooks/pre-commit && echo "task lint:fmt" >> .git/hooks/pre-commit{{else}}cat > .git/hooks/pre-commit << ''EOF''{{printf "\n"}}#!/bin/sh{{printf "\n"}}task lint:fmt{{printf "\n"}}EOF{{printf "\n"}}chmod +x .git/hooks/pre-commit{{end}}'
|
- '{{if eq OS "windows"}}echo "#!/bin/sh" > .git/hooks/pre-commit && echo "task lint:fmt" >> .git/hooks/pre-commit{{else}}cat > .git/hooks/pre-commit << ''EOF''{{printf "\n"}}#!/bin/sh{{printf "\n"}}task lint:fmt{{printf "\n"}}EOF{{printf "\n"}}chmod +x .git/hooks/pre-commit{{end}}'
|
||||||
- echo "Git hooks installed"
|
- echo "Git hooks installed"
|
||||||
|
|
||||||
|
|||||||
8
go.mod
8
go.mod
@ -1,14 +1,14 @@
|
|||||||
module github.com/kjanat/articulate-parser
|
module github.com/kjanat/articulate-parser
|
||||||
|
|
||||||
go 1.24.0
|
go 1.25.5
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/fumiama/go-docx v0.0.0-20250506085032-0c30fd09304b
|
github.com/fumiama/go-docx v0.0.0-20250506085032-0c30fd09304b
|
||||||
golang.org/x/net v0.46.0
|
golang.org/x/net v0.48.0
|
||||||
golang.org/x/text v0.30.0
|
golang.org/x/text v0.32.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/fumiama/imgsz v0.0.4 // indirect
|
github.com/fumiama/imgsz v0.0.4 // indirect
|
||||||
golang.org/x/image v0.32.0 // indirect
|
golang.org/x/image v0.34.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
6
go.sum
6
go.sum
@ -4,7 +4,13 @@ github.com/fumiama/imgsz v0.0.4 h1:Lsasu2hdSSFS+vnD+nvR1UkiRMK7hcpyYCC0FzgSMFI=
|
|||||||
github.com/fumiama/imgsz v0.0.4/go.mod h1:bISOQVTlw9sRytPwe8ir7tAaEmyz9hSNj9n8mXMBG0E=
|
github.com/fumiama/imgsz v0.0.4/go.mod h1:bISOQVTlw9sRytPwe8ir7tAaEmyz9hSNj9n8mXMBG0E=
|
||||||
golang.org/x/image v0.32.0 h1:6lZQWq75h7L5IWNk0r+SCpUJ6tUVd3v4ZHnbRKLkUDQ=
|
golang.org/x/image v0.32.0 h1:6lZQWq75h7L5IWNk0r+SCpUJ6tUVd3v4ZHnbRKLkUDQ=
|
||||||
golang.org/x/image v0.32.0/go.mod h1:/R37rrQmKXtO6tYXAjtDLwQgFLHmhW+V6ayXlxzP2Pc=
|
golang.org/x/image v0.32.0/go.mod h1:/R37rrQmKXtO6tYXAjtDLwQgFLHmhW+V6ayXlxzP2Pc=
|
||||||
|
golang.org/x/image v0.34.0 h1:33gCkyw9hmwbZJeZkct8XyR11yH889EQt/QH4VmXMn8=
|
||||||
|
golang.org/x/image v0.34.0/go.mod h1:2RNFBZRB+vnwwFil8GkMdRvrJOFd1AzdZI6vOY+eJVU=
|
||||||
golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4=
|
golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4=
|
||||||
golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
|
golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
|
||||||
|
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
|
||||||
|
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
|
||||||
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
|
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
|
||||||
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
|
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
|
||||||
|
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
|
||||||
|
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user