First attempt at power.cpp split #27114
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| concurrency: | |
| group: ci-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| on: | |
| # # Triggers the workflow on push but only for the main branches | |
| push: | |
| branches: | |
| - master | |
| - develop | |
| - pioarduino # Remove when merged // use `feature/` in the future. | |
| - event/* | |
| - feature/* | |
| paths-ignore: | |
| - "**.md" | |
| - version.properties | |
| pull_request: | |
| branches: | |
| - master | |
| - develop | |
| - pioarduino # Remove when merged // use `feature/` in the future. | |
| - event/* | |
| - feature/* | |
| paths-ignore: | |
| - "**.md" | |
| #- "**.yml" | |
| workflow_dispatch: | |
| permissions: read-all | |
| jobs: | |
| setup: | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| arch: | |
| - all | |
| - check | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.x | |
| cache: pip | |
| - run: pip install -U platformio | |
| - name: Generate matrix | |
| id: jsonStep | |
| run: | | |
| if [[ "$GITHUB_HEAD_REF" == "" ]]; then | |
| TARGETS=$(./bin/generate_ci_matrix.py ${{matrix.arch}}) | |
| else | |
| TARGETS=$(./bin/generate_ci_matrix.py ${{matrix.arch}} --level pr) | |
| fi | |
| echo "Name: $GITHUB_REF_NAME Base: $GITHUB_BASE_REF Ref: $GITHUB_REF" | |
| echo "${{matrix.arch}}=$TARGETS" >> $GITHUB_OUTPUT | |
| echo "$TARGETS" >> $GITHUB_STEP_SUMMARY | |
| outputs: | |
| all: ${{ steps.jsonStep.outputs.all }} | |
| check: ${{ steps.jsonStep.outputs.check }} | |
| version: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Get release version string | |
| run: | | |
| echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT | |
| echo "deb=$(./bin/buildinfo.py deb)" >> $GITHUB_OUTPUT | |
| id: version | |
| env: | |
| BUILD_LOCATION: local | |
| outputs: | |
| long: ${{ steps.version.outputs.long }} | |
| deb: ${{ steps.version.outputs.deb }} | |
| check: | |
| needs: setup | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| check: ${{ fromJson(needs.setup.outputs.check) }} | |
| # Use 'arctastic' self-hosted runner pool when checking in the main repo | |
| runs-on: ${{ github.repository_owner == 'meshtastic' && 'arctastic' || 'ubuntu-latest' }} | |
| if: ${{ github.event_name != 'workflow_dispatch' && github.repository == 'meshtastic/firmware' }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: Check ${{ matrix.check.board }} | |
| uses: meshtastic/gh-action-firmware@main | |
| with: | |
| pio_platform: ${{ matrix.check.platform }} | |
| pio_env: ${{ matrix.check.board }} | |
| pio_target: check | |
| build: | |
| needs: [setup, version] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| build: ${{ fromJson(needs.setup.outputs.all) }} | |
| uses: ./.github/workflows/build_firmware.yml | |
| with: | |
| version: ${{ needs.version.outputs.long }} | |
| pio_env: ${{ matrix.build.board }} | |
| platform: ${{ matrix.build.platform }} | |
| build-debian-src: | |
| if: github.repository == 'meshtastic/firmware' | |
| uses: ./.github/workflows/build_debian_src.yml | |
| with: | |
| series: UNRELEASED | |
| build_location: local | |
| secrets: inherit | |
| package-pio-deps-native-tft: | |
| if: ${{ github.repository == 'meshtastic/firmware' && github.event_name == 'workflow_dispatch' }} | |
| uses: ./.github/workflows/package_pio_deps.yml | |
| with: | |
| pio_env: native-tft | |
| secrets: inherit | |
| test-native: | |
| if: ${{ !contains(github.ref_name, 'event/') && github.repository == 'meshtastic/firmware' }} | |
| permissions: # Needed for dorny/test-reporter. | |
| contents: read | |
| actions: read | |
| checks: write | |
| uses: ./.github/workflows/test_native.yml | |
| docker: | |
| permissions: # Needed for pushing to GHCR. | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| distro: [debian, alpine] | |
| platform: [linux/amd64, linux/arm64, linux/arm/v7] | |
| pio_env: [native, native-tft] | |
| exclude: | |
| - distro: alpine | |
| platform: linux/arm/v7 | |
| - pio_env: native-tft | |
| platform: linux/arm64 | |
| - pio_env: native-tft | |
| platform: linux/arm/v7 | |
| uses: ./.github/workflows/docker_build.yml | |
| with: | |
| distro: ${{ matrix.distro }} | |
| platform: ${{ matrix.platform }} | |
| runs-on: ${{ contains(matrix.platform, 'arm') && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }} | |
| pio_env: ${{ matrix.pio_env }} | |
| push: false | |
| gather-artifacts: | |
| # trunk-ignore(checkov/CKV2_GHA_1) | |
| if: github.repository == 'meshtastic/firmware' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: | |
| - esp32 | |
| - esp32s3 | |
| - esp32c3 | |
| - esp32c6 | |
| - nrf52840 | |
| - rp2040 | |
| - rp2350 | |
| - stm32 | |
| runs-on: ubuntu-latest | |
| needs: [version, build] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| path: ./ | |
| pattern: firmware-${{matrix.arch}}-* | |
| merge-multiple: true | |
| - name: Display structure of downloaded files | |
| run: ls -R | |
| - name: Repackage in single firmware zip | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: firmware-${{matrix.arch}}-${{ needs.version.outputs.long }} | |
| overwrite: true | |
| path: | | |
| ./firmware-*.mt.json | |
| ./firmware-*.bin | |
| ./firmware-*.uf2 | |
| ./firmware-*.hex | |
| ./firmware-*.zip | |
| ./device-*.sh | |
| ./device-*.bat | |
| ./littlefs-*.bin | |
| ./bleota*bin | |
| ./mt-*-ota.bin | |
| ./Meshtastic_nRF52_factory_erase*.uf2 | |
| retention-days: 30 | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: firmware-${{matrix.arch}}-${{ needs.version.outputs.long }} | |
| merge-multiple: true | |
| path: ./output | |
| # For diagnostics | |
| - name: Show artifacts | |
| run: ls -lR | |
| - name: Device scripts permissions | |
| run: | | |
| chmod +x ./output/device-install.sh || true | |
| chmod +x ./output/device-update.sh || true | |
| - name: Zip firmware | |
| run: zip -j -9 -r ./firmware-${{matrix.arch}}-${{ needs.version.outputs.long }}.zip ./output | |
| - name: Repackage in single elfs zip | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: debug-elfs-${{matrix.arch}}-${{ needs.version.outputs.long }} | |
| overwrite: true | |
| path: ./*.elf | |
| retention-days: 30 | |
| shame: | |
| if: github.repository == 'meshtastic/firmware' | |
| continue-on-error: true | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| if: github.event_name == 'pull_request' | |
| with: | |
| filter: blob:none # means we download all the git history but none of the commit (except ones with checkout like the head) | |
| fetch-depth: 0 | |
| - name: Download the current manifests | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: ./manifests-new/ | |
| pattern: manifest-* | |
| merge-multiple: true | |
| - name: Upload combined manifests for later commit and global stats crunching. | |
| uses: actions/upload-artifact@v7 | |
| id: upload-manifest | |
| with: | |
| name: manifests-${{ github.sha }} | |
| overwrite: true | |
| path: manifests-new/*.mt.json | |
| - name: Find the merge base | |
| if: github.event_name == 'pull_request' | |
| run: echo "MERGE_BASE=$(git merge-base "origin/$base" "$head")" >> $GITHUB_ENV | |
| env: | |
| base: ${{ github.base_ref }} | |
| head: ${{ github.sha }} | |
| # Currently broken (for-loop through EVERY artifact -- rate limiting) | |
| # - name: Download the old manifests | |
| # if: github.event_name == 'pull_request' | |
| # run: gh run download -R "$repo" --name "manifests-$merge_base" --dir manifest-old/ | |
| # env: | |
| # GH_TOKEN: ${{ github.token }} | |
| # merge_base: ${{ env.MERGE_BASE }} | |
| # repo: ${{ github.repository }} | |
| # - name: Do scan and post comment | |
| # if: github.event_name == 'pull_request' | |
| # run: python3 bin/shame.py ${{ github.event.pull_request.number }} manifests-old/ manifests-new/ | |
| release-artifacts: | |
| permissions: # Needed for 'gh release upload'. | |
| contents: write | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'workflow_dispatch' && github.repository == 'meshtastic/firmware' }} | |
| outputs: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| needs: | |
| - setup | |
| - version | |
| - gather-artifacts | |
| - build-debian-src | |
| - package-pio-deps-native-tft | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.x | |
| - name: Generate release notes | |
| id: release_notes | |
| run: | | |
| chmod +x ./bin/generate_release_notes.py | |
| NOTES=$(./bin/generate_release_notes.py ${{ needs.version.outputs.long }} --compare-ref HEAD 2>release_notes.log) | |
| echo "notes<<EOF" >> $GITHUB_OUTPUT | |
| echo "$NOTES" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| echo "### Release note range" >> $GITHUB_STEP_SUMMARY | |
| cat release_notes.log >> $GITHUB_STEP_SUMMARY | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create release | |
| uses: softprops/action-gh-release@v3 | |
| id: create_release | |
| with: | |
| draft: true | |
| prerelease: true | |
| name: Meshtastic Firmware ${{ needs.version.outputs.long }} Alpha | |
| tag_name: v${{ needs.version.outputs.long }} | |
| body: ${{ steps.release_notes.outputs.notes }} | |
| - name: Download source deb | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: firmware-debian-${{ needs.version.outputs.deb }}~UNRELEASED-src | |
| merge-multiple: true | |
| path: ./output/debian-src | |
| - name: Download `native-tft` pio deps | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: platformio-deps-native-tft-${{ needs.version.outputs.long }} | |
| merge-multiple: true | |
| path: ./output/pio-deps-native-tft | |
| - name: Zip Linux sources | |
| working-directory: output | |
| run: | | |
| zip -j -9 -r ./meshtasticd-${{ needs.version.outputs.deb }}-src.zip ./debian-src | |
| zip -9 -r ./platformio-deps-native-tft-${{ needs.version.outputs.long }}.zip ./pio-deps-native-tft | |
| # For diagnostics | |
| - name: Display structure of downloaded files | |
| run: ls -lR | |
| - name: Generate Release manifest | |
| run: | | |
| jq -n --arg ver "${{ needs.version.outputs.long }}" --argjson targets ${{ toJson(needs.setup.outputs.all) }} '{ | |
| "version": $ver, | |
| "targets": $targets | |
| }' > firmware-${{ needs.version.outputs.long }}.json | |
| - name: Save Release manifest artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: manifest-${{ needs.version.outputs.long }} | |
| overwrite: true | |
| path: firmware-${{ needs.version.outputs.long }}.json | |
| - name: Add sources to GitHub Release | |
| # Only run when targeting master branch with workflow_dispatch | |
| if: ${{ github.ref_name == 'master' }} | |
| run: | | |
| gh release upload v${{ needs.version.outputs.long }} ./firmware-${{ needs.version.outputs.long }}.json | |
| gh release upload v${{ needs.version.outputs.long }} ./output/meshtasticd-${{ needs.version.outputs.deb }}-src.zip | |
| gh release upload v${{ needs.version.outputs.long }} ./output/platformio-deps-native-tft-${{ needs.version.outputs.long }}.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| release-firmware: | |
| permissions: # Needed for 'gh release upload'. | |
| contents: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: | |
| - esp32 | |
| - esp32s3 | |
| - esp32c3 | |
| - esp32c6 | |
| - nrf52840 | |
| - rp2040 | |
| - rp2350 | |
| - stm32 | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'workflow_dispatch' && github.repository == 'meshtastic/firmware'}} | |
| needs: [release-artifacts, version] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.x | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| pattern: firmware-${{matrix.arch}}-${{ needs.version.outputs.long }} | |
| merge-multiple: true | |
| path: ./output | |
| - name: Display structure of downloaded files | |
| run: ls -lR | |
| - name: Device scripts permissions | |
| run: | | |
| chmod +x ./output/device-install.sh || true | |
| chmod +x ./output/device-update.sh || true | |
| - name: Zip firmware | |
| run: zip -j -9 -r ./firmware-${{matrix.arch}}-${{ needs.version.outputs.long }}.zip ./output | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: debug-elfs-${{matrix.arch}}-${{ needs.version.outputs.long }} | |
| merge-multiple: true | |
| path: ./elfs | |
| - name: Zip debug elfs | |
| run: zip -j -9 -r ./debug-elfs-${{matrix.arch}}-${{ needs.version.outputs.long }}.zip ./elfs | |
| # For diagnostics | |
| - name: Display structure of downloaded files | |
| run: ls -lR | |
| - name: Add bins and debug elfs to GitHub Release | |
| # Only run when targeting master branch with workflow_dispatch | |
| if: ${{ github.ref_name == 'master' }} | |
| run: | | |
| gh release upload v${{ needs.version.outputs.long }} ./firmware-${{matrix.arch}}-${{ needs.version.outputs.long }}.zip | |
| gh release upload v${{ needs.version.outputs.long }} ./debug-elfs-${{matrix.arch}}-${{ needs.version.outputs.long }}.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-firmware: | |
| runs-on: ubuntu-24.04 | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| needs: [release-firmware, version] | |
| env: | |
| targets: |- | |
| esp32,esp32s3,esp32c3,esp32c6,nrf52840,rp2040,rp2350,stm32 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.x | |
| - name: Get firmware artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: firmware-{${{ env.targets }}}-${{ needs.version.outputs.long }} | |
| merge-multiple: true | |
| path: ./publish | |
| - name: Get manifest artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: manifest-${{ needs.version.outputs.long }} | |
| path: ./publish | |
| - name: Generate release notes | |
| run: | | |
| chmod +x ./bin/generate_release_notes.py | |
| ./bin/generate_release_notes.py ${{ needs.version.outputs.long }} --compare-ref HEAD > ./publish/release_notes.md | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish firmware to meshtastic.github.io | |
| uses: peaceiris/actions-gh-pages@v4 | |
| env: | |
| # On event/* branches, use the event name as the destination prefix | |
| DEST_PREFIX: ${{ contains(github.ref_name, 'event/') && format('{0}/', github.ref_name) || '' }} | |
| with: | |
| deploy_key: ${{ secrets.DIST_PAGES_DEPLOY_KEY }} | |
| external_repository: meshtastic/meshtastic.github.io | |
| publish_branch: master | |
| publish_dir: ./publish | |
| destination_dir: ${{ env.DEST_PREFIX }}firmware-${{ needs.version.outputs.long }} | |
| keep_files: true | |
| user_name: github-actions[bot] | |
| user_email: github-actions[bot]@users.noreply.github.com | |
| commit_message: ${{ needs.version.outputs.long }} | |
| enable_jekyll: true |