Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/refactor #57

Merged
merged 18 commits into from
Mar 16, 2024
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
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: continuous deployment
name: CD

on:
release:
types: [published]
branches:
- master

permissions:
contents: read
Expand Down Expand Up @@ -96,7 +94,7 @@ jobs:
release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
if: startsWith(github.ref, 'refs/tags/')
needs: [linux, windows, macos, sdist]
steps:
- uses: actions/download-artifact@v3
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI

on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

permissions: read-all

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# Clippy - Rust linter
- name: Install Rust toolchain
run: rustup toolchain install stable
- name: Run Clippy
run: rustup component add clippy && cargo clippy -- -D warnings

# Install dependencies and run unittests within the virtual environment
- name: Setup and run tests in virtual environment
run: |
python -m venv venv
source venv/bin/activate
pip install ruff
ruff .
pip install maturin
maturin develop
python -m unittest discover -s tests -p '*.py'


# Build and test steps for Rust
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
4 changes: 2 additions & 2 deletions .github/workflows/convert.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: convert readme
on:
push:
branches: [ master ]
branches: [master]
jobs:
convert:
runs-on: ubuntu-latest
Expand All @@ -20,4 +20,4 @@ jobs:
git add docs/index.rst
git commit -m "docs: auto update index.rst"
git push
continue-on-error: true
continue-on-error: true
17 changes: 0 additions & 17 deletions .github/workflows/push.yaml

This file was deleted.

28 changes: 25 additions & 3 deletions logic.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
import logging
import random
from typing import List

# not all imports are currently used, but they might be in the future and it shows all available functionalities
from socha import Accelerate, AccelerationProblem, Advance, AdvanceInfo, AdvanceProblem, Board
from socha import CartesianCoordinate, CubeCoordinates, CubeDirection, Field, FieldType, GameState
from socha import Move, Passenger, Push, PushProblem, Segment, Ship, TeamEnum, TeamPoints, Turn, TurnProblem
from socha import (
Accelerate,
AccelerationProblem,
Advance,
AdvanceInfo,
AdvanceProblem,
Board,
CartesianCoordinate,
CubeCoordinates,
CubeDirection,
Field,
FieldType,
GameState,
Move,
Passenger,
Push,
PushProblem,
Segment,
Ship,
TeamEnum,
TeamPoints,
Turn,
TurnProblem,
)
from socha.api.networking.game_client import IClientHandler
from socha.starter import Starter

Expand Down
29 changes: 16 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ readme = "README.md"
requires-python = ">=3.10"
dependencies = ["xsdata==22.9"]
classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python",
"Programming Language :: Rust",
"Typing :: Typed",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python",
"Programming Language :: Rust",
"Typing :: Typed",
]
homepage = "https://software-challenge.de/"
repository = "https://github.com/FalconsSky/socha-python-client"
Expand All @@ -37,3 +37,6 @@ python-source = "python"
module-name = "socha._socha"
exclude = [".github", "docs", "tests", "logic.py", "readthedocs.yaml"]
features = ["pyo3/extension-module"]

[tool.ruff]
exclude = ["logic.py", "python/socha/__init__.py"]
1 change: 0 additions & 1 deletion python/socha/_socha.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ class GameState:
other_ship: Ship, last_move: Optional[Move]) -> None: ...

def determine_ahead_team(self) -> Ship: ...
def ship_advance_points(self, ship: Ship) -> int: ...
def calculate_points(self, ship: Ship) -> int: ...
def is_current_ship_on_current(self) -> bool: ...
def perform_action(self, action: Accelerate | Advance |
Expand Down
Loading
Loading