Skip to content

Commit

Permalink
Merge from dev (#81)
Browse files Browse the repository at this point in the history
# 0.7

* moved to Qt6

* moved python >= 3.10

* added some gh actions for publishing, formatting and linting

* enforcing `black` as the only coding style

* [cd] improvement CI/CD

* total backend isolation

* added a simple but functional REPL based on `prompt_toolkit`

* cemu can also be used as a lib 

* using a proper callback system for logging

* - fixed typing issues

* - [main] fixed more linting errors

* - plugins structure was revisited, more flexible

* - updated file menu

* fixed all remaining errors from `ui.main`

* created a global backend context structure

* moved most of the code to use the global context

* fixed `ui.command.py` shortcuts

* moved plugins to `dockable_widgets` so they cna be hidden from control bar

* fixed emulation

* added focus mode (ctrl+f)

* added stale config

* added issue templates

* added PR template

* added contribution and funding policy files

* Added action for codeql-analysis.yml

* Bump lief from 0.12.1 to 0.12.2 (#73)

    added pyproject, moved to using black for formatting, ruff for linting

    [ui.memory] added some value checks

    converted ui memory layout to a table

    [ui.registers] fixed the register name column width, changed the font to Courier

    [emulator] moved instances into a qthread

* not  working quite yet

* completely separated core from gui

* using `match` where possible

* updated readme, new logo and badges

* linting everywhere 🪄

* removed qthread thingy

* added aligment combobox to memoryview

* removed debug print, added docstring

* mitigating weird keystone count bug

* [ci] making devliery on demand

* [actions] fixed typo

* [ci] add py3.11 for cd

* [ui] use state callbacks to disable/enable widget

* Added .gitignore

* [CI] Simplify Discord notification message (#75)

* [ci] notify only sends one message on discord

* Update and rename cd.yml to build.yml

* Dependabot fix

* Using CEmu in terminal and library (#78)

* [cli] added new commands

* [ci] moved to pyproject.toml + added  publish actions (on-demand)

* [ui] fixed state transition bug: added a new initial state when starting cemu, which is different from NOT_RUNNING to indicate when cemu has completely done initializing

* [ci] build - removed the `pip install requirements`, unneeded

* [ci] added pytest run

* [tests] added arm/aarch64 basic tests

* bumped py requrement to py310 because of the use of `match`

* removed obsolete files

* start to add support for multiple OSes

* [ci] fixed py 3.10 -> '3.10'

* restoring files to perm 0644

* Fix REPL memory mapping bug (#80)

* fixed repl memory mapping bug + started adding unittests for memory module

* Added warning message when no SP or PC was specified before starting emulation

* Update README.md with REPL screenshot

* Fixed the calculation of $sp and $pc when the emulator sets up

* Extra tests

* [ci] `publish` doesn't need to install

* [ci] `build` doesn't need to publish artifact

---------

Co-authored-by: Piotr Kasprzyk <ciri@ciri.pl>
Co-authored-by: thelumberjhack <5294889+thelumberjhack@users.noreply.github.com>
  • Loading branch information
3 people committed Jun 24, 2023
1 parent b7aa700 commit e48541c
Show file tree
Hide file tree
Showing 60 changed files with 3,656 additions and 1,344 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
* text=auto eol=lf
*.py auto=text eol=lf
*.png -text
*.png -text
17 changes: 17 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Contributing to CEMU ##

### License ###

`CEMU` is placed under [license MIT](https://github.com/hugsy/cemu/LICENSE) which provides Open-Source access to the code and its use.

By contributing to `CEMU` code through the _Pull Requests_ mechanism, you accept to release the code written by you under the said license.


### Submitting a Patch ###

1. Fork `CEMU` repository (requires GitHub account). Sending a patch from the `patch` or `git diff --patch` commands is not accepted.
1. Write the changes in your local repo.
* Respect the coding style (same indentation format, explicit names as possible)
* Comment your code
1. Submit a pull request **ALWAYS against `dev`** (never `main` - which is reserved for stable code)
1. Contributors will review your patch. If it is approved, the change will be merged via the GitHub, and you will be seen as contributors. If it needs additional work, the repo owner will respond with useful comments.
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: [hugsy,]

157 changes: 157 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
name: "Continuous Delivery"

on:
workflow_dispatch:
push:

env:
NAME: cemu
REPO: hugsy/cemu
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: ['3.10', '3.11']
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
outputs:
windows-latest-3-10: ${{ join(steps.*.outputs.windows-latest-3-10,'') }}
windows-latest-3-11: ${{ join(steps.*.outputs.windows-latest-3-11,'') }}
ubuntu-latest-3-10: ${{ join(steps.*.outputs.ubuntu-latest-3-10,'') }}
ubuntu-latest-3-11: ${{ join(steps.*.outputs.ubuntu-latest-3-11,'') }}
macos-latest-3-10: ${{ join(steps.*.outputs.macos-latest-3-10,'') }}
macos-latest-3-11: ${{ join(steps.*.outputs.macos-latest-3-11,'') }}

steps:
- uses: actions/checkout@v3

- uses: rlespinasse/github-slug-action@v4

- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: "Install Pre-requisite for Linux build"
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
sudo apt update
sudo apt upgrade -y
sudo apt install -y build-essential python3-dev python3-pip python3-wheel python3-setuptools
- name: "Install Pre-requisite for Windows build"
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
echo todo
- name: Build artifact
shell: bash
run: |
mkdir build
mkdir build/bin
python --version
python -m pip --version
python -m pip install --upgrade pip setuptools wheel
python -m pip install --user --upgrade .
- name: "Post build actions for Windows"
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Copy-Item $env:APPDATA\Python\Python*\Scripts\cemu.exe build\bin\
- name: "Post build actions for Linux"
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
cp -v ~/.local/bin/cemu build/bin/
- name: "Post build actions for MacOS"
if: matrix.os == 'macos-latest'
shell: bash
run: |
cp -v ~/.local/bin/cemu build/bin/ || cp -v /Users/runner/Library/Python/${{ matrix.python-version }}/bin/cemu build/bin/
- name: "Run tests"
run: |
python -m pip install --user --upgrade -r tests/requirements.txt
python -m pytest tests/
- name: Publish artifact
id: publish_artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.NAME }}_${{ matrix.os }}_py${{ matrix.python-version }}_${{ env.GITHUB_REF_SLUG }}_${{ env.GITHUB_SHA_SHORT }}
path: build/

- name: Populate the successful output (Windows)
id: output_success_windows
if: ${{ matrix.os == 'windows-latest' && success() }}
shell: pwsh
run: |
$pyVersion = "${{ matrix.python-version }}" -replace "\.", "-"
echo "${{ matrix.os }}-$pyVersion=✅ ${{ matrix.os }} ${{ matrix.python-version }}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Populate the successful output (Other)
id: output_success_other
if: ${{matrix.os != 'windows-latest' && success() }}
shell: bash
run: |
pyVersion="$(echo -n ${{ matrix.python-version }} | tr . -)"
echo "${{ matrix.os }}-${pyVersion}=✅ ${{ matrix.os }} ${{ matrix.python-version }}" >> $GITHUB_OUTPUT
- name: Populate the failure output (Windows)
id: output_failure_windows
if: ${{matrix.os == 'windows-latest' && failure() }}
shell: pwsh
run: |
$pyVersion = "${{ matrix.python-version }}" -replace "\.", "-"
echo "${{ matrix.os }}-${pyVersion}=❌ ${{ matrix.os }} ${{ matrix.python-version }}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Populate the failure output (Other)
id: output_failure_other
if: ${{matrix.os != 'windows-latest' && failure() }}
shell: bash
run: |
pyVersion="$(echo -n ${{ matrix.python-version }} | tr . -)"
echo "${{ matrix.os }}-$pyVersion=❌ ${{ matrix.os }} ${{ matrix.python-version }}" >> $GITHUB_OUTPUT
notify:
runs-on: 'ubuntu-latest'
needs: build
steps:
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4

- name: Send Discord notification
env:
COMMIT_URL: "https://github.com/${{ env.REPO }}/commit/${{ env.GITHUB_SHA_SHORT }}"
RUN_URL: "https://github.com/${{ env.REPO }}/actions/runs/${{ github.run_id }}"
BRANCH_URL: "https://github.com/${{ env.REPO }}/tree/${{ env.GITHUB_REF_SLUG }}"
AUTHOR_URL: "https://github.com/${{ github.actor }}"
uses: sarisia/actions-status-discord@v1.10.0
with:
nodetail: true
title: 🚧 🚧 Summary of Build `${{ env.GITHUB_SHA_SHORT }}` for `${{ env.REPO }}` 🚧 🚧
description: |
[Job #${{ github.run_number }}](${{ env.RUN_URL }}): CI build `${{ env.GITHUB_SHA_SHORT }}` initiated by [${{ github.actor }}](${{ env.AUTHOR_URL }}):
● Commit [${{ env.GITHUB_SHA_SHORT }}](${{ env.COMMIT_URL }})
● Branch [`${{ env.GITHUB_REF_SLUG }}`](${{ env.BRANCH_URL }})
● [Detail Page](${{ env.RUN_URL }})
${{ needs.build.outputs.windows-latest-3-10 }}
${{ needs.build.outputs.windows-latest-3-11 }}
${{ needs.build.outputs.ubuntu-latest-3-10 }}
${{ needs.build.outputs.ubuntu-latest-3-11 }}
${{ needs.build.outputs.macos-latest-3-10 }}
${{ needs.build.outputs.macos-latest-3-11 }}
color: 0x0000ff
username: ${{ github.actor }} via GithubBot
avatar_url: "https://github.com/hugsy/cemu/blob/dev/cemu/img/new_logo.png?raw=true"
101 changes: 0 additions & 101 deletions .github/workflows/cd.yml

This file was deleted.

72 changes: 72 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "dev" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "dev" ]
schedule:
- cron: '16 1 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
4 changes: 2 additions & 2 deletions .github/workflows/notify.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: "Discord Notification"
on: [push, pull_request, issues]
on: [pull_request, issues]
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}

jobs:
notify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

Expand Down
Loading

0 comments on commit e48541c

Please sign in to comment.