This document explains the Continuous Integration and Continuous Deployment (CI/CD) setup for the J2KSwift project.
J2KSwift uses GitHub Actions for automated testing, code quality checks, documentation generation, and releases. All workflows are defined in the .github/workflows/ directory.
Purpose: Ensures the code builds and all tests pass on multiple platforms.
Triggers:
- Push to
mainordevelopbranches - Pull requests to
mainordevelopbranches - Manual workflow dispatch
Jobs:
- Test on macOS: Builds and tests on macOS 14 with Swift 6.2
- Test on Linux: Builds and tests on Ubuntu with Swift 6.2 Docker container
- SwiftLint: Runs code style checks
What it validates:
- Code compiles on macOS and Linux
- All tests pass
- Release builds work
- Code follows style guidelines
Status Badge:
[](https://github.com/Raster-Lab/J2KSwift/actions/workflows/swift-build-test.yml)Purpose: Comprehensive code quality and security checks.
Triggers:
- Push to
mainordevelopbranches - Pull requests to
mainordevelopbranches - Manual workflow dispatch
Jobs:
- SwiftLint: Detailed linting with report generation
- Security Audit: Checks for vulnerable dependencies
- Code Coverage: Measures test coverage
- Package Validation: Validates Swift package structure
Artifacts:
- SwiftLint report (JSON)
- Code coverage report (LCOV format)
Status Badge:
[](https://github.com/Raster-Lab/J2KSwift/actions/workflows/code-quality.yml)Purpose: Generates and deploys API documentation to GitHub Pages.
Triggers:
- Push to
mainbranch - Version tags (e.g.,
v1.1.0) - Manual workflow dispatch
What it does:
- Generates DocC documentation for each module:
- J2KCore
- J2KCodec
- J2KFileFormat
- JPIP
- Creates an index page linking to all modules
- Deploys to GitHub Pages
Documentation URL: https://raster-lab.github.io/J2KSwift/
Prerequisites:
- GitHub Pages must be enabled in repository settings
- Pages source should be set to "GitHub Actions"
Status Badge:
[](https://github.com/Raster-Lab/J2KSwift/actions/workflows/documentation.yml)Purpose: Automates the release process.
Triggers:
- Push of version tags (e.g.,
v1.1.0,v1.2.0) - Manual workflow dispatch with tag input
What it does:
- Validate: Runs full build and test suite
- Create Release: Creates GitHub release with:
- Extracted release notes from
RELEASE_NOTES_v*.mdfiles - Auto-generated release notes as fallback
- Release assets (if any)
- Extracted release notes from
- Create Release Branch: Automatically creates a
release/vX.Y.Zbranch from the tag, enabling hotfix support for each release
Release Branches:
- A
release/vX.Y.Zbranch is automatically created for every release (e.g.,release/v1.2.0) - If the branch already exists, the step is skipped
- CI workflows (CI, Code Quality, Swift Build and Test) run on
release/*branches - Hotfixes can be applied to release branches and cherry-picked back to
main/develop
Creating a Release:
# 1. Update VERSION file
echo "1.2.0" > VERSION
# 2. Create release notes (optional)
cp RELEASE_NOTES.md RELEASE_NOTES_v1.2.0.md
# 3. Commit changes
git add VERSION RELEASE_NOTES_v1.2.0.md
git commit -m "Prepare v1.2.0 release"
git push
# 4. Create and push tag
git tag -a v1.2.0 -m "Release v1.2.0"
git push origin v1.2.0
# The workflow will automatically:
# - Create the GitHub release
# - Create a release/v1.2.0 branchPurpose: Creates tags and release branches for existing versions. Use this to retroactively create release branches for versions that were released before the automation was added.
Triggers:
- Manual workflow dispatch only
Inputs:
version: A specific version (e.g.,v1.8.0) orallto create branches for every version with aRELEASE_NOTES_v*.mdfile
What it does:
- Discovers versions from
RELEASE_NOTES_v*.mdfiles (whenallis selected) - Creates annotated tags for each version if they don't exist
- Creates
release/vX.Y.Zbranches from the tags if they don't exist
Usage:
# Via GitHub CLI - create branches for all versions
gh workflow run create-release-branches.yml -f version=all
# Via GitHub CLI - create branch for a specific version
gh workflow run create-release-branches.yml -f version=v1.8.0Or trigger from the GitHub Actions UI: Actions → Create Release Branches → Run workflow.
File: .github/dependabot.yml
Purpose: Automatically checks for dependency updates.
Update Schedule: Weekly (every Monday)
What it monitors:
- GitHub Actions versions
- Swift Package Manager dependencies
Behavior:
- Creates PRs for updates
- Labels PRs appropriately
- Limits to 5 open PRs per ecosystem
File: .github/pull_request_template.md
Purpose: Standardizes PR descriptions with required sections:
- Description and motivation
- List of changes
- Testing performed
- Documentation updates
- Code quality checklist
For reporting bugs with environment details, reproduction steps, and error output.
For proposing new features with use cases and implementation considerations.
For reporting documentation issues, errors, or improvements.
-
Build the project:
swift build
-
Run tests:
swift test -
Run SwiftLint (if available):
swiftlint lint
-
Check package:
swift package describe
main: Stable, production-ready codedevelop: Development branch for next release- Feature branches:
feature/feature-name - Bug fixes:
fix/bug-description - Pull request branches:
copilot/description
- Create a branch from
develop(ormainfor hotfixes) - Make changes following code style guidelines
- Add/update tests
- Update documentation if needed
- Push and create pull request
- Wait for CI checks to pass
- Address review comments
- Merge after approval
- ✅ Test locally first: Run build and tests before pushing
- ✅ Fix SwiftLint issues: Address linting warnings/errors
- ✅ Add tests: Cover new code with tests
- ✅ Update docs: Keep documentation in sync
- ✅ Small commits: Make focused, reviewable changes
- ✅ Review CI results: Check all workflows before merging
- ✅ Monitor coverage: Maintain or improve test coverage
- ✅ Update dependencies: Review and merge Dependabot PRs
- ✅ Release process: Follow release checklist
- ✅ Documentation: Keep docs updated on main branch
Common Issues:
- Swift version mismatch
- Xcode command line tools not configured
- Missing system dependencies
Solution: Check workflow logs for specific error messages.
Common Issues:
- Platform-specific code (e.g., Apple frameworks)
- Missing Linux dependencies
- File path case sensitivity
Solution: Test in Swift Docker container locally:
docker run -v $PWD:/workspace swift:6.2 bash -c "cd /workspace && swift build && swift test"Common Issues:
- Code style violations
- Configuration errors in
.swiftlint.yml
Solution:
# Run locally with same config
swiftlint lint
# Auto-fix some issues
swiftlint lint --fixCommon Issues:
- Missing documentation comments on public APIs
- Invalid DocC syntax
- Build failures preventing doc generation
Solution: Ensure all public APIs have documentation:
/// Brief description.
///
/// Detailed description if needed.
///
/// - Parameter name: Description
/// - Returns: Description
/// - Throws: Error description
public func myFunction(name: String) throws -> Result {
// ...
}Common Issues:
- Environment-specific failures
- Timing issues in async tests
- Resource file path issues
Solution: Check test logs and run locally:
# Run specific test
swift test --filter TestClassName.testMethodName
# Run with verbose output
swift test -v- Weekly: Review Dependabot PRs
- Per PR: Check CI status before merging
- Per Release: Verify all workflows pass
- Monthly: Review code coverage trends
- Quarterly: Update workflow versions
- ✅ Build success rate
- ✅ Test pass rate (currently 98.3%)
- ✅ Code coverage percentage
- ✅ SwiftLint violation count
- ✅ Average PR merge time
Potential enhancements to consider:
- Performance Testing: Add benchmark workflow
- Security Scanning: Integrate SAST tools
- Automated Releases: Semantic release automation
- Codecov Integration: Upload coverage to Codecov
- Matrix Testing: Test on multiple Swift versions
- Nightly Builds: Daily builds of develop branch
- Package Registry: Publish to package registries
If you encounter issues with CI/CD:
- Check workflow logs in GitHub Actions tab
- Search existing issues
- Create a bug report with workflow logs
- Tag maintainers if urgent
Last Updated: February 15, 2026
CI/CD Version: 1.0
Maintained By: J2KSwift Team