This directory contains the GitHub Actions workflows for the Amber CLI project, providing comprehensive continuous integration and deployment for Linux and macOS.
Triggers: Push to main/master branches, Pull Requests
Purpose: Ensures code quality and compatibility across platforms
Jobs:
-
test: Runs on Ubuntu and macOS
- Installs Crystal using platform-specific methods
- Caches shard dependencies for faster builds
- Checks code formatting with
crystal tool format
- Runs Ameba linter (with soft failure)
- Compiles the project to ensure no build errors
- Runs the full test suite with
crystal spec
- Builds a release binary (Linux only)
-
platform-specific: Additional platform-specific testing
- Tests CLI functionality by running
--help
and--version
- Ensures the compiled binary works on each platform
- Tests CLI functionality by running
-
integration: Runs integration tests if they exist
- Currently checks for and runs tests in
spec/integration/
- Currently checks for and runs tests in
Triggers: Push to version tags (v*
), Manual dispatch
Purpose: Builds and publishes release binaries for all platforms
Features:
- Builds static binaries for Linux (fully portable)
- Builds optimized binaries for macOS
- Automatically creates GitHub releases with binaries attached
- Generates release notes automatically
Purpose: Keeps GitHub Actions dependencies up to date
Features:
- Weekly updates for GitHub Actions
- Ready for Crystal shards support when available
- Uses the official Crystal installer script
- Builds static binaries for maximum portability
- Includes build-essential for static compilation
- Installs Crystal via Homebrew
- Builds standard dynamic binaries
The workflows use GitHub Actions caching to speed up builds:
- Shard cache: Caches
~/.cache/shards
and./lib
based onshard.lock
hash - OS-specific: Separate caches for each operating system
- The CI workflow runs automatically on every push and pull request
- All tests must pass on all platforms before merging
- Code formatting and linting issues are reported but don't fail the build
- Create a git tag with version format:
git tag v1.0.0
- Push the tag:
git push origin v1.0.0
- The release workflow automatically builds binaries for all platforms
- A GitHub release is created with the binaries attached
You can trigger the release workflow manually from the GitHub Actions tab for testing purposes.
- Crystal installation fails: Usually due to temporary network issues or package manager problems
- Shard installation fails: Often due to missing system dependencies
- Check the Actions tab in your GitHub repository for detailed logs
- Each step shows its output and any error messages
- Failed workflows will show which specific step failed
To add new tests that run in CI:
- Add test files to the
spec/
directory - Integration tests go in
spec/integration/
- The workflows will automatically pick up and run new tests
- Code coverage reporting: Add a code coverage tool
- Performance benchmarks: Track performance across releases
- Docker builds: Add containerized builds for additional consistency
- Cross-compilation: Explore Crystal's cross-compilation features
- Shard dependency updates: When Dependabot supports Crystal, enable automatic dependency updates