A fast, reliable GitHub Action for setting up Leiningen in CI/CD pipelines with anti-hanging measures and optimized caching.
- ✅ Anti-Hanging Protection: Implements network timeouts and fail-safe mechanisms
- ⚡ Optimized Caching: Uses GitHub Actions cache best practices for maximum performance
- 🛡️ Error Resilience: Robust error handling and recovery mechanisms
- 🔧 Flexible Configuration: Customizable versions, timeouts, and cache settings
- 📊 Performance Monitoring: Detailed logging and timing information
steps:
- uses: actions/checkout@v4
- name: Setup Leiningen
uses: SiraSight/setup-lein@v1
with:
lein-version: '2.9.1'| Input | Description | Required | Default |
|---|---|---|---|
lein-version |
Version of Leiningen to install | No | 2.9.1 |
cache-enable |
Enable caching of Leiningen installation | No | true |
timeout-seconds |
Timeout for network operations | No | 30 |
| Output | Description |
|---|---|
cache-hit |
Whether the cache was restored from key |
lein-path |
Path to the installed Leiningen binary |
- name: Setup Leiningen with custom settings
uses: SiraSight/setup-lein@v1
with:
lein-version: '2.10.0'
timeout-seconds: '60'
cache-enable: 'true'- name: Setup Leiningen without caching
uses: SiraSight/setup-lein@v1
with:
lein-version: '2.9.1'
cache-enable: 'false'name: Clojure CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 24
uses: actions/setup-java@v4
with:
java-version: '24'
distribution: 'adopt'
- name: Setup Leiningen
uses: SiraSight/setup-lein@v1
with:
lein-version: '2.9.1'
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/project.clj') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Install dependencies
run: lein deps
- name: Run tests
run: lein testThis action implements GitHub Actions cache best practices:
- Leiningen Binary Cache: Caches the Leiningen installation using version-specific keys
- Smart Cache Keys: Uses
${{ runner.os }}-lein-${{ inputs.lein-version }}for optimal cache hits - Fallback Restore Keys: Implements progressive fallback for cache misses
- Cache Invalidation: Automatically invalidates cache when version changes
The action includes several mechanisms to prevent hanging:
- Network Timeouts: Configurable timeout for download operations
- Retry Logic: Automatic retry with exponential backoff
- Connection Validation: Pre-flight connectivity checks
- Fail-Safe Fallback: Alternative download mirrors and methods
- Parallel Operations: Concurrent cache operations where possible
- Minimal Downloads: Only downloads when cache miss occurs
- Efficient Extraction: Optimized archive extraction process
- Path Optimization: Smart PATH manipulation for faster command resolution
Cache Miss Every Time
# Ensure consistent cache key
- name: Debug cache key
run: echo "Cache key would be ${{ runner.os }}-lein-${{ inputs.lein-version || '2.9.1' }}"Network Timeouts
# Increase timeout for slow networks
- uses: SiraSight/setup-lein@v1
with:
timeout-seconds: '120'Permission Issues
# Ensure proper permissions
- name: Fix permissions
run: chmod +x ~/.local/bin/leinEnable debug logging by setting the ACTIONS_STEP_DEBUG secret to true in your repository.
| Leiningen Version | Java Version | Status |
|---|---|---|
| 2.9.1 | 8, 11, 17, 21, 24 | ✅ Recommended |
| 2.9.10 | 8, 11, 17, 21, 24 | ✅ Supported |
| 2.10.0 | 11, 17, 21, 24 | ✅ Latest |
- Fork the repository
- Create a feature branch
- Test with multiple OS/version combinations
- Submit a pull request
MIT License - see LICENSE for details.
- Initial release with anti-hanging measures
- Optimized caching implementation
- Comprehensive error handling
- Multi-platform support
Built for SiraSight with ❤️