diff --git a/.cppcheck-suppressions b/.cppcheck-suppressions index 534e727c..24bf4f84 100644 --- a/.cppcheck-suppressions +++ b/.cppcheck-suppressions @@ -1,71 +1,31 @@ -# Suppressions for cppcheck -# -# Strategy: -# - workspace/all/ (platform-independent): Fully cleaned, zero style warnings -# - Device-specific code: Targeted style suppressions to maintain original style -# - Real bugs: Always fixed, never suppressed -# -# All suppressions are documented with rationale - -# Infrastructure noise - not actionable missingIncludeSystem unmatchedSuppression unusedFunction normalCheckLevelMaxBranches - -# Platform-specific code that looks wrong but isn't ConfigurationNotChecked unknownMacro:*PLATFORM* unknownMacro:*PAKS_PATH* unknownMacro:*SYSTEM_PATH* unknownMacro:*USERDATA_PATH* - -# SDL and libretro headers we don't control missingInclude:*/SDL* missingInclude:*/libretro* - -# Third-party code we don't maintain (libretro-common) *:*/libretro-common/* - -# Inline assembly - cppcheck doesn't understand dst parameters are modified constParameterPointer:*/scaler.c:723 constParameterPointer:*/scaler.c:3204 constParameterPointer:*/scaler.c:3290 constParameterPointer:*/scaler.c:3368 constParameterPointer:*/scaler.c:3456 - -# Thread callback function signatures - pthread_create requires specific signature -# Adding const would require function pointer casts, reducing readability constParameterCallback - -# Fallback implementations - conditions are always false in base implementation -# Platform-specific implementations may override these knownConditionTrueFalse:*/api.c:1444 knownConditionTrueFalse:*/api.c:1449 - -# Void pointer arithmetic - GCC extension used throughout codebase -# This is intentional and works correctly on all target platforms (ARM/GCC) -# Suppressing to avoid noise and maintain original code style arithOperationsOnVoidPointer - -# Cppcheck false positives from ifdef/macro confusion on void functions missingReturn:*/trimuismart/platform/platform.c:81 missingReturn:*/my282/overclock/overclock.c:811 - -# Variable shadowing - intentional loop-local variables in nested loops -# Maintains code clarity by keeping variable names consistent across loop iterations shadowVariable - -# Const-correctness style warnings - suppressed globally after manual review -# workspace/all/ was thoroughly cleaned (110 issues fixed) -# Device-specific code uses these patterns intentionally -# These are style-only, not bugs constParameterPointer constParameter constVariablePointer constVariable variableScope unusedStructMember - -# False positive - condition depends on runtime values knownConditionTrueFalse:*/my282/libmstick/mstick.c:228 diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 00000000..c8436c0a --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,93 @@ +# GitHub Actions CI Workflows + +This directory contains the continuous integration workflows for MinUI. + +## Workflows + +### Quality Assurance (`qa.yml`) + +Runs on every push and pull request to `main` and `develop` branches. + +**Jobs:** +- **Lint** - Runs all linting checks (cppcheck, clang-format, shellcheck) +- **Test** - Runs comprehensive test suite in Debian Buster Docker container (GCC 8.3.0) + +All QA jobs run on standard `ubuntu-latest` runners in parallel. + +### Platform Builds (`build.yml`) + +Validates compilation works (compile-only, no artifacts). + +**Platform tested:** miyoomini (Miyoo Mini) + +**Note:** This only tests compilation (`make PLATFORM=miyoomini build`), not full builds with system file copying. This catches compilation errors quickly without needing the full skeleton setup. + +**Build time:** ~15-20 min (clones toolchain, builds Docker image, compiles). + +## Running Workflows Locally + +### QA Checks + +You can run the **exact same commands** locally that run in CI: + +```bash +# Run all linting checks (cppcheck, format-check, shellcheck) +make lint + +# Run all tests (uses Docker) +make test +``` + +Individual targets are also available if needed: +```bash +make lint-code # Just cppcheck +make format-check # Just formatting +make lint-shell # Just shellcheck +``` + +### Platform Builds + +```bash +# Build for a specific platform +make PLATFORM=miyoomini build +make PLATFORM=miyoomini system +make PLATFORM=miyoomini cores + +# Build everything for all platforms +make all +``` + +## CI Strategy Summary + +| Event | Runs | Duration | Purpose | +|-------|------|----------|---------| +| **PR/Push to main/develop** | Lint + Test + Build (rg35xxplus) | ~5-7 min | Fast feedback, catch compilation errors | + +## Status Badges + +Add to README.md: + +```markdown +[![QA](https://github.com/nchapman/MinUI/actions/workflows/qa.yml/badge.svg)](https://github.com/nchapman/MinUI/actions/workflows/qa.yml) +[![Build](https://github.com/nchapman/MinUI/actions/workflows/build.yml/badge.svg)](https://github.com/nchapman/MinUI/actions/workflows/build.yml) +``` + +## Future Enhancements + +### ARM64 Runners + +GitHub now supports ARM64 runners which could significantly speed up builds since MinUI compiles for ARM devices. To use ARM64 runners: + +1. Enable ARM64 runners in repository settings +2. Update workflow files to use `runs-on: [self-hosted, linux, arm64]` or `runs-on: ubuntu-24.04-arm64` (when available) + +See: https://github.blog/news-insights/product-news/arm64-on-github-actions-powering-faster-more-efficient-build-systems/ + +### Additional Checks + +Consider adding: +- Release builds on tags +- Automated deployment of release artifacts +- Code coverage reporting +- Performance benchmarks +- Cross-platform build matrix (all 12+ platforms) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..1f11149c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,22 @@ +name: Platform Builds + +on: + push: + branches: [main, develop] + pull_request: + branches: [main, develop] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build miyoomini (compile only) + run: make PLATFORM=miyoomini build diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml new file mode 100644 index 00000000..a9013e43 --- /dev/null +++ b/.github/workflows/qa.yml @@ -0,0 +1,38 @@ +name: Quality Assurance + +on: + push: + branches: [main, develop] + pull_request: + branches: [main, develop] + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install linting tools + run: | + sudo apt-get update + sudo apt-get install -y cppcheck clang-format shellcheck + + - name: Run all linting checks + run: make lint + + test: + name: Test + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Run all tests + run: make test diff --git a/Makefile.qa b/Makefile.qa index 99ce5730..05d79a04 100644 --- a/Makefile.qa +++ b/Makefile.qa @@ -1,29 +1,32 @@ # Quality Assurance Makefile # Run static analysis and tests -.PHONY: help lint lint-full lint-shell test test-native format format-check clean-qa docker-build docker-test docker-shell +.PHONY: help lint lint-code lint-full lint-shell test test-native format format-check clean-qa docker-build docker-test docker-shell help: @echo "MinUI Quality Assurance Tools" @echo "" - @echo "Available targets:" + @echo "Main targets (use these):" @echo " make test - Run unit tests (Docker, recommended)" - @echo " make lint - Run cppcheck on workspace/all/ (serious issues only)" - @echo " make lint-full - Run cppcheck on entire workspace (verbose)" - @echo " make lint-shell - Run shellcheck on shell scripts" + @echo " make lint - Run ALL linting checks (cppcheck, format-check, shellcheck)" @echo " make format - Format code with clang-format (MODIFIES FILES)" + @echo "" + @echo "Individual lint targets:" + @echo " make lint-code - Run cppcheck on workspace/all/" + @echo " make lint-full - Run cppcheck on entire workspace (verbose)" @echo " make format-check - Check if code is formatted (no changes)" - @echo " make clean-qa - Clean QA artifacts" + @echo " make lint-shell - Run shellcheck on shell scripts" @echo "" - @echo "Docker targets (default):" - @echo " make docker-test - Run tests in Debian Buster ARM64 container" + @echo "Docker targets:" + @echo " make docker-test - Run tests in Debian Buster container" @echo " make docker-build - Build test Docker image" @echo " make docker-shell - Enter Docker container for debugging" @echo "" - @echo "Native targets (requires local tools):" + @echo "Other:" @echo " make test-native - Run tests natively (not recommended on macOS)" + @echo " make clean-qa - Clean QA artifacts" @echo "" - @echo "Installing native tools:" + @echo "Installing tools:" @echo " macOS: brew install cppcheck llvm shellcheck" @echo " Linux: sudo apt-get install cppcheck clang-format shellcheck" @@ -43,8 +46,24 @@ check-cppcheck: check-shellcheck: @which shellcheck > /dev/null || (echo "Error: shellcheck not installed. Run 'brew install shellcheck' or 'apt-get install shellcheck'" && exit 1) +# Main lint target - runs all linting checks +lint: check-cppcheck check-clang-format check-shellcheck + @echo "=================================" && \ + echo "Running ALL linting checks..." && \ + echo "=================================" && \ + echo "" && \ + $(MAKE) -f Makefile.qa lint-code && \ + echo "" && \ + $(MAKE) -f Makefile.qa format-check && \ + echo "" && \ + $(MAKE) -f Makefile.qa lint-shell && \ + echo "" && \ + echo "=================================" && \ + echo "✓ All linting checks passed" && \ + echo "=================================" + # Lint common code (most important, least platform-specific) -lint: check-cppcheck +lint-code: check-cppcheck @echo "Running cppcheck on workspace/all/ (common code)..." @echo "Checking for: NULL dereferences, memory leaks, buffer overflows, uninitialized variables" @echo "" @@ -166,15 +185,15 @@ report: check-cppcheck # Docker-based testing targets DOCKER_IMAGE = minui-test -DOCKER_RUN = docker run --rm -v $(shell pwd):/minui -w /minui --platform linux/arm64 $(DOCKER_IMAGE) +DOCKER_RUN = docker run --rm -v $(shell pwd):/minui -w /minui $(DOCKER_IMAGE) docker-build: - @echo "Building test Docker image (Debian Buster ARM64)..." - docker build --platform linux/arm64 -t $(DOCKER_IMAGE) -f tests/Dockerfile . + @echo "Building test Docker image (Debian Buster)..." + docker build -t $(DOCKER_IMAGE) -f tests/Dockerfile . @echo "✓ Docker image ready" docker-test: docker-build - @echo "Running tests in Docker container (Debian Buster ARM64)..." + @echo "Running tests in Docker container (Debian Buster)..." @echo "" $(DOCKER_RUN) make -f Makefile.qa clean-tests test-native @@ -184,4 +203,4 @@ docker-lint: docker-build docker-shell: docker-build @echo "Entering Docker container shell..." - docker run --rm -it -v $(shell pwd):/minui -w /minui --platform linux/arm64 $(DOCKER_IMAGE) /bin/bash + docker run --rm -it -v $(shell pwd):/minui -w /minui $(DOCKER_IMAGE) /bin/bash diff --git a/tests/Dockerfile b/tests/Dockerfile index 87610499..49100559 100644 --- a/tests/Dockerfile +++ b/tests/Dockerfile @@ -1,5 +1,6 @@ # Lightweight Docker image for running MinUI tests -# Uses Debian Buster to match most platform toolchains +# Uses Debian Buster to match platform toolchains (GCC 8.3.0) +# Note: Uses native platform (AMD64 on CI, ARM64 on Apple Silicon) FROM debian:buster-slim ENV DEBIAN_FRONTEND=noninteractive