2020-08-31 20:12:18 +00:00
|
|
|
name: 'CI'
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2020-09-27 23:36:32 +00:00
|
|
|
paths-ignore:
|
2020-11-09 07:56:45 +00:00
|
|
|
- 'wiki/**'
|
|
|
|
- 'wiki_static/**'
|
2020-08-31 20:12:18 +00:00
|
|
|
|
2021-02-25 10:40:15 +00:00
|
|
|
env:
|
2021-05-18 09:23:14 +00:00
|
|
|
TARGETS: f5 f6
|
2021-02-25 10:40:15 +00:00
|
|
|
|
2020-08-31 20:12:18 +00:00
|
|
|
jobs:
|
|
|
|
build:
|
2021-01-06 20:51:01 +00:00
|
|
|
runs-on: [self-hosted]
|
2020-08-31 20:12:18 +00:00
|
|
|
steps:
|
2021-01-07 16:10:07 +00:00
|
|
|
- name: Cleanup workspace
|
|
|
|
uses: AutoModality/action-clean@v1
|
|
|
|
|
2020-08-31 20:12:18 +00:00
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
2020-10-07 09:37:43 +00:00
|
|
|
with:
|
2020-11-16 14:51:48 +00:00
|
|
|
fetch-depth: 0
|
2021-03-25 17:48:58 +00:00
|
|
|
- name: Checkout submodules
|
|
|
|
run: git submodule update --init --recursive
|
|
|
|
- name: Checkout submodules
|
|
|
|
run: git submodule sync
|
|
|
|
|
2021-02-14 23:53:17 +00:00
|
|
|
- uses: satackey/action-docker-layer-caching@v0.0.11
|
2020-09-17 08:06:25 +00:00
|
|
|
continue-on-error: true
|
|
|
|
with:
|
2020-09-17 09:11:06 +00:00
|
|
|
key: docker-cache-${{ hashFiles('docker/**') }}-{hash}
|
|
|
|
restore-keys: docker-cache-${{ hashFiles('docker/**') }}-
|
2020-08-31 20:12:18 +00:00
|
|
|
- name: Build docker image
|
|
|
|
uses: ./.github/actions/docker
|
|
|
|
|
2020-09-29 23:18:30 +00:00
|
|
|
- name: Check syntax
|
|
|
|
uses: ./.github/actions/docker
|
2020-10-15 16:50:21 +00:00
|
|
|
continue-on-error: false
|
2020-09-29 23:18:30 +00:00
|
|
|
with:
|
|
|
|
run: /syntax_check.sh
|
|
|
|
|
2021-02-25 10:40:15 +00:00
|
|
|
- name: Build bootloader in docker
|
2020-11-06 10:52:50 +00:00
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
2021-05-18 09:23:14 +00:00
|
|
|
run: for TARGET in ${TARGETS}; do make -j$(nproc) -C bootloader TARGET=${TARGET}; done
|
2020-11-06 10:52:50 +00:00
|
|
|
|
2021-02-12 10:04:35 +00:00
|
|
|
- name: Generate dfu file for bootloader
|
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
2021-05-18 09:23:14 +00:00
|
|
|
run: for TARGET in ${TARGETS}; do hex2dfu -i bootloader/.obj/${TARGET}/bootloader.hex -o bootloader/.obj/${TARGET}/bootloader.dfu; done
|
2021-02-12 10:04:35 +00:00
|
|
|
|
2021-02-25 10:40:15 +00:00
|
|
|
- name: Build firmware in docker
|
2020-11-06 10:52:50 +00:00
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
2021-05-18 09:23:14 +00:00
|
|
|
run: for TARGET in ${TARGETS}; do make -j$(nproc) -C firmware TARGET=${TARGET}; done
|
2020-11-06 10:52:50 +00:00
|
|
|
|
2021-02-12 10:04:35 +00:00
|
|
|
- name: Generate dfu file for firmware
|
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
2021-05-18 09:23:14 +00:00
|
|
|
run: for TARGET in ${TARGETS}; do hex2dfu -i firmware/.obj/${TARGET}/firmware.hex -o firmware/.obj/${TARGET}/firmware.dfu; done
|
2021-02-14 23:53:17 +00:00
|
|
|
|
|
|
|
- name: Generate full hex file
|
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
2021-05-18 09:23:14 +00:00
|
|
|
run: |
|
|
|
|
for TARGET in ${TARGETS}; do
|
|
|
|
srec_cat bootloader/.obj/${TARGET}/bootloader.hex -Intel firmware/.obj/${TARGET}/firmware.hex -Intel -o ${TARGET}_full.hex -Intel
|
|
|
|
done
|
2021-02-14 23:53:17 +00:00
|
|
|
|
|
|
|
- name: Move upload files
|
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
|
|
|
run: |
|
2021-05-18 09:23:14 +00:00
|
|
|
for TARGET in ${TARGETS}; do
|
|
|
|
mv bootloader/.obj/${TARGET}/bootloader.dfu ${TARGET}_bootloader.dfu
|
|
|
|
mv bootloader/.obj/${TARGET}/bootloader.bin ${TARGET}_bootloader.bin
|
|
|
|
mv bootloader/.obj/${TARGET}/bootloader.elf ${TARGET}_bootloader.elf
|
|
|
|
mv firmware/.obj/${TARGET}/firmware.dfu ${TARGET}_firmware.dfu
|
|
|
|
mv firmware/.obj/${TARGET}/firmware.bin ${TARGET}_firmware.bin
|
|
|
|
mv firmware/.obj/${TARGET}/firmware.elf ${TARGET}_firmware.elf
|
|
|
|
done
|
2021-02-14 23:53:17 +00:00
|
|
|
|
|
|
|
- name: Generate full dfu file
|
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
2021-05-18 09:23:14 +00:00
|
|
|
run: for TARGET in ${TARGETS}; do hex2dfu -i ${TARGET}_full.hex -o ${TARGET}_full.dfu; done
|
2021-02-14 23:53:17 +00:00
|
|
|
|
|
|
|
- name: Copy bootloader for full.bin
|
2021-05-18 09:23:14 +00:00
|
|
|
run: for TARGET in ${TARGETS}; do cp ${TARGET}_bootloader.bin ${TARGET}_full.bin; done
|
2021-02-14 23:53:17 +00:00
|
|
|
- name: Truncate full.bin
|
2021-05-18 09:23:14 +00:00
|
|
|
run: for TARGET in ${TARGETS}; do truncate -s 32768 ${TARGET}_full.bin; done
|
2021-02-14 23:53:17 +00:00
|
|
|
- name: Add firmware.bin at full.bin
|
2021-05-18 09:23:14 +00:00
|
|
|
run: for TARGET in ${TARGETS}; do cat ${TARGET}_firmware.bin >> ${TARGET}_full.bin; done
|
2021-02-14 23:53:17 +00:00
|
|
|
|
2021-05-20 14:31:48 +00:00
|
|
|
- name: Copy last target to full.dfu
|
|
|
|
run: cp ${TARGETS##*" "}_full.dfu full.dfu
|
|
|
|
|
2021-02-25 10:40:15 +00:00
|
|
|
- name: Publish artifacts
|
2020-11-06 10:52:50 +00:00
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2021-02-25 10:40:15 +00:00
|
|
|
name: artifacts
|
2020-11-06 10:52:50 +00:00
|
|
|
path: |
|
2021-05-18 09:23:14 +00:00
|
|
|
*_bootloader.dfu
|
|
|
|
*_bootloader.bin
|
|
|
|
*_firmware.dfu
|
|
|
|
*_firmware.bin
|
|
|
|
*_full.dfu
|
|
|
|
*_full.bin
|
2021-05-20 14:31:48 +00:00
|
|
|
full.dfu
|
2020-11-06 10:52:50 +00:00
|
|
|
if-no-files-found: error
|
|
|
|
retention-days: 7
|
|
|
|
|
2020-10-30 13:32:07 +00:00
|
|
|
upload:
|
|
|
|
name: Upload artifacts to external storage
|
|
|
|
needs: build
|
2021-01-06 20:51:01 +00:00
|
|
|
runs-on: [self-hosted]
|
2020-10-30 13:32:07 +00:00
|
|
|
steps:
|
2021-02-14 23:53:17 +00:00
|
|
|
|
|
|
|
- name: Make empty dir
|
2021-02-15 22:50:20 +00:00
|
|
|
run: mkdir -p empty
|
2021-02-14 23:53:17 +00:00
|
|
|
|
|
|
|
- name: Clear upload dir
|
2020-10-30 13:32:07 +00:00
|
|
|
uses: burnett01/rsync-deployments@4.1
|
|
|
|
with:
|
2021-02-14 23:53:17 +00:00
|
|
|
switches: -cvzr --delete
|
|
|
|
path: empty/
|
2020-10-30 13:32:07 +00:00
|
|
|
remote_path: "${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${GITHUB_REF##*/}/"
|
|
|
|
remote_host: ${{ secrets.RSYNC_DEPLOY_HOST }}
|
2020-12-08 23:31:45 +00:00
|
|
|
remote_port: ${{ secrets.RSYNC_DEPLOY_PORT }}
|
2020-10-30 13:32:07 +00:00
|
|
|
remote_user: ${{ secrets.RSYNC_DEPLOY_USER }}
|
2021-05-18 09:23:14 +00:00
|
|
|
remote_key: ${{ secrets.RSYNC_DEPLOY_KEY }}
|
2020-11-09 07:56:45 +00:00
|
|
|
|
2021-02-14 23:53:17 +00:00
|
|
|
- name: Generate files list
|
2021-05-20 14:31:48 +00:00
|
|
|
run: ls *_bootloader.dfu *_firmware.dfu *_full.dfu *_bootloader.bin *_firmware.bin *_full.bin *_bootloader.elf *_firmware.elf full.dfu > uploadlist.txt
|
2021-02-14 23:53:17 +00:00
|
|
|
|
|
|
|
- name: Upload artifacts
|
2020-11-09 07:56:45 +00:00
|
|
|
uses: burnett01/rsync-deployments@4.1
|
|
|
|
with:
|
2021-02-14 23:53:17 +00:00
|
|
|
switches: -cvzr --delete --files-from=uploadlist.txt
|
|
|
|
remote_path: "${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${GITHUB_REF##*/}/"
|
2020-11-09 07:56:45 +00:00
|
|
|
remote_host: ${{ secrets.RSYNC_DEPLOY_HOST }}
|
2020-12-08 23:31:45 +00:00
|
|
|
remote_port: ${{ secrets.RSYNC_DEPLOY_PORT }}
|
2020-11-09 07:56:45 +00:00
|
|
|
remote_user: ${{ secrets.RSYNC_DEPLOY_USER }}
|
|
|
|
remote_key: ${{ secrets.RSYNC_DEPLOY_KEY }}
|
|
|
|
|
|
|
|
genpic:
|
|
|
|
name: Generate pic
|
2021-02-14 23:53:17 +00:00
|
|
|
needs: upload
|
2020-11-09 07:56:45 +00:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2021-01-06 20:51:01 +00:00
|
|
|
runs-on: [self-hosted]
|
2020-11-09 07:56:45 +00:00
|
|
|
steps:
|
|
|
|
- name: Set test env
|
|
|
|
run: echo "NUMBER_OF_COMMITS=$(git rev-list --count HEAD)" >> $GITHUB_ENV
|
|
|
|
- name: Test output NUMBER_OF_COMMITS
|
|
|
|
run: echo $NUMBER_OF_COMMITS
|
|
|
|
- name: Test output date
|
|
|
|
run: |
|
|
|
|
GET_DATE=$(date +"%b %d")
|
|
|
|
PREP_DATE=$(echo "${GET_DATE^^}")
|
|
|
|
echo "PREP_DATE=$PREP_DATE" >> $GITHUB_ENV
|
|
|
|
- name: Test output PREP_DATE
|
2021-05-18 09:23:14 +00:00
|
|
|
run: echo $PREP_DATE
|
2020-11-09 07:56:45 +00:00
|
|
|
- name: Gen pic
|
2021-03-18 11:26:02 +00:00
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
|
|
|
run: convert ./.github/assets/latest-firmware-template.png -font ./.github/assets/Born2bSportyV2.ttf -weight 700 -pointsize 140 -annotate +900+330 "$NUMBER_OF_COMMITS $PREP_DATE" latest-firmware-banner.png
|
2020-11-09 07:56:45 +00:00
|
|
|
- name: Upload pic
|
|
|
|
uses: burnett01/rsync-deployments@4.1
|
|
|
|
with:
|
|
|
|
switches: -avzp --delete
|
2020-11-15 10:14:52 +00:00
|
|
|
path: latest-firmware-banner.png
|
2020-11-09 07:56:45 +00:00
|
|
|
remote_path: "${{ secrets.RSYNC_DEPLOY_BASE_PATH }}/"
|
|
|
|
remote_host: ${{ secrets.RSYNC_DEPLOY_HOST }}
|
2020-12-08 23:31:45 +00:00
|
|
|
remote_port: ${{ secrets.RSYNC_DEPLOY_PORT }}
|
2020-11-09 07:56:45 +00:00
|
|
|
remote_user: ${{ secrets.RSYNC_DEPLOY_USER }}
|
|
|
|
remote_key: ${{ secrets.RSYNC_DEPLOY_KEY }}
|