diff --git a/.github/workflows/build_firmware.yml b/.github/workflows/build_firmware.yml new file mode 100644 index 0000000..7bf5290 --- /dev/null +++ b/.github/workflows/build_firmware.yml @@ -0,0 +1,64 @@ +name: build firmware + +# this workflow builds firmware for selected modules +# and uploads compiled firmware as artifacts + +# specify modules to build for in the matrix module property below +# possible values are: ansible, teletype, whitewhale, meadowphysics, earthsea + +# the workflow has to be triggered manually +# you can configure it to trigger on other events, like push or pull_request: + +# on: +# push: +# branches: [main] + +# on: +# pull_request: +# types: [opened, reopened] + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + module: [ansible, teletype] + + steps: + - uses: actions/checkout@v2 + with: + submodules: 'recursive' + fetch-depth: '0' + + - name: restore toolchain + run: | + git clone https://github.com/monome/avr32-toolchain-linux.git deps/avr32-toolchain-linux + cd deps/avr32-toolchain-linux + tar xvfz avr32-gnu-toolchain-3.4.3.820-linux.any.x86_64.tar.gz + mv avr32-gnu-toolchain-linux_x86_64 $HOME/avr32-tools + unzip avr32-headers-6.2.0.742.zip -d $HOME/avr32-tools/avr32/include + + - name: build firmware + run: | + PATH="$HOME/avr32-tools/bin:$PATH" + cd multipass/monome_euro/${{matrix.module}} + find ../../.. -name '*.o' -delete + make + + - name: prepare files + id: get_file_name + run: | + HEX_FILE_PATH=`echo multipass/monome_euro/${{matrix.module}}/*.hex "$1"` + HEX_FILE=`basename $HEX_FILE_PATH` + NAMED_FILE=`echo "${HEX_FILE//multipass_/${{github.event.repository.name}}_}"` + echo ::set-output name=named_file::$NAMED_FILE + mv $HEX_FILE_PATH $NAMED_FILE + + - name: upload artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.get_file_name.outputs.named_file }} + path: ${{ steps.get_file_name.outputs.named_file }} diff --git a/.github/workflows/upload_release.yml b/.github/workflows/upload_release.yml new file mode 100644 index 0000000..dc53518 --- /dev/null +++ b/.github/workflows/upload_release.yml @@ -0,0 +1,95 @@ +name: upload release + +# this workflow builds and uploads firmware for selected modules +# to the latest release (both hex and zip) whenever a new release is created + +# specify modules to build for in the matrix module property below +# possible values are: ansible, teletype, whitewhale, meadowphysics, earthsea + +on: + release: + types: [created] + +jobs: + release: + runs-on: ubuntu-latest + strategy: + matrix: + module: [ansible, teletype, whitewhale, meadowphysics, earthsea] + + steps: + - uses: actions/checkout@v2 + with: + submodules: 'recursive' + fetch-depth: '0' + + - name: restore toolchain + run: | + git clone https://github.com/monome/avr32-toolchain-linux.git deps/avr32-toolchain-linux + cd deps/avr32-toolchain-linux + tar xvfz avr32-gnu-toolchain-3.4.3.820-linux.any.x86_64.tar.gz + mv avr32-gnu-toolchain-linux_x86_64 $HOME/avr32-tools + unzip avr32-headers-6.2.0.742.zip -d $HOME/avr32-tools/avr32/include + + - name: build firmware + run: | + PATH="$HOME/avr32-tools/bin:$PATH" + cd multipass/monome_euro/${{matrix.module}} + find ../../.. -name '*.o' -delete + make + + - name: determine file names + id: file_names + run: | + HEX_FILE_PATH=`echo multipass/monome_euro/${{matrix.module}}/*.hex "$1"` + HEX_FILE=`basename $HEX_FILE_PATH` + NAMED_FILE=`echo "${HEX_FILE//multipass_/${{github.event.repository.name}}_}"` + ZIP_FILE=`echo "${NAMED_FILE//hex/zip}"` + echo ::set-output name=hex_file_path::$HEX_FILE_PATH + echo ::set-output name=named_file::$NAMED_FILE + echo ::set-output name=zip_file::$ZIP_FILE + + - name: create flash command + if: matrix.module == 'ansible' || matrix.module == 'teletype' + run: | + echo "dfu-programmer at32uc3b0512 erase" >> flash.sh + echo "dfu-programmer at32uc3b0512 flash ${{steps.file_names.outputs.named_file}} --suppress-bootloader-mem" >> flash.sh + echo "dfu-programmer at32uc3b0512 start" >> flash.sh + + - name: create flash command + if: matrix.module != 'ansible' && matrix.module != 'teletype' + run: | + echo "dfu-programmer at32uc3b0256 erase" >> flash.sh + echo "dfu-programmer at32uc3b0256 flash ${{steps.file_names.outputs.named_file}} --suppress-bootloader-mem" >> flash.sh + echo "dfu-programmer at32uc3b0256 start" >> flash.sh + + - name: prepare files + run: | + mv ${{ steps.file_names.outputs.hex_file_path }} ${{ steps.file_names.outputs.named_file }} + zip -j ${{ steps.file_names.outputs.zip_file }} ${{ steps.file_names.outputs.named_file }} flash.sh + + - name: find release + id: find_release + uses: scanner-darkly/get-release@f589ce0779c7bef1faf175f7488c972eb47dc046 + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: add zip to release + uses: scanner-darkly/upload-release-asset@e9f0662bdf9868f4aac644f0eedc2b56567fdba8 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.find_release.outputs.upload_url }} + asset_name: ${{ steps.file_names.outputs.zip_file }} + asset_path: ./${{ steps.file_names.outputs.zip_file }} + asset_content_type: application/zip + + - name: add hex to release + uses: scanner-darkly/upload-release-asset@e9f0662bdf9868f4aac644f0eedc2b56567fdba8 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.find_release.outputs.upload_url }} + asset_name: ${{ steps.file_names.outputs.named_file }} + asset_path: ./${{ steps.file_names.outputs.named_file }} + asset_content_type: application/octet-stream