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

CI Update 2023 #13

Merged
merged 6 commits into from
Nov 29, 2023
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
11 changes: 11 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Build

on:
schedule:
# Every Monday at 1PM UTC (9AM EST)
- cron: "0 13 * * 1"
push:
branches:
- master
Expand All @@ -10,9 +13,17 @@ on:

jobs:
build:
strategy:
matrix:
os: [ubuntu-20.04]
python-version: [3.7, 3.8, 3.9, 3.10.6, 3.11]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Setup Packages
run: sh tools/setup.sh
- name: Build Packages
Expand Down
2 changes: 1 addition & 1 deletion mathy_envs/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
ConstantsSimplifyRule,
DistributiveFactorOutRule,
DistributiveMultiplyRule,
VariableMultiplyRule,
RestateSubtractionRule,
VariableMultiplyRule,
)
from mathy_core.tree import BinaryTreeNode, VisitStop
from mathy_core.util import compare_expression_string_values, raise_with_history
Expand Down
6 changes: 4 additions & 2 deletions mathy_envs/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

# Use typing_extensions for Python < 3.8
if sys.version_info < (3, 8):
from typing_extensions import Literal, get_args # noqa
from typing_extensions import Literal # noqa
from typing_extensions import get_args # noqa
else:
from typing import Literal, get_args # noqa
from typing import Literal # noqa
from typing import get_args # noqa


class MathyEnvDifficulty(Enum):
Expand Down
3 changes: 0 additions & 3 deletions tests/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def test_env_random_actions():


def test_env_invalid_action_behaviors():

problem = "4x + 2x"
env = MathyEnv(invalid_action_response="raise")
env_state = MathyEnvState(problem=problem, max_moves=35)
Expand Down Expand Up @@ -86,7 +85,6 @@ def test_env_invalid_action_behaviors():


def test_env_terminal_conditions():

expectations = [
("70656 * (x^2 * z^6)", True),
("b * (44b^2)", False),
Expand Down Expand Up @@ -248,7 +246,6 @@ def test_mathy_env_previous_state_penalty():


def test_mathy_env_win_conditions():

expectations = [
("70656 * (x^2 * z^6)", True),
("b * (44b^2)", False),
Expand Down
2 changes: 1 addition & 1 deletion tools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e
. .env/bin/activate

echo "Build python package..."
python setup.py sdist bdist_wheel
python3 setup.py sdist bdist_wheel
2 changes: 1 addition & 1 deletion tools/codecov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
set -e
. .env/bin/activate
pip install codecov
python -m codecov
python3 -m codecov
2 changes: 1 addition & 1 deletion tools/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ echo "--- Install requirements"
pip install twine wheel
pip install -r requirements.txt
echo "--- Buid dists"
python setup.py sdist bdist_wheel
python3 setup.py sdist bdist_wheel
echo "--- Upload to PyPi"
# NOTE: ignore errors on upload because our CI is dumb and tries to upload
# even if the version has already been uploaded. This isn't great, but
Expand Down
13 changes: 12 additions & 1 deletion tools/setup.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
#!/bin/bash
set -e

# Default Python path
PYTHON_PATH="python3"

# Check if a custom Python path is provided as the first argument
if [ -n "$1" ]; then
PYTHON_PATH="$1"
fi

echo "Using Python at: $PYTHON_PATH"
$PYTHON_PATH --version

# Make the virtualenv only if the folder doesn't exist
DIR=.env
if [ ! -d "${DIR}" ]; then
pip install virtualenv --upgrade
python -m virtualenv .env -p python3 || virtualenv .env -p python3
$PYTHON_PATH -m virtualenv .env -p $PYTHON_PATH || virtualenv .env -p $PYTHON_PATH
fi

. .env/bin/activate
Expand Down