Test MicroPython in CI #119
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
jobs: | |
tests: | |
name: "Python ${{ matrix.python-version }}" | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Install dependencies | |
run: sudo apt-get install -y gcc-avr avr-libc simulavr | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Compile C library | |
run: | | |
gcc --std=c90 -pedantic -c -Wall -Werror -fpic -o src/secplus.o src/secplus.c | |
gcc --std=c90 -pedantic -shared -o libsecplus.so src/secplus.o | |
- name: Compile C library for AVR | |
run: avr-gcc -mmcu=attiny85 -Os -Wall -Werror -o test/avr_test.elf src/secplus.c test/avr_test.c | |
- name: Test | |
run: | | |
TEST_CYCLES=50000 ./test_secplus.py | |
TEST_CYCLES=50000 TEST_MODE=c ./test_secplus.py | |
TEST_CYCLES=1000 TEST_MODE=avr ./test_secplus.py | |
micropython: | |
name: "MicroPython" | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Install dependencies | |
run: sudo apt-get install micropython | |
- name: Install MicroPython modules | |
run: | | |
mkdir -p ~/.micropython/lib/ | |
curl https://raw.githubusercontent.com/micropython/micropython-lib/v1.22.2/python-stdlib/random/random.py > ~/.micropython/lib/random.py | |
mkdir -p ~/.micropython/lib/unittest/ | |
curl https://raw.githubusercontent.com/micropython/micropython-lib/v1.22.2/python-stdlib/unittest/unittest/__init__.py > ~/.micropython/lib/unittest/__init__.py | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Test | |
run: | | |
TEST_CYCLES=50000 micropython ./test_secplus.py |