Skip to content

Commit

Permalink
Add GH Actions workflows & update README.
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-carlos committed May 31, 2024
1 parent cc0bda8 commit 6957290
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 17 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/header-gen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Header Generator Tests

on:
push:
branches: '*'
pull_request:
branches: '*'

jobs:
build-and-test:
name: Build & Test TS lib
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install Dependencies
run: npm ci
working-directory: ./header-gen

- name: Build
run: npm run build
working-directory: ./header-gen

- name: Run Jest Tests
run: npm test
working-directory: ./header-gen
31 changes: 31 additions & 0 deletions .github/workflows/makecode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: MakeCode Project

on:
push:
branches: '*'
pull_request:
branches: '*'

jobs:
build-makecode:
name: Build MakeCode Project
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: |
npm install -g pxt
pxt target microbit
pxt install
- name: Build
run: pxt build --cloud
env:
CI: true
52 changes: 35 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Experimental MakeCode extension to run ML models with ML4F
# Experimental MakeCode extension to run ML4F models

[![MakeCode Project](https://github.com/microbit-foundation/pxt-ml-runner-poc/actions/workflows/makecode.yml/badge.svg)](https://github.com/microbit-foundation/pxt-ml-runner-poc/actions/workflows/makecode.yml)
[![Header Generator Tests](https://github.com/microbit-foundation/pxt-ml-runner-poc/actions/workflows/header-gen.yml/badge.svg)](https://github.com/microbit-foundation/pxt-ml-runner-poc/actions/workflows/header-gen.yml)

This project includes [ML4F](https://github.com/microsoft/ml4f) and a wrapper
to invoke a known type of model. It is left slim to be able to be import it
in other MakeCode extensions and a MicroPython module.


## Developer considerations

- Almost nothing implemented yet
Expand All @@ -16,27 +20,28 @@ in other MakeCode extensions and a MicroPython module.
contains issues that could be encountered and workarounds
- Only built and tested on micro:bit V2


## Use as Extension

This repository can be added as an **extension** in MakeCode.

* open [MakeCode beta](https://makecode.microbit.org/beta)
* click on **New Project**
* click on **Extensions** under the gearwheel menu
* search for **https://github.com/microbit-foundation/pxt-ml-runner-poc** and import
* Open [MakeCode beta](https://makecode.microbit.org/beta)
* Click on **New Project**
* Click on **Extensions** under the gearwheel menu
* Search for **https://github.com/microbit-foundation/pxt-ml-runner-poc** and import


## Edit this project

### In MakeCode online editor

To edit this repository in MakeCode.

* open [MakeCode](https://makecode.microbit.org)
* click on **Import** then click on **Import URL**
* paste **https://github.com/microbit-foundation/pxt-ml-runner-poc** and click import

* Open [MakeCode](https://makecode.microbit.org)
* Click on **Import** then click on **Import URL**
* Paste **https://github.com/microbit-foundation/pxt-ml-runner-poc** and click import

## Building locally
### Building locally

Ensure you have the required toolchain to build for V1 and V2
(arm-none-eabi-gcc, python, yotta, cmake, ninja, srec_cat) or docker.
Expand All @@ -46,17 +51,10 @@ git clone https://github.com/microbit-foundation/pxt-ml-runner-poc
cd pxt-ml-runner-poc
npm install pxt --no-save
npx pxt target microbit --no-save
cp node_modules/pxtcli.json ./pxtcli.json
npm install [email protected] --no-save
mv ./pxtcli.json node_modules/pxtcli.json
npx pxt install
PXT_FORCE_LOCAL=1 PXT_NODOCKER=1 npx pxt
```

> ![WARNING]
> Forcing microbit target at version 6.1.10 due to this issue:
> https://github.com/microsoft/pxt-microbit/pull/5481
For the V1 build Yotta can hit the GitHub rate limits quite easily if the
project is built from a clean state more than once.
A V2-only build can be performed with the `PXT_COMPILE_SWITCHES=csv---mbcodal`
Expand All @@ -82,6 +80,26 @@ pxt.json file:
```


## License
This software is under the MIT open source license.

[SPDX-License-Identifier: MIT](LICENSE)


## Code of Conduct

Trust, partnership, simplicity and passion are our core values we live and
breathe in our daily work life and within our projects. Our open-source
projects are no exception. We have an active community which spans the globe
and we welcome and encourage participation and contributions to our projects
by everyone. We work to foster a positive, open, inclusive and supportive
environment and trust that our community respects the micro:bit code of
conduct. Please see our [code of conduct](https://microbit.org/safeguarding/)
which outlines our expectations for all those that participate in our
community and details on how to report any concerns and what would happen
should breaches occur.


#### Metadata (used for search)

* for PXT/microbit

0 comments on commit 6957290

Please sign in to comment.