ci.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. name: 'CI'
  2. on:
  3. push:
  4. paths-ignore:
  5. - 'wiki/**'
  6. - 'wiki_static/**'
  7. pull_request:
  8. jobs:
  9. build:
  10. runs-on: ubuntu-latest
  11. steps:
  12. - name: Checkout code
  13. uses: actions/checkout@v2
  14. with:
  15. submodules: true
  16. - uses: satackey/action-docker-layer-caching@v0.0.8
  17. continue-on-error: true
  18. with:
  19. key: docker-cache-${{ hashFiles('docker/**') }}-{hash}
  20. restore-keys: docker-cache-${{ hashFiles('docker/**') }}-
  21. - name: Build docker image
  22. uses: ./.github/actions/docker
  23. - name: Check syntax
  24. uses: ./.github/actions/docker
  25. continue-on-error: false
  26. with:
  27. run: /syntax_check.sh
  28. - name: Build F2 bootloader in docker
  29. uses: ./.github/actions/docker
  30. with:
  31. run: make -C bootloader TARGET=f2
  32. - name: Publish F2 bootloader artifacts
  33. uses: actions/upload-artifact@v2
  34. with:
  35. name: bootloader_f2
  36. path: |
  37. bootloader/.obj/f2/bootloader.elf
  38. bootloader/.obj/f2/bootloader.bin
  39. bootloader/.obj/f2/bootloader.hex
  40. if-no-files-found: error
  41. retention-days: 7
  42. - name: Build local testing firmware in docker
  43. uses: ./.github/actions/docker
  44. with:
  45. run: make -C firmware TARGET=local
  46. - name: Run local tests
  47. uses: ./.github/actions/docker
  48. with:
  49. run: make -C firmware TARGET=local APP_TEST=1 run
  50. - name: Build F2 firmware in docker
  51. uses: ./.github/actions/docker
  52. with:
  53. run: make -C firmware TARGET=f2 APP_RELEASE=1
  54. - name: Publish F2 firmware artifacts
  55. uses: actions/upload-artifact@v2
  56. with:
  57. name: firmware_f2
  58. path: |
  59. firmware/.obj/f2/firmware.elf
  60. firmware/.obj/f2/firmware.bin
  61. firmware/.obj/f2/firmware.hex
  62. if-no-files-found: error
  63. retention-days: 7
  64. - name: Build F3 bootloader in docker
  65. uses: ./.github/actions/docker
  66. with:
  67. run: make -C bootloader TARGET=f3
  68. - name: Publish F3 bootloader artifacts
  69. uses: actions/upload-artifact@v2
  70. with:
  71. name: bootloader_f3
  72. path: |
  73. bootloader/.obj/f3/bootloader.elf
  74. bootloader/.obj/f3/bootloader.bin
  75. bootloader/.obj/f3/bootloader.hex
  76. if-no-files-found: error
  77. retention-days: 7
  78. - name: Build F3 firmware in docker
  79. uses: ./.github/actions/docker
  80. with:
  81. run: make -C firmware TARGET=f3 APP_RELEASE=1
  82. - name: Publish F3 firmware artifacts
  83. uses: actions/upload-artifact@v2
  84. with:
  85. name: firmware_f3
  86. path: |
  87. firmware/.obj/f3/firmware.elf
  88. firmware/.obj/f3/firmware.bin
  89. firmware/.obj/f3/firmware.hex
  90. if-no-files-found: error
  91. retention-days: 7
  92. upload:
  93. name: Upload artifacts to external storage
  94. needs: build
  95. runs-on: ubuntu-latest
  96. steps:
  97. - name: Get bootloader
  98. uses: actions/download-artifact@v2
  99. with:
  100. name: bootloader_f2
  101. path: bootloader
  102. - name: Get firmware
  103. uses: actions/download-artifact@v2
  104. with:
  105. name: firmware_f2
  106. path: firmware
  107. - name: ls for downloaded file
  108. run: ls -R
  109. - name: Upload bootloader
  110. uses: burnett01/rsync-deployments@4.1
  111. with:
  112. switches: -avzp --delete
  113. path: bootloader
  114. remote_path: "${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${GITHUB_REF##*/}/"
  115. remote_host: ${{ secrets.RSYNC_DEPLOY_HOST }}
  116. remote_user: ${{ secrets.RSYNC_DEPLOY_USER }}
  117. remote_key: ${{ secrets.RSYNC_DEPLOY_KEY }}
  118. - name: Upload firmware
  119. uses: burnett01/rsync-deployments@4.1
  120. with:
  121. switches: -avzp --delete
  122. path: firmware
  123. remote_path: "${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${GITHUB_REF##*/}/"
  124. remote_host: ${{ secrets.RSYNC_DEPLOY_HOST }}
  125. remote_user: ${{ secrets.RSYNC_DEPLOY_USER }}
  126. remote_key: ${{ secrets.RSYNC_DEPLOY_KEY }}