4.1 KiB
4.1 KiB
Forgejo Actions for apt-layer
This directory contains Forgejo Actions workflows for automated compilation and testing of the apt-layer tool.
Workflows
1. compile-apt-layer.yml - Main Compilation Workflow
Triggers:
- Push to
mainormasterbranch (whensrc/apt-layer/files change) - Pull requests to
mainormasterbranch - Manual trigger via workflow_dispatch
What it does:
- Sets up Ubuntu environment with required dependencies (jq, dos2unix, bash)
- Compiles apt-layer using
src/apt-layer/compile.sh - Compiles installer with latest paths.json using
src/apt-layer/compile-installer.sh - Validates both compiled scripts (syntax, functionality)
- Creates a detailed compilation report
- Uploads artifacts (compiled scripts and report)
- Automatically commits both compiled scripts to the repository (only on main/master)
Output:
- Compiled
apt-layer.shin the repository root - Compiled
install-apt-layer.shwith embedded paths.json in the repository root - Compilation report as an artifact
- Both compiled scripts as artifacts
2. test-compile.yml - Test Compilation Workflow
Triggers:
- Manual trigger only (workflow_dispatch)
What it does:
- Tests compilation without affecting the main repository
- Creates
apt-layer-test.shfor testing purposes - Validates the test compilation
- Uploads test script as an artifact
Use case: Testing compilation changes before pushing to main branch
How to Use
Automatic Compilation
- Make changes to files in
src/apt-layer/ - Commit and push to main/master branch
- Forgejo will automatically:
- Detect the changes
- Run the compilation workflow
- Compile apt-layer
- Commit the compiled script back to the repository
- Provide artifacts for download
Manual Testing
- Go to your Forgejo repository
- Navigate to Actions tab
- Select "Test apt-layer Compilation"
- Click "Run workflow"
- Download the test script from the artifacts
Viewing Results
- Actions tab: See workflow runs and logs
- Artifacts: Download compiled scripts and reports
- Repository: The compiled
apt-layer.shwill be in the root directory
Dependencies
The workflows automatically install:
jq- JSON processingdos2unix- Line ending conversionbash- Script execution
Configuration
Path-based Triggers
The main workflow only triggers when these paths change:
src/apt-layer/**- Any apt-layer source files (including config and templates).forgejo/workflows/compile-apt-layer.yml- The workflow itself
Branch Protection
The auto-commit feature only works on:
mainbranchmasterbranch
Artifact Retention
- Compilation reports: 30 days
- Compiled scripts: 30 days
- Test scripts: 7 days
Troubleshooting
Common Issues
-
Compilation fails:
- Check the workflow logs for specific errors
- Verify all dependencies are available
- Check JSON syntax in config files
-
Auto-commit doesn't work:
- Ensure you're on main/master branch
- Check repository permissions for Actions
- Verify the workflow has write access
-
Test workflow fails:
- Use the test workflow to debug compilation issues
- Check artifact downloads for the test script
Manual Compilation
If you need to compile locally:
# Compile apt-layer
cd src/apt-layer
chmod +x compile.sh
./compile.sh -o ../../apt-layer.sh
# Compile installer with latest paths.json
chmod +x compile-installer.sh
./compile-installer.sh -o ../../install-apt-layer.sh
Benefits
- Automated Quality Assurance: Every commit is automatically compiled and tested
- Consistent Builds: Same environment and dependencies every time
- Artifact Management: Easy access to compiled scripts and reports
- Version Control: Compiled scripts are tracked in git
- Testing: Separate test workflow for safe experimentation
Security
- Workflows run in isolated Ubuntu environments
- No sensitive data is exposed in logs
- Compiled scripts are validated before commit
- Artifacts have limited retention periods