aboutsummaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
authorFrançois Cartegnie <281376+fcartegnie@users.noreply.github.com>2024-06-14 12:36:42 +0700
committerGitHub <noreply@github.com>2024-06-14 12:36:42 +0700
commit8039fa4fd71be81410f7b6293d8ca777dceac1f3 (patch)
treeece3db0ef532352d9281c18c1b938188f1c34791 /.github
parent98a741d93323da0e9199ceafbcc6ea8a6b57e932 (diff)
parent37c3fb886c7eeca8db0cda5a46f1c624b1171f69 (diff)
Merge pull request #20 from kienvo/build-pipeline
Add build pipeline
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/build.yaml56
1 files changed, 56 insertions, 0 deletions
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
new file mode 100644
index 0000000..3144e5c
--- /dev/null
+++ b/.github/workflows/build.yaml
@@ -0,0 +1,56 @@
+name: Badgemagic Firmware build
+
+on:
+ push:
+ pull_request:
+ branches: [master]
+
+env:
+ MRS_TOOLCHAIN: MRS_Toolchain_Linux_x64_V1.91
+ BUILD_DIR: build
+ BIN_TYPES: '{.bin,.elf}'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Cache toolchain
+ id: cache-toolchain
+ uses: actions/cache@v4
+ with:
+ path: ${{ env.MRS_TOOLCHAIN }}
+ key: ${{ env.MRS_TOOLCHAIN }}-cache
+
+ - if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
+ name: Download toolchain
+ run: |
+ wget http://file-oss.mounriver.com/tools/${{ env.MRS_TOOLCHAIN }}.tar.xz
+ tar -xvf ${{ env.MRS_TOOLCHAIN }}.tar.xz
+
+ - name: Build firmware
+ run: |
+ export PREFIX=${{ env.MRS_TOOLCHAIN }}/RISC-V_Embedded_GCC/bin/riscv-none-embed-
+ export BUILD_DIR=${{ env.BUILD_DIR }}
+ make -j$(nproc)
+
+ - uses: actions/upload-artifact@v4
+ with:
+ name: badgemagic-firmware
+ path: ${{ env.BUILD_DIR }}/badgemagic-*
+
+ # Skip upload APK for pull requests & only allow binaries build from master
+ - if: ${{ github.event_name != 'pull_request' && github.ref_name == 'master' }}
+ name: Upload firmware binaries to bin branch
+ run: |
+ git config --global user.name "${{ github.workflow }}"
+ git config --global user.email "gh-actions@${{ github.repository_owner }}"
+
+ mv ${{ env.BUILD_DIR }}/badgemagic-*${{ env.BIN_TYPES }} ./
+
+ git checkout --orphan bin
+ git reset
+ git add badgemagic-*${{ env.BIN_TYPES }}
+ git commit -am "[Auto] Update firmware binaries from ${{ github.ref_name }} ($(date +%Y-%m-%d.%H:%M:%S))"
+ git push --force origin bin