From a4d5f8c7173fdec2fe80c8c992b6dc12f07814eb Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 19 Nov 2022 16:03:55 -0600 Subject: [PATCH] Reusable workflow --- .github/workflows/build_esp32.yml | 77 +++++++++++++++++++++++++++++++ .github/workflows/main_matrix.yml | 67 ++------------------------- 2 files changed, 80 insertions(+), 64 deletions(-) create mode 100644 .github/workflows/build_esp32.yml diff --git a/.github/workflows/build_esp32.yml b/.github/workflows/build_esp32.yml new file mode 100644 index 000000000..7b618604b --- /dev/null +++ b/.github/workflows/build_esp32.yml @@ -0,0 +1,77 @@ +name: Build ESP32 + +on: + workflow_call: + inputs: + board: + required: true + type: string + +jobs: + build-esp32: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + submodules: "recursive" + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.x + + - name: Cache python libs + uses: actions/cache@v3 + id: cache-pip # needed in if test + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip + + - name: Upgrade python tools + run: | + python -m pip install --upgrade pip + pip install -U platformio adafruit-nrfutil + + - name: Upgrade platformio + run: | + pio upgrade + + - name: Pull web ui + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: "meshtastic/web" + file: "build.tar" + target: "build.tar" + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Unpack web ui + run: | + tar -xf build.tar -C data/static + rm build.tar + + - name: Build ESP32 + run: bin/build-esp32.sh ${{ inputs.board }} + + - name: Pull OTA Firmware + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: "meshtastic/firmware-ota" + file: "firmware.bin" + target: "release/bleota.bin" + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Get release version string + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - name: Store binaries as an artifact + uses: actions/upload-artifact@v3 + with: + name: firmware-${{ inputs.board }}-${{ steps.version.outputs.version }}.zip + path: | + release/*.bin + release/*.elf + retention-days: 30 \ No newline at end of file diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index f58eccca7..b461d9d26 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -97,70 +97,9 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - submodules: "recursive" - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: 3.x - - - name: Cache python libs - uses: actions/cache@v3 - id: cache-pip # needed in if test - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip - - - name: Upgrade python tools - run: | - python -m pip install --upgrade pip - pip install -U platformio adafruit-nrfutil - - - name: Upgrade platformio - run: | - pio upgrade - - - name: Pull web ui - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: "meshtastic/web" - file: "build.tar" - target: "build.tar" - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Unpack web ui - run: | - tar -xf build.tar -C data/static - rm build.tar - - - name: Build ESP32 - run: bin/build-esp32.sh ${{ matrix.board }} - - - name: Pull OTA Firmware - uses: dsaltares/fetch-gh-release-asset@master - with: - repo: "meshtastic/firmware-ota" - file: "firmware.bin" - target: "release/bleota.bin" - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Get release version string - run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT - id: version - - - name: Store binaries as an artifact - uses: actions/upload-artifact@v3 - with: - name: firmware-${{ matrix.board }}-${{ steps.version.outputs.version }}.zip - path: | - release/*.bin - release/*.elf - retention-days: 30 + uses: ./.github/workflows/build_esp32.yml + with: + board: ${{ matrix.board }} build-nrf52: strategy: