Skip to content

Commit

Permalink
Add rust python package
Browse files Browse the repository at this point in the history
  • Loading branch information
JanEricNitschke committed Sep 17, 2024
1 parent 7ab04a6 commit 9194e7a
Show file tree
Hide file tree
Showing 16 changed files with 558 additions and 89 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ jobs:
- name: Lint with ruff
uses: chartboost/ruff-action@v1
with:
version: 0.6.2
version: 0.6.5
- name: Check formatting with ruff
uses: chartboost/ruff-action@v1
with:
version: 0.6.2
version: 0.6.5
args: format
- name: Typecheck with pyright
uses: jakebailey/pyright-action@v2
with:
version: 1.1.377
version: 1.1.380
working-directory: ./tictactoe_python
- name: Thorough check with pylint
run: pylint tictactoe/
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,31 @@ jobs:
run: cargo build --verbose
- name: Test
run: cargo test --verbose

test_python_bindings:
name: Test Python Bindings
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
defaults:
run:
working-directory: ./tictactoe_rust/tictactoe_rust_python
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Run python binding game
run: |
python3 -m venv .venv
source .venv/bin/activate
pip install maturin
maturin develop
python3 tests/run_game.py
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
- id: check-builtin-literals
language: python
- repo: https://github.com/crate-ci/typos
rev: v1.24.5
rev: v1.24.6
hooks:
- id: typos
args: []
Expand All @@ -40,7 +40,7 @@ repos:
language: python
args: ["--write", "--check", "--output-style=google"]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.6.4
rev: v0.6.5
hooks:
- id: ruff
args:
Expand Down Expand Up @@ -72,7 +72,7 @@ repos:

# golang specific
- repo: https://github.com/golangci/golangci-lint
rev: v1.60.3
rev: v1.61.0
hooks:
- id: golangci-lint
entry: bash -c 'cd tictactoe_go && golangci-lint run --new-from-rev HEAD --fix'
Expand Down Expand Up @@ -235,7 +235,7 @@ repos:

# Perl specific
- repo: https://github.com/perltidy/perltidy
rev: "20240903"
rev: "20240903.02"
hooks:
- id: perltidy
files: ^tictactoe_perl/
Expand Down
199 changes: 193 additions & 6 deletions tictactoe_rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 3 additions & 18 deletions tictactoe_rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
[package]
name = "tictactoe_rust"
version = "0.1.0"
edition = "2021"
authors = ["Jan-Eric <janericnitschke@gmail.com"]
description = "A simple tictactoe game in rust."
readme = "README.md"
repository = "https://github.com/JanEricNitschke/TicTacToe/tree/main/tictactoe_rust"
license = "MIT"
keywords = ["cli", "game"]
categories = ["Games"]
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rand = "0.8.5"
scan-rules = "0.2.0"
[workspace]
members = ["tictactoe_rust", "tictactoe_rust_python"]
resolver = "2"
Loading

0 comments on commit 9194e7a

Please sign in to comment.