Skip to content

Merge branch 'prepare-merge-0.2.66-into-0.2.63' into calliope #58

Merge branch 'prepare-merge-0.2.66-into-0.2.63' into calliope

Merge branch 'prepare-merge-0.2.66-into-0.2.63' into calliope #58

Workflow file for this run

name: Build MakeCode
# MakeCode has to git clone/checkout this repo commit SHA, so only run this
# workflow on pushes, as PRs generate a "merge commit" that is not clonable.
on:
push:
branches: '*'
jobs:
build-makecode:
strategy:
matrix:
# One job builds with the local toolchain, the other with Docker
# FIXME: The current docker image used by pxt-calliope is not publicly accessible via
# a known public registry, so the builds using docker will fail.
# As a temporary measure, let's only build the "nodocker" version and reneable the
# docker build in the future, once we can access the build image.
# https://github.com/lancaster-university/codal-microbit-v2/issues/338#issuecomment-1658767316
# pxt-flags: ["PXT_NODOCKER=1", ""]
pxt-flags: ["PXT_NODOCKER=1"]
fail-fast: false
name: Build MakeCode ${{ matrix.pxt-flags && '(nodocker)' }}
runs-on: ubuntu-22.04
steps:
- name: Setup Python 3.7
uses: actions/setup-python@v4
with:
python-version: '3.7'
- name: Setup arm-none-eabi-gcc v10.3
if: ${{ matrix.pxt-flags }}
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: 10.3-2021.10
- name: Install Yotta, Ninja v1.10 & CMake v3.22 via PyPI
if: ${{ matrix.pxt-flags }}
run: |
# Newer pip needed to install newer wheels type for cmsis-pack-manager
python -m pip install --upgrade pip
# project-generator==0.8.17 and MarkupSafe < 2.0 needed for Yotta
python -m pip install project-generator==0.8.17 MarkupSafe==1.1.1
python -m pip install ninja==1.10.2.2 cmake==3.22.1 yotta
- name: Install srecord
if: ${{ matrix.pxt-flags }}
run: |
sudo apt update
sudo apt install srecord
- name: Setup Node.js v16
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Clone the pxt-calliope repo
uses: actions/checkout@v3
with:
repository: 'microsoft/pxt-calliope'
- name: Install MakeCode dependencies
run: |
npm install -g pxt
npm install
- name: Edit pxtarget.json to use this repository and commit
shell: bash
run: |
python - << EOF
import json, collections
def msg_exit(msg):
print('{}\nThe GH Actions workflow Python script needs to be updated.'.format(msg))
exit(1)
with open('pxtarget.json', 'r') as f:
pxt_target = json.loads(f.read(), object_pairs_hook=collections.OrderedDict)
try:
minicodal = pxt_target['variants']['minicodal']
minidal = pxt_target['variants']['minidal']
if minidal['compileService'] != {}:
msg_exit("Unexpected variants.minidal.compileService value.")
if minicodal['compileService']['codalTarget']['url'] != "https://github.com/calliope-edu/codal-microbit-v2":
msg_exit("Unexpected variants.minicodal.compileService.codalTarget.url value.")
# Just need to check this exists, we don't care about the value
_ = minicodal['compileService']['codalTarget']['branch']
except KeyError as e:
msg_exit('The pxt-calliope/pxtarget.json structure has changed and expected keys are not found.')
else:
minidal['compileService'] = { 'dockerArgs' : ['--env', 'YOTTA_GITHUB_AUTHTOKEN=${{ secrets.YOTTA_GITHUB_AUTHTOKEN }}'] }
minicodal['compileService']['codalTarget']['url'] = minicodal['compileService']['codalTarget']['url'].replace(
'calliope-edu/codal-microbit-v2', '${GITHUB_REPOSITORY}'
)
minicodal['compileService']['codalTarget']['branch'] = '${GITHUB_SHA}'
with open('pxtarget.json', 'w') as f:
f.write(json.dumps(pxt_target, indent=4))
EOF
git diff pxtarget.json
- name: Build MakeCode targets
# Because pxt runs docker with "--user build" it doesn't have write access to some mounted files,
# so we need to force all files created by the pxt cli to have write/execute rights for everyone
run: |
chmod -R a+rwx .
umask 0000
${{ matrix.pxt-flags }} pxt buildtarget --local
env:
YOTTA_GITHUB_AUTHTOKEN: ${{ secrets.YOTTA_GITHUB_AUTHTOKEN }}