
ci-cd-setup
by lgbarn
Luther Barnum's agent skills for trading indicators and Python bots
SKILL.md
name: ci-cd-setup description: Configure CI/CD pipelines, troubleshoot test failures, set up pre-commit hooks, and manage GitHub Actions for trading indicator development. Use when setting up testing infrastructure, diagnosing build failures, configuring branch protection, or running tests locally. Triggers: "CI failing", "set up tests", "pre-commit hooks", "GitHub Actions", "Docker testing". allowed-tools: Read, Grep, Glob, Bash(git:, docker:, npm:, pip:, dotnet:, pre-commit:)
CI/CD Setup Skill
Configure continuous integration and deployment for multi-platform trading indicators.
Overview
This skill helps set up and manage:
- Pre-commit hooks - Run tests and linting before commits
- GitHub Actions - Automated CI/CD pipeline
- Docker testing - Isolated test environments
- Branch protection - Prevent failed tests from merging
When to Use This Skill
Use this skill when:
- Setting up testing infrastructure for a new project
- Troubleshooting CI/CD pipeline failures
- Adding new test types or platforms
- Configuring pre-commit hooks
- Setting up branch protection rules
- Running tests locally before pushing
Do NOT use for:
- Writing indicator code (use indicator-generator skill)
- General Git operations (commits, branches, merges)
- Deployment to trading platforms
Quick Commands
Install Pre-commit Hooks
# Install pre-commit framework
pip install pre-commit
# Install hooks in this repository
pre-commit install
# Run all checks manually
pre-commit run --all-files
Run Tests Locally
# NinjaTrader C# tests
dotnet test Ninjatrader/Tests/LB.Indicators.Tests.csproj --verbosity normal
# Tradovate JavaScript linting
npm install && npm run lint
# Pine Script validation
./scripts/validate-pine.sh Tradingview/*.pine
Docker Testing
# Run all tests in Docker
docker-compose -f docker-compose.test.yml up --build
# Run only .NET tests
docker-compose -f docker-compose.test.yml up dotnet-tests --build
# Run only ESLint
docker-compose -f docker-compose.test.yml up eslint --build
Configuration Files
| File | Purpose |
|---|---|
.pre-commit-config.yaml | Pre-commit hooks configuration |
.github/workflows/ci.yml | GitHub Actions CI pipeline |
Dockerfile.dotnet | Docker image for .NET tests |
docker-compose.test.yml | Multi-service test orchestration |
scripts/validate-pine.sh | Pine Script validation script |
.eslintrc.json | ESLint config for Tradovate JS |
package.json | Node.js dependencies |
GitHub Actions Workflow
The CI pipeline runs on:
- Push to
mainordevelopbranches - Pull requests targeting
main
Jobs
- pre-commit - General code quality checks
- dotnet-test - NinjaTrader tests (.NET 8.0, 9.0 matrix)
- eslint - Tradovate JavaScript linting
- pine-validate - Pine Script syntax validation
- status-gate - All-jobs-must-pass gate
Artifacts
Test results are uploaded as artifacts with 30-day retention.
Branch Protection Setup
After pushing CI configuration to GitHub:
- Go to Settings > Branches > main
- Click Add rule or edit existing
- Enable:
- Require status checks to pass before merging
- Select required checks:
CI Status GateNinjaTrader Tests (.NET 9.0.x)
- Require branches to be up to date before merging
- Optionally enable:
- Require pull request reviews before merging
- Do not allow bypassing the above settings
Test Infrastructure
NinjaTrader Tests
Location: Ninjatrader/Tests/
Tests/
├── LB.Indicators.Tests.csproj # Test project file
├── *HelperTests.cs # Test files
└── Helpers/
└── *Helpers.cs # Extracted testable helpers
Test pattern: Helper Class Pattern
- Extract business logic to testable helper classes
- No NinjaTrader platform dependencies
- Pure C# unit tests with NUnit
Pine Script Validation
The scripts/validate-pine.sh script checks:
- Version header (
//@version=5or//@version=6) - Author attribution for
LB_*files indicator()orstrategy()declaration- Resource limits for Pro indicators
- Balanced brackets/parentheses
- No debug code left in
Tradovate Linting
ESLint rules in .eslintrc.json:
- CommonJS module support
- No unused variables (except Tradovate patterns)
- Semicolons required
- Double quotes for strings
- No dangerous eval patterns
Troubleshooting
Pre-commit Errors
# Skip a specific hook temporarily
SKIP=dotnet-test pre-commit run --all-files
# Update hooks to latest versions
pre-commit autoupdate
# Clean and reinstall
pre-commit clean
pre-commit install
.NET Test Failures
# Run with verbose output
dotnet test Ninjatrader/Tests/LB.Indicators.Tests.csproj --verbosity detailed
# Run specific test
dotnet test --filter "FullyQualifiedName~VWAPCalculatorTests"
Docker Issues
# Rebuild without cache
docker-compose -f docker-compose.test.yml build --no-cache
# View logs
docker-compose -f docker-compose.test.yml logs
Adding New Tests
When adding a new indicator:
- Create helper class in
Ninjatrader/Tests/Helpers/ - Create test file in
Ninjatrader/Tests/ - Run tests locally:
dotnet test - Commit and push - CI will validate
See .claude/skills/indicator-generator/ninja/TESTING.md for TDD workflow.
CI/CD Maintenance
Update Dependencies
# Update pre-commit hooks
pre-commit autoupdate
# Update npm dependencies
npm update
# Update .NET dependencies (in test project)
dotnet outdated Ninjatrader/Tests/LB.Indicators.Tests.csproj
Monitor CI Status
- Check GitHub Actions tab for workflow runs
- Review test artifacts for detailed results
- Monitor code coverage trends
Files Modified by This Skill
.pre-commit-config.yaml- Pre-commit configuration.github/workflows/ci.yml- GitHub Actions workflowDockerfile.dotnet- Docker test imagedocker-compose.test.yml- Docker Compose configscripts/validate-pine.sh- Pine Script validator.eslintrc.json- ESLint configurationpackage.json- Node.js dependencies
スコア
総合スコア
リポジトリの品質指標に基づく評価
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
レビュー
レビュー機能は近日公開予定です