Merge pull request #30 from jepler/add-forgejo-actions

This commit is contained in:
Jeff Epler 2025-08-17 08:06:32 -05:00 committed by GitHub
commit e25d545090
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 111 additions and 63 deletions

96
.forgejo/workflows/ci.yml Normal file
View file

@ -0,0 +1,96 @@
name: m68k macintosh port
on:
push:
pull_request:
release:
types:
- created # forgejo does not document the value "created"
- published
# (may not be used by forgejo, but is ignored for now)
concurrency:
group: ${{ forge.workflow }}-${{ forge.ref_name }}-${{ forge.event_name }}
cancel-in-progress: true
jobs:
build:
permissions: write-all
runs-on: codeberg-tiny
container:
image: ghcr.io/m68k-micropython/retro68@sha256:fb78281a61f1324a3d552f1a8bbf8b35690926f0b11da2dacddd985f4ff4acac
steps:
- name: Set up tea
run: |
set -x
ARCH=$(dpkg --print-architecture)
curl -sL https://dl.gitea.io/tea/"$TEA_VERSION"/tea-"$TEA_VERSION"-linux-"$ARCH" > /usr/local/bin/tea
chmod +x /usr/local/bin/tea
tea --version
env:
TEA_VERSION: "0.10.1"
- uses: actions/checkout@v4
# These get confused by some submodules, oof
- name: Install packages for C code formatting
run: pip install --break-system-packages micropython-uncrustify
- name: Run C code formatting
run: source tools/ci.sh && ci_c_code_formatting_run
- name: Check code formatting
run: git diff --exit-code
- name: Check spelling
run: |
pip install --break-system-packages codespell==2.4.1 tomli
codespell
- name: Run ruff
run: |
pip install --break-system-packages ruff==0.11.6
ruff check --output-format=github .
ruff format --diff .
- name: Build m68k port
run: |
git config --global --add safe.directory $(pwd)
make -C mpy-cross -j$(nproc)
make -C ports/m68kmac submodules
make -C ports/m68kmac -j$(nproc) MICROPY_USE_COMPILER_PLUGIN=gcc
- name: Prepare release distribution
run: |
mkdir dist/
cp ports/m68kmac/build/micropython.{bin,dsk} dist/
- name: Attach files to actions run
if: ${{ forge.event_name != 'release' }}
uses: actions/upload-artifact@v3
with:
path: dist/*
- name: Run tests via "unix" port
run: |
make -C ports/unix submodules
make -C ports/unix -j$(nproc)
ulimit -n 1024; \
cd tests; \
if ! ./run-tests.py -e "cmdline/repl_" -e "asyncio_fair" -e "asyncio_heaplock"; then \
./run-tests.py --print-failures; \
exit 1;\
fi
- name: Check build directory size
run: du -shx
- name: Attach files to release
if: ${{ forge.event_name == 'release' }}
run: |
tools/add_release_assets.sh
env:
TEA_VERSION: "0.10.1"
EVENT_DATA: ${{ forge.event_path }}
GITEA_SERVER_TOKEN: ${{ forge.token }}
FORGE_SERVER_URL: ${{ forge.server_url }}
TAG: ${{ forge.event.release.name }}

View file

@ -20,49 +20,14 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
coverage: standard:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-python@v5
# Python 3.12 is the default for ubuntu-24.04, but that has compatibility issues with settrace tests.
# Can remove this step when ubuntu-latest uses a more recent Python 3.x as the default.
with:
python-version: '3.11'
- name: Install packages
run: source tools/ci.sh && ci_unix_coverage_setup
- name: Build - name: Build
run: source tools/ci.sh && ci_unix_coverage_build run: source tools/ci.sh && ci_unix_standard_build
- name: Run main test suite - name: Run main test suite
run: source tools/ci.sh && ci_unix_coverage_run_tests run: source tools/ci.sh && ci_unix_standard_run_tests
- name: Test merging .mpy files
run: source tools/ci.sh && ci_unix_coverage_run_mpy_merge_tests
- name: Build native mpy modules
run: source tools/ci.sh && ci_native_mpy_modules_build
- name: Test importing .mpy generated by mpy_ld.py
run: source tools/ci.sh && ci_unix_coverage_run_native_mpy_tests
- name: Run gcov coverage analysis
run: |
(cd ports/unix && gcov -o build-coverage/py ../../py/*.c || true)
(cd ports/unix && gcov -o build-coverage/extmod ../../extmod/*.c || true)
- name: Print failures
if: failure()
run: tests/run-tests.py --print-failures
coverage_32bit:
runs-on: ubuntu-22.04 # use 22.04 to get libffi-dev:i386
steps:
- uses: actions/checkout@v4
- name: Install packages
run: source tools/ci.sh && ci_unix_32bit_setup
- name: Build
run: source tools/ci.sh && ci_unix_coverage_32bit_build
- name: Run main test suite
run: source tools/ci.sh && ci_unix_coverage_32bit_run_tests
- name: Build native mpy modules
run: source tools/ci.sh && ci_native_mpy_modules_32bit_build
- name: Test importing .mpy generated by mpy_ld.py
run: source tools/ci.sh && ci_unix_coverage_32bit_run_native_mpy_tests
- name: Print failures - name: Print failures
if: failure() if: failure()
run: tests/run-tests.py --print-failures run: tests/run-tests.py --print-failures

3
.gitignore vendored
View file

@ -24,3 +24,6 @@ user.props
# MacOS desktop metadata files # MacOS desktop metadata files
.DS_Store .DS_Store
# Created during the distribution making process
/dist

@ -1 +0,0 @@
Subproject commit 8153bfe4125e6a608abccf1561fd10285016c90a

View file

@ -7,5 +7,5 @@ if [ $# -eq 0 ]; then it=-it; else it=; fi
docker run \ docker run \
-w /work/ports/m68kmac --rm \ -w /work/ports/m68kmac --rm \
-v "${TOP}":/work \ -v "${TOP}":/work \
${it} ghcr.io/m68k-micropython/builder:latest "$@" ${it} ghcr.io/m68k-micropython/retro68:latest "$@"

View file

@ -1,3 +0,0 @@
MAKEFLAGS=-j10
VARIANT ?= coverage
include Makefile

View file

@ -20,18 +20,6 @@ MICROPY_PY_TERMIOS = 1
# Subset of CPython socket module # Subset of CPython socket module
MICROPY_PY_SOCKET = 1 MICROPY_PY_SOCKET = 1
# ffi module requires libffi (libffi-dev Debian package)
MICROPY_PY_FFI = 1
# ssl module requires one of the TLS libraries below
MICROPY_PY_SSL = 1
# axTLS has minimal size but implements only a subset of modern TLS
# functionality, so may have problems with some servers.
MICROPY_SSL_AXTLS = 0
# mbedTLS is more up to date and complete implementation, but also
# more bloated.
MICROPY_SSL_MBEDTLS = 1
# jni module requires JVM/JNI # jni module requires JVM/JNI
MICROPY_PY_JNI = 0 MICROPY_PY_JNI = 0

View file

@ -12,13 +12,5 @@ LDFLAGS += -fprofile-arcs -ftest-coverage
FROZEN_MANIFEST ?= $(VARIANT_DIR)/manifest.py FROZEN_MANIFEST ?= $(VARIANT_DIR)/manifest.py
USER_C_MODULES = $(TOP)/examples/usercmodule USER_C_MODULES = $(TOP)/examples/usercmodule
# Optionally format the generated files with uncrustify if installed
ifneq ($(shell which uncrustify-apple-macos-gcc),)
MKAPIFORMAT = --format
endif
include $(TOP)/extmod/multiversal.mk
$(eval $(call multiversal_module,mkapitest,variants/coverage/mkapi_test.yaml))
$(info $(call multiversal_module,mkapitest,variants/coverage/mkapi_test.yaml))
SRC_C += coverage.c SRC_C += coverage.c
SRC_CXX += coveragecpp.cpp SRC_CXX += coveragecpp.cpp

View file

@ -1,3 +1,6 @@
# This is the default variant when you `make` the Unix port. # This is the default variant when you `make` the Unix port.
FROZEN_MANIFEST ?= $(VARIANT_DIR)/manifest.py FROZEN_MANIFEST ?= $(VARIANT_DIR)/manifest.py
include $(TOP)/extmod/multiversal.mk
$(eval $(call multiversal_module,mkapitest,variants/coverage/mkapi_test.yaml))

5
tools/add_release_assets.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
tea login add --url "$FORGE_SERVER_URL"
tea release asset create "${TAG}" dist/*