|
| 1 | +# GitHub Workflows for hfsutils |
| 2 | + |
| 3 | +This directory contains GitHub Actions workflows for continuous integration and testing. |
| 4 | + |
| 5 | +## Workflows |
| 6 | + |
| 7 | +### CI Workflow (`.github/workflows/ci.yml`) |
| 8 | + |
| 9 | +Comprehensive continuous integration workflow that builds and tests hfsutils on multiple platforms. |
| 10 | + |
| 11 | +#### Jobs |
| 12 | + |
| 13 | +1. **build-and-test-ubuntu** |
| 14 | + - Platform: Ubuntu Latest |
| 15 | + - Builds complete project using `build.sh` |
| 16 | + - Creates symlinks for filesystem utilities |
| 17 | + - Runs comprehensive test suite: |
| 18 | + - Basic functionality tests |
| 19 | + - Integration workflow tests |
| 20 | + - HFS+ specific tests |
| 21 | + - Error handling tests |
| 22 | + - Specification conformance tests |
| 23 | + - Tests installation to verify package structure |
| 24 | + - Uploads artifacts on failure for debugging |
| 25 | + |
| 26 | +2. **build-and-test-archlinux** |
| 27 | + - Platform: Arch Linux (container) |
| 28 | + - Same test suite as Ubuntu |
| 29 | + - Validates compatibility with rolling-release distribution |
| 30 | + - Uses latest Arch Linux packages |
| 31 | + - Independent artifact upload for debugging |
| 32 | + |
| 33 | +3. **test-specification-conformance** |
| 34 | + - Platform: Ubuntu Latest |
| 35 | + - Runs after successful Ubuntu build |
| 36 | + - Validates HFS/HFS+ specification compliance: |
| 37 | + - **HFS Alternate MDB Location**: Verifies signature `0x4244` at `device_size - 1024` |
| 38 | + - **HFS+ Alternate Volume Header**: Verifies signature `0x482B` or `0x4244` at `device_size - 1024` |
| 39 | + - **HFS+ attributes Field**: Validates `kHFSVolumeUnmountedBit` (0x0100) is set |
| 40 | + - Uses `hexdump` to inspect binary structures |
| 41 | + - Ensures conformance to Apple TN1150 specification |
| 42 | + |
| 43 | +4. **cross-platform-compatibility** |
| 44 | + - Platform: Ubuntu Latest |
| 45 | + - Runs after all builds complete |
| 46 | + - Summary job to verify all platforms passed |
| 47 | + - Provides single checkpoint for PR approval |
| 48 | + |
| 49 | +#### Test Categories |
| 50 | + |
| 51 | +The test suite (`test/run_tests.sh`) includes: |
| 52 | + |
| 53 | +- **basic**: Core functionality (mount, ls, copy, etc.) |
| 54 | +- **integration**: Real-world workflows (backup, migration, archive) |
| 55 | +- **hfsplus**: HFS+ specific features (formatting, detection, journaling) |
| 56 | +- **errors**: Error handling and edge cases |
| 57 | +- **all**: Complete test suite |
| 58 | + |
| 59 | +#### Triggers |
| 60 | + |
| 61 | +- **Push**: Any push to `master` branch |
| 62 | +- **Pull Request**: Any PR targeting `master` branch |
| 63 | + |
| 64 | +#### Dependencies |
| 65 | + |
| 66 | +**Ubuntu:** |
| 67 | +- build-essential |
| 68 | +- gcc |
| 69 | +- make |
| 70 | +- perl |
| 71 | +- hexdump |
| 72 | +- util-linux |
| 73 | + |
| 74 | +**Arch Linux:** |
| 75 | +- base-devel |
| 76 | +- gcc |
| 77 | +- make |
| 78 | +- perl |
| 79 | +- git |
| 80 | +- util-linux |
| 81 | + |
| 82 | +## Running Tests Locally |
| 83 | + |
| 84 | +### Ubuntu/Debian |
| 85 | +```bash |
| 86 | +sudo apt-get install build-essential gcc make perl hexdump |
| 87 | +./build.sh |
| 88 | +cd test |
| 89 | +./run_tests.sh all |
| 90 | +``` |
| 91 | + |
| 92 | +### Arch Linux |
| 93 | +```bash |
| 94 | +sudo pacman -S base-devel gcc make perl util-linux |
| 95 | +./build.sh |
| 96 | +cd test |
| 97 | +./run_tests.sh all |
| 98 | +``` |
| 99 | + |
| 100 | +### Quick Tests |
| 101 | +```bash |
| 102 | +cd test |
| 103 | +./run_tests.sh basic # Basic functionality only |
| 104 | +``` |
| 105 | + |
| 106 | +### Specification Tests |
| 107 | +```bash |
| 108 | +cd test |
| 109 | +./test_hfs_spec_validation.sh |
| 110 | +./test_hfsplus_complete.sh |
| 111 | +``` |
| 112 | + |
| 113 | +## Artifacts |
| 114 | + |
| 115 | +On test failure, the following artifacts are uploaded: |
| 116 | + |
| 117 | +- `test/temp/` - Temporary test files and images |
| 118 | +- `test/*.log` - Test execution logs |
| 119 | +- `*.img` - HFS/HFS+ disk images created during tests |
| 120 | + |
| 121 | +Artifacts are kept for 90 days and can be downloaded from the Actions tab. |
| 122 | + |
| 123 | +## Status Badges |
| 124 | + |
| 125 | +Add to README.md: |
| 126 | + |
| 127 | +```markdown |
| 128 | + |
| 129 | +``` |
| 130 | + |
| 131 | +## Maintenance |
| 132 | + |
| 133 | +### Adding New Tests |
| 134 | + |
| 135 | +1. Add test function to `test/run_tests.sh` |
| 136 | +2. Update workflow to include new test category if needed |
| 137 | +3. Test locally before pushing |
| 138 | + |
| 139 | +### Updating Dependencies |
| 140 | + |
| 141 | +1. Update package lists in workflow file |
| 142 | +2. Test in container locally: |
| 143 | + ```bash |
| 144 | + docker run -it --rm -v $(pwd):/workspace -w /workspace ubuntu:latest bash |
| 145 | + # or |
| 146 | + docker run -it --rm -v $(pwd):/workspace -w /workspace archlinux:latest bash |
| 147 | + ``` |
| 148 | + |
| 149 | +### Debugging Failures |
| 150 | + |
| 151 | +1. Check Actions tab for logs |
| 152 | +2. Download artifacts if available |
| 153 | +3. Reproduce locally using same commands |
| 154 | +4. Check specification conformance with `hexdump` |
| 155 | + |
| 156 | +## References |
| 157 | + |
| 158 | +- [GitHub Actions Documentation](https://docs.github.com/en/actions) |
| 159 | +- [Apple TN1150 - HFS Plus Volume Format](../doc/TN1150_HFS_PLUS_VOLUME_FORMAT.md) |
| 160 | +- [Test Suite Documentation](../test/README.md) |
0 commit comments