Skip to content

Commit

Permalink
Add GH actions workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-carlos committed Feb 29, 2024
1 parent bd2fa66 commit f86cacd
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build Project

on:
push:
branches: '*'
pull_request:
branches: '*'
release:
types: published

jobs:
build-projects:
runs-on: ubuntu-latest
name: Build & upload hex
steps:
- uses: actions/checkout@v4
- name: Build all projects
run: docker run -v $(pwd):/home --rm ghcr.io/carlosperate/microbit-toolchain:v2.0.0 yotta build
- name: Upload hex file
uses: actions/upload-artifact@v4
with:
name: error-programme
path: build/bbc-microbit-classic-gcc/src/error-programme-combined.hex
if-no-files-found: error

release-asset:
name: Upload artifact as GH Release asset
needs: build-projects
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Set the GH Release tag to env variable $TAG
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Download all hex file
uses: actions/download-artifact@v4
id: download-hex-files
- name: Upload hex file to GH Release
uses: microbit-foundation/[email protected]
with:
file: ${{steps.download-hex-files.outputs.download-path}}/error-programme/error-programme-combined.hex
asset_name: error-programme-${{ env.TAG }}.hex
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,27 @@ for V2-only programmes.

## Dependencies

Local toolchain:
- [GNU Arm Embedded Toolchain](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads)
- [Git](https://git-scm.com)
- [CMake](https://cmake.org/download/)
- [Python 3](https://www.python.org/downloads/)
- [Ninja](https://ninja-build.org/)
- [Yotta](https://yottabuild.org/)

Or Docker.
Or with Docker we only need the `ghcr.io/carlosperate/microbit-toolchain`
image.

## Build Instructions

Build with local toolchain:
```
yotta build
```

Build with docker:
```
docker run -v $(pwd):/home --rm ghcr.io/carlosperate/microbit-toolchain:latest yotta build
docker run -v $(pwd):/home --rm ghcr.io/carlosperate/microbit-toolchain:v2.0.0 yotta build
```

Output file: `build/bbc-microbit-classic-gcc/src/error-programme-combined.hex`
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "error-programme",
"version": "1.0.0",
"description": "The micro:bit runtime common abstraction with examples.",
"description": "A micro:bit V1 programme to scroll 'not compatible' error code.",
"license": "MIT",
"dependencies": {
"microbit": "lancaster-university/microbit#v2.1.1"
Expand Down

0 comments on commit f86cacd

Please sign in to comment.