|
| 1 | +# FlightControl Demo GitHub Actions Workflows |
| 2 | + |
| 3 | +This folder contains GitHub Actions workflows for automating the testing, building, and deployment of the FlightControl Demo firmware. |
| 4 | + |
| 5 | +## Automated Workflow Overview |
| 6 | + |
| 7 | +### PR Workflow (`pr-workflow.yaml`) |
| 8 | + |
| 9 | +Triggered in the following scenarios: |
| 10 | +- When a pull request is opened, reopened, or updated (synchronize) against the `master` branch |
| 11 | +- Manually from the GitHub Actions tab |
| 12 | + |
| 13 | +This workflow has three sequential jobs: |
| 14 | + |
| 15 | +1. **Test**: Runs unit tests using CMake |
| 16 | +2. **Compile**: Compiles the firmware for the BSOM platform |
| 17 | +3. **Flash**: Flashes the compiled firmware to a test device |
| 18 | + |
| 19 | +Each job only runs if the previous job succeeds, providing a complete validation pipeline for pull requests. |
| 20 | + |
| 21 | +### Release Workflow (`release-workflow.yaml`) |
| 22 | + |
| 23 | +Triggered in the following scenarios: |
| 24 | +- When a PR is merged to `master` (note: closing without merging won't trigger the release) |
| 25 | +- When code is pushed directly to `master` |
| 26 | +- Manually from the GitHub Actions tab |
| 27 | + |
| 28 | +This workflow has two sequential jobs: |
| 29 | + |
| 30 | +1. **Release**: |
| 31 | + - Compiles the firmware with auto-versioning |
| 32 | + - Commits the updated version file |
| 33 | + - Creates a GitHub release with the firmware binary and debug information |
| 34 | + |
| 35 | +2. **Upload**: |
| 36 | + - Uploads the firmware to the Particle cloud for OTA updates to production devices |
| 37 | + - Only runs if the firmware version was updated in the previous step |
| 38 | + |
| 39 | +## Individual Manual Workflows |
| 40 | + |
| 41 | +These workflows can only be triggered manually from the GitHub Actions tab and are designed for testing individual steps before opening a PR. |
| 42 | + |
| 43 | +### Manual Test (`manual-test.yaml`) |
| 44 | +Runs the unit tests on a specific branch. |
| 45 | +- **Inputs**: |
| 46 | + - Branch to test (optional) |
| 47 | + |
| 48 | +### Manual Compile (`manual-compile.yaml`) |
| 49 | +Compiles the firmware on a specific branch. |
| 50 | +- **Inputs**: |
| 51 | + - Branch to compile (optional) |
| 52 | +- **Outputs**: |
| 53 | + - Firmware binary as an artifact |
| 54 | + |
| 55 | +### Manual Flash (`manual-flash.yaml`) |
| 56 | +Flashes a device with compiled firmware. |
| 57 | +- **Inputs**: |
| 58 | + - Device ID (optional, defaults to test device) |
| 59 | + - Use latest artifact (yes/no) |
| 60 | +- **Notes**: |
| 61 | + - Can use the firmware from the latest manual-compile run or compile a new binary |
| 62 | + |
| 63 | +### Manual Release (`manual-release.yaml`) |
| 64 | +Creates a test release without committing version changes. |
| 65 | +- **Inputs**: |
| 66 | + - Branch to release (optional) |
| 67 | + - Force version increment (yes/no) |
| 68 | + - Custom release notes (optional) |
| 69 | +- **Notes**: |
| 70 | + - Creates a GitHub prerelease with '-manual' tag suffix |
| 71 | + - Doesn't commit version changes back to the repository |
| 72 | + |
| 73 | +### Manual Upload (`manual-upload.yaml`) |
| 74 | +Uploads a firmware binary to Particle cloud. |
| 75 | +- **Inputs**: |
| 76 | + - Product ID (optional) |
| 77 | + - Firmware version (required) |
| 78 | + - Release title (optional) |
| 79 | + - Use release artifact (yes/no) |
| 80 | +- **Notes**: |
| 81 | + - Can use the firmware from the latest manual-release run or compile a new binary |
| 82 | + |
| 83 | +## Manual Workflow Triggering (Main Workflows) |
| 84 | + |
| 85 | +The main workflows can also be triggered manually from the GitHub Actions tab: |
| 86 | + |
| 87 | +1. **PR Workflow**: |
| 88 | + - Optional input for the reason for manual testing |
| 89 | + |
| 90 | +2. **Release Workflow**: |
| 91 | + - Option to control version increment (yes/no) |
| 92 | + - Custom release notes field that overrides the auto-generated ones |
| 93 | + |
| 94 | +## Required Secrets |
| 95 | + |
| 96 | +The workflows require the following secrets to be configured in your GitHub repository: |
| 97 | + |
| 98 | +- `PARTICLE_ACCESS_TOKEN`: Particle cloud API token for uploading firmware |
| 99 | +- `PARTICLE_USER_LEVEL_ACCESS_TOKEN`: Particle token for flashing individual test devices |
| 100 | +- `PARTICLE_TEST_DEVICE_ID`: ID of the test device to flash during PR testing |
| 101 | +- `PARTICLE_PRODUCT_ID`: ID of the Particle product for production releases |
| 102 | + |
| 103 | +## Event Flow |
| 104 | + |
| 105 | +1. **When opening a PR to master**: |
| 106 | + - PR Workflow runs (test → compile → flash) |
| 107 | + - This validates the changes before they're merged |
| 108 | + |
| 109 | +2. **When merging a PR to master**: |
| 110 | + - Release Workflow runs (compile/release → upload) |
| 111 | + - This creates a new version, GitHub release, and deploys to Particle |
| 112 | + |
| 113 | +3. **When pushing directly to master**: |
| 114 | + - Release Workflow runs (same as merging a PR) |
| 115 | + - This is for quick changes that don't require a PR |
| 116 | + |
| 117 | +## Usage Notes |
| 118 | + |
| 119 | +1. For initial testing, use the individual manual workflows to check each step separately |
| 120 | +2. Once confident, open a PR to trigger the full PR workflow |
| 121 | +3. After reviewing and approving, merge the PR to trigger the release workflow |
| 122 | +4. Manual workflows provide a way to test specific stages of the pipeline in isolation |
0 commit comments