firmware/.github/workflows/main_matrix.yml

356 lines
11 KiB
YAML
Raw Normal View History

2022-05-12 10:03:53 +00:00
name: CI
#concurrency:
# group: ${{ github.ref }}
# cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
on:
# # Triggers the workflow on push but only for the master branch
push:
2022-11-05 14:21:51 +00:00
branches: [master, develop]
paths-ignore:
2022-03-09 13:04:49 +00:00
- "**.md"
- version.properties
2022-03-09 13:04:49 +00:00
# Note: This is different from "pull_request". Need to specify ref when doing checkouts.
pull_request_target:
2022-11-05 14:21:51 +00:00
branches: [master, develop]
paths-ignore:
2022-03-09 13:04:49 +00:00
- "**.md"
2022-10-05 16:18:37 +00:00
#- "**.yml"
workflow_dispatch:
jobs:
setup:
strategy:
fail-fast: false
matrix:
arch: [esp32, esp32s3, esp32c3, nrf52840, rp2040, stm32, check]
runs-on: ubuntu-latest
steps:
- id: checkout
uses: actions/checkout@v4
name: Checkout base
- id: jsonStep
run: |
TARGETS=$(./bin/generate_ci_matrix.py ${{matrix.arch}})
echo "$TARGETS"
echo "${{matrix.arch}}=$(jq -cn --argjson environments "$TARGETS" '{board: $environments}')" >> $GITHUB_OUTPUT
outputs:
esp32: ${{ steps.jsonStep.outputs.esp32 }}
esp32s3: ${{ steps.jsonStep.outputs.esp32s3 }}
esp32c3: ${{ steps.jsonStep.outputs.esp32c3 }}
nrf52840: ${{ steps.jsonStep.outputs.nrf52840 }}
rp2040: ${{ steps.jsonStep.outputs.rp2040 }}
stm32: ${{ steps.jsonStep.outputs.stm32 }}
check: ${{ steps.jsonStep.outputs.check }}
check:
needs: setup
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup.outputs.check) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
2022-11-20 01:23:35 +00:00
- name: Build base
id: base
uses: ./.github/actions/setup-base
2022-03-09 13:04:49 +00:00
- name: Check ${{ matrix.board }}
run: bin/check-all.sh ${{ matrix.board }}
build-esp32:
needs: setup
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup.outputs.esp32) }}
2022-11-19 23:35:47 +00:00
uses: ./.github/workflows/build_esp32.yml
2022-11-19 23:45:33 +00:00
with:
board: ${{ matrix.board }}
2023-03-09 07:44:39 +00:00
build-esp32-s3:
needs: setup
2023-03-09 07:44:39 +00:00
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup.outputs.esp32s3) }}
2023-03-09 07:44:39 +00:00
uses: ./.github/workflows/build_esp32_s3.yml
with:
board: ${{ matrix.board }}
2023-03-09 08:04:08 +00:00
2024-03-07 14:03:01 +00:00
build-esp32-c3:
needs: setup
2024-03-07 14:03:01 +00:00
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup.outputs.esp32c3) }}
2024-03-07 14:03:01 +00:00
uses: ./.github/workflows/build_esp32_c3.yml
with:
board: ${{ matrix.board }}
build-nrf52:
needs: setup
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup.outputs.nrf52840) }}
2022-11-20 01:30:19 +00:00
uses: ./.github/workflows/build_nrf52.yml
with:
board: ${{ matrix.board }}
build-rpi2040:
needs: setup
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup.outputs.rp2040) }}
uses: ./.github/workflows/build_rpi2040.yml
with:
board: ${{ matrix.board }}
build-stm32:
needs: setup
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.setup.outputs.stm32) }}
uses: ./.github/workflows/build_stm32.yml
with:
board: ${{ matrix.board }}
2023-11-19 22:41:47 +00:00
package-raspbian:
uses: ./.github/workflows/package_raspbian.yml
2024-05-19 23:00:06 +00:00
package-raspbian-armv7l:
uses: ./.github/workflows/package_raspbian_armv7l.yml
2024-06-05 14:29:40 +00:00
package-native:
uses: ./.github/workflows/package_amd64.yml
after-checks:
runs-on: ubuntu-latest
needs: [check]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
2022-08-10 23:00:41 +00:00
gather-artifacts:
2023-12-08 03:22:30 +00:00
permissions:
2023-12-08 03:29:04 +00:00
contents: write
pull-requests: write
runs-on: ubuntu-latest
needs:
[
build-esp32,
build-esp32-s3,
2024-03-07 14:03:01 +00:00
build-esp32-c3,
build-nrf52,
build-rpi2040,
2024-07-27 11:49:50 +00:00
build-stm32,
2023-11-19 22:41:47 +00:00
package-raspbian,
2024-05-19 23:00:06 +00:00
package-raspbian-armv7l,
package-native,
]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: actions/download-artifact@v4
with:
path: ./
merge-multiple: true
2023-11-18 21:16:36 +00:00
- name: Display structure of downloaded files
run: ls -R
- name: Get release version string
2022-10-19 15:44:09 +00:00
run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
id: version
2024-05-13 09:45:22 +00:00
- name: Move files up
2024-06-09 14:33:50 +00:00
run: mv -b -t ./ ./release/meshtasticd_linux_* ./bin/config-dist.yaml ./bin/device-*.sh ./bin/device-*.bat
2024-05-13 09:45:22 +00:00
- name: Repackage in single firmware zip
uses: actions/upload-artifact@v4
with:
name: firmware-${{ steps.version.outputs.version }}
overwrite: true
2022-03-09 13:04:49 +00:00
path: |
./firmware-*.bin
./firmware-*.uf2
./firmware-*.hex
./firmware-*-ota.zip
./device-*.sh
./device-*.bat
2024-05-21 14:07:47 +00:00
./meshtasticd_linux_*
2023-11-19 23:11:54 +00:00
./config-dist.yaml
2024-05-13 09:45:22 +00:00
./littlefs-*.bin
./bleota*bin
./Meshtastic_nRF52_factory_erase*.uf2
retention-days: 90
- uses: actions/download-artifact@v4
with:
name: firmware-${{ steps.version.outputs.version }}
merge-multiple: true
path: ./output
# For diagnostics
2022-03-09 13:04:49 +00:00
- name: Show artifacts
run: ls -lR
2022-10-31 08:47:10 +00:00
2022-08-20 17:53:34 +00:00
- name: Device scripts permissions
run: |
chmod +x ./output/device-install.sh
2023-07-24 12:22:04 +00:00
chmod +x ./output/device-update.sh
- name: Zip firmware
2022-11-24 12:07:37 +00:00
run: zip -j -9 -r ./firmware-${{ steps.version.outputs.version }}.zip ./output
- name: Repackage in single elfs zip
uses: actions/upload-artifact@v4
with:
name: debug-elfs-${{ steps.version.outputs.version }}.zip
overwrite: true
path: ./*.elf
2022-11-09 13:20:53 +00:00
retention-days: 30
- name: Create request artifacts
2023-07-24 11:54:05 +00:00
continue-on-error: true # FIXME: Why are we getting 502, but things still work?
if: ${{ github.event_name == 'pull_request_target' || github.event_name == 'pull_request' }}
2023-12-08 02:22:22 +00:00
uses: gavv/pull-request-artifacts@v2.1.0
with:
commit: ${{ (github.event.pull_request_target || github.event.pull_request).head.sha }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
2022-03-06 14:50:42 +00:00
artifacts-token: ${{ secrets.ARTIFACTS_TOKEN }}
artifacts-repo: meshtastic/artifacts
artifacts-branch: device
artifacts: ./firmware-${{ steps.version.outputs.version }}.zip
2022-08-10 22:59:47 +00:00
release-artifacts:
runs-on: ubuntu-latest
2022-08-11 20:58:16 +00:00
if: ${{ github.event_name == 'workflow_dispatch' }}
2022-08-12 00:23:51 +00:00
needs: [gather-artifacts, after-checks]
steps:
2022-08-11 20:58:16 +00:00
- name: Checkout
uses: actions/checkout@v4
2022-10-31 08:47:10 +00:00
2022-08-11 20:58:16 +00:00
- name: Setup Python
uses: actions/setup-python@v5
with:
2022-08-11 20:58:16 +00:00
python-version: 3.x
- name: Get release version string
2022-10-19 15:44:09 +00:00
run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
2022-08-11 20:58:16 +00:00
id: version
- uses: actions/download-artifact@v4
with:
name: firmware-${{ steps.version.outputs.version }}
merge-multiple: true
path: ./output
2023-11-19 23:11:54 +00:00
2023-11-18 20:56:40 +00:00
- name: Display structure of downloaded files
run: ls -R
2022-08-14 20:56:55 +00:00
- name: Device scripts permissions
run: |
chmod +x ./output/device-install.sh
chmod +x ./output/device-update.sh
- name: Zip firmware
run: zip -j -9 -r ./firmware-${{ steps.version.outputs.version }}.zip ./output -x meshtasticd_*
- uses: actions/download-artifact@v4
2022-08-10 22:59:47 +00:00
with:
name: debug-elfs-${{ steps.version.outputs.version }}.zip
merge-multiple: true
path: ./elfs
2022-10-31 08:47:10 +00:00
- name: Zip Elfs
2022-11-24 12:07:37 +00:00
run: zip -j -9 -r ./debug-elfs-${{ steps.version.outputs.version }}.zip ./elfs
# For diagnostics
- name: Show artifacts
run: ls -lR
2022-08-10 22:59:47 +00:00
- name: Create release
uses: actions/create-release@v1
id: create_release
with:
draft: true
prerelease: true
2023-07-09 11:17:17 +00:00
release_name: Meshtastic Firmware ${{ steps.version.outputs.version }} Alpha
2022-08-10 22:59:47 +00:00
tag_name: v${{ steps.version.outputs.version }}
body: |
Autogenerated by github action, developer should edit as required before publishing...
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Add bins to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
2022-08-11 00:21:59 +00:00
asset_path: ./firmware-${{ steps.version.outputs.version }}.zip
2022-08-10 22:59:47 +00:00
asset_name: firmware-${{ steps.version.outputs.version }}.zip
asset_content_type: application/zip
2022-08-11 00:25:27 +00:00
- name: Add debug elfs to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
2022-08-11 12:07:04 +00:00
asset_path: ./debug-elfs-${{ steps.version.outputs.version }}.zip
2022-08-11 00:25:27 +00:00
asset_name: debug-elfs-${{ steps.version.outputs.version }}.zip
2022-08-11 14:03:18 +00:00
asset_content_type: application/zip
2022-08-11 20:58:16 +00:00
- uses: actions/download-artifact@v4
with:
pattern: meshtasticd_${{ steps.version.outputs.version }}_*.deb
merge-multiple: true
path: ./output
2024-05-19 23:00:06 +00:00
- name: Add raspbian aarch64 .deb
2023-11-19 22:41:47 +00:00
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
2024-05-21 16:23:29 +00:00
asset_path: ./output/meshtasticd_${{ steps.version.outputs.version }}_arm64.deb
2023-11-19 22:41:47 +00:00
asset_name: meshtasticd_${{ steps.version.outputs.version }}_arm64.deb
asset_content_type: application/vnd.debian.binary-package
2024-05-19 23:00:06 +00:00
- name: Add raspbian armv7l .deb
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
2024-05-21 16:23:29 +00:00
asset_path: ./output/meshtasticd_${{ steps.version.outputs.version }}_armhf.deb
2024-05-19 23:00:06 +00:00
asset_name: meshtasticd_${{ steps.version.outputs.version }}_armhf.deb
asset_content_type: application/vnd.debian.binary-package
2024-06-05 15:50:58 +00:00
- name: Add raspbian amd64 .deb
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./output/meshtasticd_${{ steps.version.outputs.version }}_amd64.deb
asset_name: meshtasticd_${{ steps.version.outputs.version }}_amd64.deb
asset_content_type: application/vnd.debian.binary-package
2022-08-12 12:21:20 +00:00
- name: Bump version.properties
2022-08-11 20:58:16 +00:00
run: >-
bin/bump_version.py
2022-10-31 08:47:10 +00:00
2022-08-22 23:31:56 +00:00
- name: Create version.properties pull request
2024-05-13 09:45:22 +00:00
uses: peter-evans/create-pull-request@v6
2022-08-22 23:31:56 +00:00
with:
add-paths: |
version.properties