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
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2021-01-06 20:51:01 +00:00
|
|
|
runs-on: [self-hosted]
|
2020-08-31 20:12:18 +00:00
|
|
|
steps:
|
|
|
|
- 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
|
2020-09-17 08:06:25 +00:00
|
|
|
- uses: satackey/action-docker-layer-caching@v0.0.8
|
|
|
|
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
|
|
|
|
|
2020-10-07 09:37:43 +00:00
|
|
|
- name: Build local testing firmware in docker
|
2020-09-29 12:40:47 +00:00
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
2020-10-07 09:37:43 +00:00
|
|
|
run: make -C firmware TARGET=local
|
2020-09-30 23:05:04 +00:00
|
|
|
|
2020-10-10 10:32:06 +00:00
|
|
|
- name: Run local tests
|
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
|
|
|
run: make -C firmware TARGET=local APP_TEST=1 run
|
|
|
|
|
2020-12-14 16:36:07 +00:00
|
|
|
- name: Build F4 bootloader in docker
|
2020-11-06 10:52:50 +00:00
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
2020-12-14 16:36:07 +00:00
|
|
|
run: make -C bootloader TARGET=f4
|
2020-11-06 10:52:50 +00:00
|
|
|
|
2020-12-14 16:36:07 +00:00
|
|
|
- name: Publish F4 bootloader artifacts
|
2020-11-06 10:52:50 +00:00
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2020-12-14 16:36:07 +00:00
|
|
|
name: bootloader_f4
|
2020-11-06 10:52:50 +00:00
|
|
|
path: |
|
2020-12-14 16:36:07 +00:00
|
|
|
bootloader/.obj/f4/bootloader.elf
|
|
|
|
bootloader/.obj/f4/bootloader.bin
|
|
|
|
bootloader/.obj/f4/bootloader.hex
|
2020-11-06 10:52:50 +00:00
|
|
|
if-no-files-found: error
|
|
|
|
retention-days: 7
|
|
|
|
|
2020-12-14 16:36:07 +00:00
|
|
|
- name: Build F4 firmware in docker
|
2020-11-06 10:52:50 +00:00
|
|
|
uses: ./.github/actions/docker
|
|
|
|
with:
|
2020-12-14 16:36:07 +00:00
|
|
|
run: make -C firmware TARGET=f4 APP_RELEASE=1
|
2020-11-06 10:52:50 +00:00
|
|
|
|
2020-12-14 16:36:07 +00:00
|
|
|
- name: Publish F4 firmware artifacts
|
2020-11-06 10:52:50 +00:00
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2020-12-14 16:36:07 +00:00
|
|
|
name: firmware_f4
|
2020-11-06 10:52:50 +00:00
|
|
|
path: |
|
2020-12-14 16:36:07 +00:00
|
|
|
firmware/.obj/f4/firmware.elf
|
|
|
|
firmware/.obj/f4/firmware.bin
|
|
|
|
firmware/.obj/f4/firmware.hex
|
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-01-07 07:32:19 +00:00
|
|
|
- name: Create directory for artifacts
|
|
|
|
run: mkdir artifacts
|
2020-10-30 13:32:07 +00:00
|
|
|
- name: Get bootloader
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
2020-12-14 16:36:07 +00:00
|
|
|
name: bootloader_f4
|
2021-01-07 07:32:19 +00:00
|
|
|
path: artifacts/bootloader
|
2020-10-30 13:32:07 +00:00
|
|
|
- name: Get firmware
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
2020-12-14 16:36:07 +00:00
|
|
|
name: firmware_f4
|
2021-01-07 07:32:19 +00:00
|
|
|
path: artifacts/firmware
|
2020-10-30 13:32:07 +00:00
|
|
|
- name: Upload bootloader
|
|
|
|
uses: burnett01/rsync-deployments@4.1
|
|
|
|
with:
|
|
|
|
switches: -avzp --delete
|
2021-01-07 07:32:19 +00:00
|
|
|
path: artifacts/bootloader
|
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 }}
|
|
|
|
remote_key: ${{ secrets.RSYNC_DEPLOY_KEY }}
|
|
|
|
- name: Upload firmware
|
|
|
|
uses: burnett01/rsync-deployments@4.1
|
|
|
|
with:
|
2021-01-07 07:32:19 +00:00
|
|
|
switches: -avzp --delete
|
|
|
|
path: artifacts/firmware
|
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 }}
|
|
|
|
remote_key: ${{ secrets.RSYNC_DEPLOY_KEY }}
|
2020-11-09 07:56:45 +00:00
|
|
|
|
|
|
|
fullfirmware:
|
|
|
|
name: Create latest full firmware
|
|
|
|
needs: upload
|
|
|
|
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: Get bootloader
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
2020-12-14 16:36:07 +00:00
|
|
|
name: bootloader_f4
|
2020-11-09 07:56:45 +00:00
|
|
|
path: bootloader
|
|
|
|
- name: Get firmware
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
2020-12-14 16:36:07 +00:00
|
|
|
name: firmware_f4
|
2020-11-15 10:14:52 +00:00
|
|
|
path: firmware
|
2020-11-09 07:56:45 +00:00
|
|
|
- name: cp
|
|
|
|
run: cp ./bootloader/bootloader.bin full_firmware_latest.bin
|
|
|
|
- name: truncate
|
|
|
|
run: truncate -s 32768 full_firmware_latest.bin
|
|
|
|
- name: cat
|
|
|
|
run: cat ./firmware/firmware.bin >> full_firmware_latest.bin
|
|
|
|
- name: ls
|
|
|
|
run: ls -R
|
|
|
|
- name: Upload fullfirmware
|
|
|
|
uses: burnett01/rsync-deployments@4.1
|
|
|
|
with:
|
|
|
|
switches: -avzp --delete
|
|
|
|
path: full_firmware_latest.bin
|
|
|
|
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 }}
|
|
|
|
|
|
|
|
genpic:
|
|
|
|
name: Generate pic
|
|
|
|
needs: fullfirmware
|
|
|
|
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: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2020-11-15 10:14:52 +00:00
|
|
|
ref: master
|
2020-11-09 07:56:45 +00:00
|
|
|
submodules: true
|
|
|
|
- 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 }}
|