Skip to content

Commit b6375f0

Browse files
committed
Initial version
0 parents  commit b6375f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+4919
-0
lines changed

.github/renovate.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"addLabels": [
4+
"dependencies",
5+
"bot"
6+
],
7+
"extends": [
8+
"config:best-practices"
9+
],
10+
"pre-commit": {
11+
"enabled": true
12+
},
13+
"packageRules": [
14+
{
15+
"matchUpdateTypes": [
16+
"minor",
17+
"patch",
18+
"pin",
19+
"digest"
20+
],
21+
"automerge": true
22+
},
23+
{
24+
"matchDepTypes": [
25+
"devDependencies"
26+
],
27+
"automerge": true
28+
}
29+
],
30+
"platformAutomerge": true
31+
}

.github/workflows/ci-cd.yml

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
name: Python checks
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
tags: [v*]
7+
pull_request:
8+
merge_group:
9+
10+
env:
11+
FORCE_COLOR: 1
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
linting:
18+
runs-on: ubuntu-latest
19+
name: "Python linting"
20+
steps:
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
25+
with:
26+
enable-cache: true
27+
cache-dependency-glob: "uv.lock"
28+
29+
- name: Set up Python 🐍
30+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
31+
with:
32+
python-version-file: "pyproject.toml"
33+
34+
- name: Check lock is up-to-date
35+
run: |
36+
uv lock --check
37+
38+
- name: Install dependencies
39+
run: |
40+
uv sync
41+
echo "$PWD/.venv/bin" >> $GITHUB_PATH
42+
43+
- name: Check file formatting
44+
uses: astral-sh/ruff-action@eaf0ecdd668ceea36159ff9d91882c9795d89b49 # v3.4.0
45+
with:
46+
args: "format --check"
47+
48+
- name: Lint with ruff
49+
env:
50+
RUFF_OUTPUT_FORMAT: github
51+
run: |
52+
ruff check
53+
54+
- name: Typecheck with pyright
55+
uses: jakebailey/pyright-action@b5d50e5cde6547546a5c4ac92e416a8c2c1a1dfe # v2.3.2
56+
with:
57+
version: PATH
58+
59+
tests:
60+
strategy:
61+
fail-fast: false
62+
matrix:
63+
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
64+
python-version: ["3.11", "3.12", "3.13"]
65+
66+
name: Python tests (${{ matrix.python-version }}, ${{ matrix.os }})
67+
runs-on: ${{ matrix.os }}
68+
69+
steps:
70+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
71+
72+
- name: Install uv
73+
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
74+
with:
75+
enable-cache: true
76+
cache-dependency-glob: "uv.lock"
77+
python-version: ${{ matrix.python-version }}
78+
79+
- name: Set up Python ${{ matrix.python-version }} 🐍
80+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
81+
with:
82+
python-version: ${{ matrix.python-version }}
83+
84+
- name: Install dependencies
85+
run: uv sync
86+
87+
- name: Install additional backends (best effort)
88+
continue-on-error: true
89+
run: uv sync --all-extras
90+
91+
- name: Test with pytest
92+
run: |
93+
# codecov requires that the test results are shared in xunit1 / legacy format.
94+
uv run pytest -v --junitxml=junit.xml -o junit_family=legacy
95+
96+
- name: Upload coverage reports to Codecov
97+
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
98+
with:
99+
token: ${{ secrets.CODECOV_TOKEN }}
100+
101+
- name: Upload test results to Codecov
102+
if: ${{ !cancelled() }}
103+
uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1.1.1
104+
with:
105+
token: ${{ secrets.CODECOV_TOKEN }}
106+
107+
test-summary:
108+
name: Test matrix status
109+
runs-on: ubuntu-latest
110+
needs:
111+
- linting
112+
- tests
113+
if: always()
114+
steps:
115+
- name: Decide whether the needed jobs succeeded or failed
116+
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
117+
with:
118+
jobs: ${{ toJSON(needs) }}
119+
120+
121+
build:
122+
name: Build distribution 📦
123+
runs-on: ubuntu-latest
124+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
125+
needs:
126+
- test-summary
127+
128+
outputs:
129+
version: ${{ steps.note.outputs.version }}
130+
prerelease: ${{ steps.note.outputs.prerelease }}
131+
132+
steps:
133+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
134+
135+
- name: Install uv
136+
uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb # v6.1.0
137+
with:
138+
enable-cache: true
139+
cache-dependency-glob: "uv.lock"
140+
141+
- name: Set up Python 🐍
142+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
143+
with:
144+
python-version-file: "pyproject.toml"
145+
146+
- name: Install dependencies
147+
run: |
148+
uv sync
149+
150+
- name: Build the Python 🐍 binary wheel and source tarball 📦
151+
id: build-dist
152+
run: |
153+
uv build
154+
rm -f dist/.gitignore # get-releasenotes can't handle non-dist files here
155+
echo "version=$(uvx hatch version) >> $GITHUB_OUTPUT
156+
157+
- name: Check build
158+
run: uvx twine check --strict dist/*
159+
160+
- name: Prepare Release Note
161+
id: note
162+
uses: aio-libs/get-releasenote@b0fcc7f3e5f5cc7c8b01e2f75516b1732f6bd8b2 # v1.4.5
163+
with:
164+
changes_file: CHANGELOG.md
165+
output_file: release_notes.md
166+
version: ${{ steps.build-dist.outputs.version }}
167+
start_line: '<!-- changes go below this line -->'
168+
head_line: '## \[{version}\] - {date}\)'
169+
name: Rummikub Solver library
170+
dist_dir: dist
171+
172+
- name: Store the Python 🐍 distribution 📦
173+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
174+
with:
175+
name: python-package-distributions
176+
path: |
177+
dist/
178+
release_notes.md
179+
180+
pypi-publish:
181+
name: Upload release to PyPI
182+
runs-on: ubuntu-latest
183+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
184+
needs:
185+
- build
186+
environment:
187+
name: pypi
188+
url: https://pypi.org/p/rummikub-solver
189+
permissions:
190+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
191+
192+
steps:
193+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
194+
195+
- name: Download Python 🐍 distribution 📦
196+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
197+
with:
198+
name: python-package-distributions
199+
200+
- name: Publish Python 🐍 distribution 📦 to PyPI
201+
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
202+
203+
- name: GitHub release
204+
uses: ncipollo/release-action@440c8c1cb0ed28b9f43e4d1d670870f059653174 # v1.16.0
205+
with:
206+
name: Rummikub Solver library ${{ needs.build.outputs.version }}
207+
bodyFile: release_notes.md
208+
artifacts: dist/*
209+
prerelease: ${{ needs.build.outputs.prerelease }}

.github/workflows/codeql.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL Advanced"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
merge_group:
19+
schedule:
20+
- cron: '25 22 * * 4'
21+
22+
jobs:
23+
analyze:
24+
name: Analyze (Python)
25+
# Runner size impacts CodeQL analysis time. To learn more, please see:
26+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
27+
# - https://gh.io/supported-runners-and-hardware-resources
28+
# - https://gh.io/using-larger-runners (GitHub.com only)
29+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
30+
runs-on: ubuntu-latest
31+
permissions:
32+
# required for all workflows
33+
security-events: write
34+
35+
# required to fetch internal or private CodeQL packs
36+
packages: read
37+
38+
# only required for workflows in private repositories
39+
actions: read
40+
contents: read
41+
42+
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
43+
# Use `c-cpp` to analyze code written in C, C++ or both
44+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
45+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
46+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
47+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
48+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
49+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
50+
steps:
51+
- name: Checkout repository
52+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
53+
54+
# Initializes the CodeQL tools for scanning.
55+
- name: Initialize CodeQL
56+
uses: github/codeql-action/init@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
57+
with:
58+
languages: python
59+
build-mode: none
60+
# If you wish to specify custom queries, you can do so here or in a config file.
61+
# By default, queries listed here will override any specified in a config file.
62+
# Prefix the list here with "+" to use these queries and those in the config file.
63+
64+
# For more 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
65+
# queries: security-extended,security-and-quality
66+
67+
- name: Perform CodeQL Analysis
68+
uses: github/codeql-action/analyze@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3.29.0
69+
with:
70+
category: /language:python

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
__pycache__
2+
.cache/
3+
.hypothesis/
4+
.task/
5+
.venv/
6+
dist/
7+
site/
8+
.coverage
9+
.env
10+
coverage.xml

.pre-commit-config.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
default_install_hook_types:
2+
- pre-commit
3+
- post-checkout
4+
- post-merge
5+
- post-rewrite
6+
repos:
7+
- repo: https://github.com/astral-sh/uv-pre-commit
8+
rev: 0.7.13
9+
hooks:
10+
- id: uv-lock
11+
- id: uv-sync
12+
- repo: https://github.com/astral-sh/ruff-pre-commit
13+
rev: v0.11.13
14+
hooks:
15+
- id: ruff-format
16+
- id: ruff-check
17+
- repo: https://github.com/RobertCraigie/pyright-python
18+
rev: v1.1.402
19+
hooks:
20+
- id: pyright
21+
additional_dependencies:
22+
- annotated-types>=0.7.0
23+
- pytest>=8.4.0
24+
- hypothesis>=6.135.14
25+
- repo: https://github.com/renovatebot/pre-commit-hooks
26+
rev: 40.59.4
27+
hooks:
28+
- id: renovate-config-validator

.readthedocs.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Read the Docs configuration file for MkDocs projects
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
# Set the version of Python and other tools you might need
8+
build:
9+
os: ubuntu-24.04
10+
tools:
11+
python: "3.12"
12+
jobs:
13+
pre_create_environment:
14+
- asdf plugin add uv
15+
- asdf install uv latest
16+
- asdf global uv latest
17+
create_environment:
18+
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
19+
install:
20+
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --frozen --group docs
21+
22+
mkdocs:
23+
configuration: mkdocs.yml

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https:/keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
<!-- changes go below this line -->
9+
10+
## [Unreleased]
11+
12+
### Added
13+
14+
- First public release. This project was extracted from [`RummikubConsole`](https://github.com/mjpieters/RummikubConsole).
15+
- Full documentation, tests and linting added.
16+
- A slew of bugfixes and improvements.

0 commit comments

Comments
 (0)