Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CI

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
checks:
name: Formatting, typing and linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.12"
enable-cache: true

- name: Install system libraries
run: bash scripts/linux/build/dependencies.sh

- name: Install the development environment
run: uv sync --group dev

- name: Cache pre-commit environments
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Run every pre-commit hook
run: uv run pre-commit run --all-files --show-diff-on-failure --color always

tests:
name: Tests (${{ matrix.os }}, py${{ matrix.python }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python: ["3.12", "3.13"]
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python }}
enable-cache: true

- name: Install system libraries (Linux)
if: runner.os == 'Linux'
run: bash scripts/linux/build/dependencies.sh

- name: Install the development environment
run: uv sync --group dev

- name: Run doctests
run: uv run python -m pytest src/ --doctest-modules --no-cov

- name: Run the unit and integration suites with coverage
run: uv run python -m pytest -n auto --cov
220 changes: 220 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
name: Release

on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
target:
description: "Where to publish"
required: true
default: testpypi
type: choice
options:
- testpypi
- pypi

permissions:
contents: read

jobs:
build:
name: Build distributions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.12"

- name: Verify tag matches project version
if: startsWith(github.ref, 'refs/tags/v')
run: |
project_version="$(uv version --short)"
tag_version="${GITHUB_REF_NAME#v}"
if [ "$project_version" != "$tag_version" ]; then
echo "::error::Tag $GITHUB_REF_NAME does not match pyproject version $project_version"
exit 1
fi
echo "Version $project_version matches tag $GITHUB_REF_NAME"

- name: Build sdist and wheel
run: uv build

- name: Check metadata renders on PyPI
run: uvx twine check --strict dist/*

- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

smoke-test:
name: Smoke test (${{ matrix.os }}, py${{ matrix.python }})
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python: ["3.12", "3.13"]
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist

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

- name: Install PortAudio and Tk (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y portaudio19-dev python3-tk

- name: Install PortAudio (macOS)
if: runner.os == 'macOS'
run: |
brew install portaudio
prefix="$(brew --prefix portaudio)"
echo "CFLAGS=-I${prefix}/include" >> "$GITHUB_ENV"
echo "LDFLAGS=-L${prefix}/lib" >> "$GITHUB_ENV"

- name: Install the wheel and check the entry point
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install dist/*.whl
sampletones --version

- name: Check the wheel carries every resource it needs at startup
shell: bash
run: sampletones --self-check

bundle:
name: Standalone bundle (${{ matrix.platform }})
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux-x86_64
- os: windows-latest
platform: windows-x86_64
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install system libraries (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y python3-tk tk-dev libportaudio2 libasound-dev portaudio19-dev

- name: Create the build environment the bundle scripts expect
shell: bash
run: |
python -m venv .venv-build
if [ "$RUNNER_OS" = "Windows" ]; then
venv_python=.venv-build/Scripts/python.exe
else
venv_python=.venv-build/bin/python
fi
"$venv_python" -m pip install --upgrade pip
"$venv_python" -m pip install ".[build]"

- name: Build the bundle (Linux)
if: runner.os == 'Linux'
run: bash scripts/linux/build/build.sh --release

- name: Build the bundle (Windows)
if: runner.os == 'Windows'
shell: cmd
run: scripts\windows\build\build.bat --release

- name: Check the bundle runs and carries its notices
shell: bash
run: |
test -f bin/sampletones/LICENSE
test -f bin/sampletones/THIRD-PARTY-NOTICES.md
test -f bin/sampletones/THIRD-PARTY-LICENSES.txt
if [ "$RUNNER_OS" = "Windows" ]; then
./bin/sampletones/sampletones.exe --version
else
./bin/sampletones/sampletones --version
fi

- name: Zip the bundle
shell: bash
run: |
name="sampletones-${GITHUB_REF_NAME}-${{ matrix.platform }}"
mkdir -p bundles
mv bin/sampletones "bin/${name}"
python -c "import shutil, sys; shutil.make_archive(sys.argv[1], 'zip', 'bin', sys.argv[2])" \
"bundles/${name}" "${name}"

- uses: actions/upload-artifact@v4
with:
name: bundle-${{ matrix.platform }}
path: bundles/*.zip

release:
name: Attach bundles to a draft GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
needs: bundle
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: bundle-*
merge-multiple: true
path: bundles

- name: Create or update the draft release
env:
GH_TOKEN: ${{ github.token }}
run: |
if ! gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release create "$GITHUB_REF_NAME" \
--repo "$GITHUB_REPOSITORY" \
--draft \
--title "$GITHUB_REF_NAME" \
--generate-notes
fi
gh release upload "$GITHUB_REF_NAME" bundles/*.zip \
--repo "$GITHUB_REPOSITORY" --clobber

publish:
name: Publish to ${{ github.event_name == 'workflow_dispatch' && inputs.target || 'pypi' }}
needs: [build, smoke-test]
runs-on: ubuntu-latest
environment:
name: ${{ github.event_name == 'workflow_dispatch' && inputs.target || 'pypi' }}
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist

- name: Publish to TestPyPI
if: github.event_name == 'workflow_dispatch' && inputs.target == 'testpypi'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

- name: Publish to PyPI
if: github.event_name != 'workflow_dispatch' || inputs.target == 'pypi'
uses: pypa/gh-action-pypi-publish@release/v1
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ repos:
types: [text]
exclude: ^(LICENSE|THIRD-PARTY-LICENSES\.txt|src/sampletones_assets/fonts/LICENSES/)

- id: check-yaml
- id: check-toml
- id: end-of-file-fixer
types: [text]
exclude: ^(LICENSE|THIRD-PARTY-LICENSES\.txt|src/sampletones_assets/fonts/LICENSES/)

- repo: https://github.com/timothycrosley/isort
rev: 9.0.0a3
hooks:
Expand Down Expand Up @@ -43,12 +49,6 @@ repos:
files: ^src/sampletones_application/tags/
verbose: true

- id: yamlfmt
name: yamlfmt
entry: uv run yamlfmt
language: system
types: [yaml]

- id: mypy
name: mypy
entry: uv run mypy
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ disable=C0104,C0114,C0115,C0116,C0302,C0415,E0402,E1101,E1130,R0801,R0901,R0902,
max-line-length=120

[TYPECHECK]
ignored-modules=pydantic
ignored-modules=pydantic
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# SampleToNES

## v0.3.0 [2026-07-25]
## v0.3.0 [2026-07-31]

* Added a _Sequencer_ view with FamiTracker-style patterns.
* Added project export in a FamiTracker-compatible format.
* Improved matching algorithms and extended availalbe methods (`LogFFT`, `CQT`).
* Improved matching algorithms and extended available methods (`LogFFT`, `CQT`).
* Improved the general layout of the application.
* Changed the internal file formats (`.stn`, `.ins`).
* Switched to `uv` as the package manager.
Expand Down
Loading
Loading