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:
|
|
|
|
TARGET_VERSION: f5
|
|
|
|
|
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
|
|
|
|
submodules: true
|
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-02-25 10:40:15 +00:00
|
|
|
run: make -C bootloader TARGET=${TARGET_VERSION}
|
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-02-25 10:40:15 +00:00
|
|
|
run: hex2dfu -i bootloader/.obj/${TARGET_VERSION}/bootloader.hex -o bootloader/.obj/${TARGET_VERSION}/bootloader.dfu
|
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-02-25 10:40:15 +00:00
|
|
|
run: make -C firmware TARGET=${TARGET_VERSION} APP_RELEASE=1
|
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-02-25 10:40:15 +00:00
|
|
|
run: hex2dfu -i firmware/.obj/${TARGET_VERSION}/firmware.hex -o firmware/.obj/${TARGET_VERSION}/firmware.dfu
|
2021-02-14 23:53:17 +00:00
|
|
|
|
|
|
|
- name: Generate full hex file
|
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
2021-02-25 10:40:15 +00:00
|
|
|
run: srec_cat bootloader/.obj/${TARGET_VERSION}/bootloader.hex -Intel firmware/.obj/${TARGET_VERSION}/firmware.hex -Intel -o full.hex -Intel
|
2021-02-14 23:53:17 +00:00
|
|
|
|
|
|
|
- name: Move upload files
|
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
|
|
|
run: |
|
2021-02-25 10:40:15 +00:00
|
|
|
mv bootloader/.obj/${TARGET_VERSION}/bootloader.dfu bootloader.dfu
|
|
|
|
mv bootloader/.obj/${TARGET_VERSION}/bootloader.bin bootloader.bin
|
|
|
|
mv firmware/.obj/${TARGET_VERSION}/firmware.dfu firmware.dfu
|
|
|
|
mv firmware/.obj/${TARGET_VERSION}/firmware.bin firmware.bin
|
2021-02-14 23:53:17 +00:00
|
|
|
|
|
|
|
- name: Generate full dfu file
|
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
|
|
|
run: hex2dfu -i full.hex -o full.dfu
|
|
|
|
|
|
|
|
- name: Copy bootloader for full.bin
|
|
|
|
run: cp bootloader.bin full.bin
|
|
|
|
- name: Truncate full.bin
|
|
|
|
run: truncate -s 32768 full.bin
|
|
|
|
- name: Add firmware.bin at full.bin
|
|
|
|
run: cat firmware.bin >> full.bin
|
|
|
|
|
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-02-14 23:53:17 +00:00
|
|
|
bootloader.dfu
|
|
|
|
bootloader.bin
|
|
|
|
firmware.dfu
|
|
|
|
firmware.bin
|
|
|
|
full.dfu
|
|
|
|
full.bin
|
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-02-14 23:53:17 +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
|
|
|
|
run: ls bootloader.dfu firmware.dfu full.dfu bootloader.bin firmware.bin full.bin > uploadlist.txt
|
|
|
|
|
|
|
|
- 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
|
|
|
|
run: echo $PREP_DATE
|
|
|
|
- name: Gen pic
|
2020-11-15 10:14:52 +00:00
|
|
|
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 }}
|