Skip to content

Commit

Permalink
chore: add build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
kienvo committed Jun 13, 2024
1 parent 52a0620 commit 630721d
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Badgebagic 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

- name: Download toolchain
if: steps.cache-toolchain.outputs.cache-hit != 'true'
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-
make
- uses: actions/upload-artifact@v4
with:
name: badgemagic-firmware
path: ${{ env.BUILD_DIR }}/badgemagic-*

- name: Upload firmware binaries to bin branch
# Skip upload APK for pull requests & only allow binaries build from master
if: ${{ github.event_name != 'pull_request' && github.ref_name == 'master' }}
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 temporary
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 branch -D bin || true
git branch -m bin
git push --force origin bin

0 comments on commit 630721d

Please sign in to comment.