website-and-documentation/Taskfile.yml

161 lines
3.4 KiB
YAML
Raw Normal View History

version: '3'
vars:
HUGO_CMD: hugo
NPM_CMD: npm
tasks:
default:
desc: Show available tasks
cmds:
- task --list
# Build tasks
build:
desc: Build Hugo site
deps:
- deps:ensure-npm
- build:generate-info
cmds:
- "{{.HUGO_CMD}} --gc --minify"
build:dev:
desc: Build Hugo site for development
deps:
- deps:ensure-npm
- build:generate-info
cmds:
- "{{.HUGO_CMD}}"
build:generate-info:
desc: Generate build information (git commit, version, etc.)
sources:
- .git/HEAD
- .git/refs/**/*
generates:
- data/build_info.json
cmds:
- ./scripts/generate-build-info.sh
serve:
desc: Start Hugo dev server
deps:
- deps:ensure-npm
- build:generate-info
cmds:
- "{{.HUGO_CMD}} server"
clean:
desc: Clean build artifacts
cmds:
- rm -rf public resources/_gen .hugo_build.lock
# Test tasks
test:
desc: Run all tests
deps:
- test:build
- test:markdown
- test:html
- test:links
test:quick:
desc: Run quick tests (without link check)
deps:
- test:build
- test:markdown
test:build:
desc: Test Hugo build
deps:
- deps:ensure-npm
- build:generate-info
cmds:
- "{{.HUGO_CMD}} --gc --minify --logLevel info"
test:markdown:
desc: Lint markdown files
deps:
- deps:ensure-npm
cmds:
- "{{.NPM_CMD}} run test:markdown"
test:html:
desc: Validate HTML
deps:
- deps:ensure-npm
cmds:
- "{{.NPM_CMD}} run test:html"
test:links:
desc: Check links
cmds:
- htmltest
# Development tasks
deps:ensure-npm:
desc: Ensure npm dependencies are installed
sources:
- package.json
- package-lock.json
generates:
- node_modules/.package-lock.json
cmds:
- "{{.NPM_CMD}} install"
status:
- test -d node_modules
deps:install:
desc: Install all dependencies
cmds:
- "{{.NPM_CMD}} install"
- "{{.HUGO_CMD}} mod get -u"
- "{{.HUGO_CMD}} mod tidy"
deps:update:
desc: Update dependencies
cmds:
- devbox update
- "{{.NPM_CMD}} update"
- "{{.HUGO_CMD}} mod get -u"
# CI/CD
ci:
desc: Run CI pipeline locally
deps:
- test
build:oci-image:
desc: Build OCI/Docker image with versions from .env.versions
cmds:
- |
set -a
source .env.versions
set +a
echo "Building OCI image with versions:"
echo " NODE_VERSION=${NODE_VERSION}"
echo " GO_VERSION=${GO_VERSION}"
echo " HUGO_VERSION=${HUGO_VERSION}"
docker build --network=host \
--build-arg NODE_VERSION=${NODE_VERSION} \
--build-arg GO_VERSION=${GO_VERSION} \
--build-arg HUGO_VERSION=${HUGO_VERSION} \
-t ipceicis-developerframework:latest \
-t ipceicis-developerframework:$(git rev-parse --short HEAD) \
.
test:oci-image:
desc: Test the built OCI image
deps:
- build:oci-image
cmds:
- |
echo "Starting container on port 8080..."
docker run -d -p 8080:80 --name hugo-test ipceicis-developerframework:latest
sleep 2
echo "Testing endpoint..."
curl -f http://localhost:8080 > /dev/null && echo "✓ Container is running and responding" || echo "✗ Container test failed"
echo "Cleaning up..."
docker stop hugo-test
docker rm hugo-test