-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from FragileTech/update
Update to gymnasium API
- Loading branch information
Showing
58 changed files
with
2,212 additions
and
1,297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,120 +10,136 @@ on: | |
|
||
env: | ||
PROJECT_NAME: plangym | ||
PROJECT_DIR: plangym | ||
VERSION_FILE: plangym/version.py | ||
PROJECT_DIR: src/plangym | ||
VERSION_FILE: src/plangym/version.py | ||
DEFAULT_BRANCH: master | ||
BOT_NAME: fragile-bot | ||
BOT_EMAIL: [email protected] | ||
DOCKER_ORG: fragiletech | ||
PIP_CACHE: | | ||
~/.cache/pip | ||
LOCAL_CACHE: | | ||
~/.local/bin | ||
~/.local/lib/python3.*/site-packages | ||
jobs: | ||
style-check: | ||
name: Style check | ||
if: "!contains(github.event.head_commit.message, 'Bump version')" | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: actions/checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/checkout@v3 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.8" | ||
- name: actions/cache | ||
uses: actions/cache@v2 | ||
python-version: "3.10" | ||
- name: Setup Rye | ||
id: setup-rye | ||
uses: eifinger/setup-rye@v4 | ||
with: | ||
path: ${{ env.PIP_CACHE }} | ||
key: ubuntu-20.04-pip-lint-${{ hashFiles('requirements-lint.txt') }} | ||
restore-keys: ubuntu-20.04-pip-lint- | ||
- name: Install lint dependencies | ||
run: | | ||
set -x | ||
pip install -r requirements-lint.txt | ||
enable-cache: true | ||
cache-prefix: ubuntu-20.04-rye-check-${{ hashFiles('pyproject.toml') }} | ||
|
||
- name: Run style check and linter | ||
run: | | ||
set -x | ||
make check | ||
rye fmt --check | ||
rye lint | ||
pytest: | ||
name: Run Pytest | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, 'Bump version')" | ||
strategy: | ||
matrix: | ||
python-version: ['3.8'] | ||
python-version: ['3.10'] | ||
steps: | ||
- name: actions/checkout | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Setup Rye | ||
id: setup-rye | ||
uses: eifinger/setup-rye@v4 | ||
with: | ||
enable-cache: true | ||
cache-prefix: ubuntu-latest-rye-test-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} | ||
- name: actions/cache | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.PIP_CACHE }} | ||
key: ubuntu-20.04-pip-test-${{ matrix.python-version }}-${{ hashFiles('requirements.txt', 'requirements-test.txt') }} | ||
restore-keys: ubuntu-20.04-pip-test- | ||
path: ${{ env.LOCAL_CACHE }} | ||
key: ubuntu-latest-system-test-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} | ||
restore-keys: ubuntu-latest-system-test | ||
- name: Install test and package dependencies | ||
run: | | ||
set -x | ||
sudo apt-get install -y xvfb -y | ||
sudo MUJOCO_PATH=/home/runner/.mujoco/ make install-envs | ||
pip install -r requirements-test.txt -r requirements.txt | ||
rye pin --relaxed cpython@${{ matrix.python-version }} | ||
rye sync --all-features | ||
ROM_PASSWORD=${{ secrets.ROM_PASSWORD }} make import-roms | ||
pip install . | ||
- name: Test with pytest | ||
run: | | ||
set -x | ||
make test-codecov | ||
xvfb-run -s "-screen 0 1400x900x24" rye run codecov | ||
- name: Upload coverage report | ||
if: ${{ matrix.python-version=='3.8' }} | ||
uses: codecov/codecov-action@v1 | ||
|
||
test-docker: | ||
name: Test Docker container | ||
runs-on: ubuntu-20.04 | ||
if: "!contains(github.event.head_commit.message, 'Bump version')" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build container | ||
run: | | ||
set -x | ||
ROM_PASSWORD=${{ secrets.ROM_PASSWORD }} make docker-build | ||
- name: Run tests | ||
run: | | ||
set -x | ||
make docker-test | ||
if: ${{ matrix.python-version=='3.10' }} | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
fail_ci_if_error: false # optional (default = false) | ||
flags: unittests # optional | ||
name: codecov-umbrella # optional | ||
token: ${{ secrets.CODECOV_TOKEN }} # required | ||
verbose: true # optional (default = false) | ||
|
||
# test-docker: | ||
# name: Test Docker container | ||
# runs-on: ubuntu-20.04 | ||
# if: "!contains(github.event.head_commit.message, 'Bump version')" | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# - name: Build container | ||
# run: | | ||
# set -x | ||
# ROM_PASSWORD=${{ secrets.ROM_PASSWORD }} make docker-build | ||
# - name: Run tests | ||
# run: | | ||
# set -x | ||
# make docker-test | ||
|
||
build-test-package: | ||
name: Build and test the package | ||
needs: style-check | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-latest | ||
if: "!contains(github.event.head_commit.message, 'Bump version')" | ||
steps: | ||
- name: actions/checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/checkout@v3 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
python-version: '3.10' | ||
- name: Setup Rye | ||
id: setup-rye | ||
uses: eifinger/setup-rye@v4 | ||
with: | ||
enable-cache: true | ||
cache-prefix: ubuntu-latest-rye-build-3.10-${{ hashFiles('pyproject.toml') }} | ||
- name: actions/cache | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.PIP_CACHE }} | ||
key: ubuntu-20.04-pip-test-3.8-${{ hashFiles('requirements.txt', 'requirements-test.txt') }} | ||
restore-keys: ubuntu-20.04-pip-test- | ||
- name: Install dependencies | ||
path: ${{ env.LOCAL_CACHE }} | ||
key: ubuntu-latest-system-build-3.10-${{ hashFiles('pyproject.toml') }} | ||
restore-keys: ubuntu-latest-system-test | ||
- name: Install build dependencies | ||
run: | | ||
set -x | ||
python -m pip install -U pip | ||
python -m pip install -U setuptools twine wheel bump2version | ||
rye install bump2version | ||
rye install twine | ||
rye install uv | ||
- name: Create unique version for test.pypi | ||
run: | | ||
|
@@ -136,49 +152,51 @@ jobs: | |
- name: Build package | ||
run: | | ||
set -x | ||
python setup.py --version | ||
python setup.py bdist_wheel sdist --format=gztar | ||
rye build --clean | ||
twine check dist/* | ||
- name: Publish package to TestPyPI | ||
env: | ||
TEST_PYPI_PASS: ${{ secrets.TEST_PYPI_PASS }} | ||
if: "'$TEST_PYPI_PASS' != ''" | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TEST_PYPI_PASS }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
skip_existing: true | ||
# - name: Publish package to TestPyPI | ||
# env: | ||
# TEST_PYPI_PASS: ${{ secrets.TEST_PYPI_PASS }} | ||
# if: "'$TEST_PYPI_PASS' != ''" | ||
# uses: pypa/gh-action-pypi-publish@release/v1 | ||
# with: | ||
# password: ${{ secrets.TEST_PYPI_PASS }} | ||
# repository-url: https://test.pypi.org/legacy/ | ||
# skip-existing: true | ||
|
||
# apt-get install -y xvfb python-opengl ffmpeg | ||
- name: Install dependencies | ||
run: | | ||
set -x | ||
sudo apt-get install -y xvfb | ||
sudo MUJOCO_PATH=/home/runner/.mujoco/ make install-envs | ||
pip install -r requirements-test.txt -r requirements.txt | ||
ROM_PASSWORD=${{ secrets.ROM_PASSWORD }} make import-roms | ||
python -m pip install dist/*.whl | ||
rye lock --all-features | ||
uv pip install -r requirements.lock | ||
uv pip install dist/*.whl | ||
ROM_PASSWORD=${{ secrets.ROM_PASSWORD }} uv run import_retro_roms.py | ||
- name: Test package | ||
run: | | ||
set -x | ||
rm -rf $PROJECT_DIR | ||
make test | ||
find . -name "*.pyc" -delete | ||
PYVIRTUALDISPLAY_DISPLAYFD=0 SKIP_CLASSIC_CONTROL=1 xvfb-run -s "-screen 0 1400x900x24" uv run pytest -n auto -s -o log_cli=true -o log_cli_level=info tests | ||
PYVIRTUALDISPLAY_DISPLAYFD=0 xvfb-run -s "-screen 0 1400x900x24" uv run pytest -s -o log_cli=true -o log_cli_level=info tests/control/test_classic_control.py | ||
bump-version: | ||
name: Bump package version | ||
env: | ||
BOT_AUTH_TOKEN: ${{ secrets.BOT_AUTH_TOKEN }} | ||
if: "!contains(github.event.head_commit.message, 'Bump version') && github.ref == 'refs/heads/master' && '$BOT_AUTH_TOKEN' != ''" | ||
runs-on: ubuntu-20.04 | ||
runs-on: ubuntu-latest | ||
needs: | ||
- pytest | ||
- build-test-package | ||
- test-docker | ||
# - test-docker | ||
steps: | ||
- name: actions/checkout | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
fetch-depth: 100 | ||
|
@@ -199,59 +217,34 @@ jobs: | |
login: "${{ env.bot_name }}" | ||
token: "${{ secrets.BOT_AUTH_TOKEN }}" | ||
|
||
push-docker: | ||
name: Push Docker container | ||
runs-on: ubuntu-20.04 | ||
env: | ||
DOCKERHUB_PASS: ${{ secrets.DOCKERHUB_PASS }} | ||
if: "contains(github.event.head_commit.message, 'Bump version') && github.ref == 'refs/heads/master' && '$DOCKERHUB_PASS' != ''" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Login to DockerHub | ||
run: | | ||
set -x | ||
docker login -u "${{ secrets.DOCKERHUB_LOGIN }}" -p "${{ secrets.DOCKERHUB_PASS }}" docker.io | ||
- name: Build container | ||
run: | | ||
set -x | ||
CONTAINER_VERSION=v$(grep __version__ $VERSION_FILE | cut -d\" -f2) | ||
ROM_PASSWORD=${{ secrets.ROM_PASSWORD }} make docker-build VERSION=$CONTAINER_VERSION PROJECT=$PROJECT_NAME DOCKER_ORG=$DOCKER_ORG | ||
- name: Push images | ||
|
||
run: | | ||
set -x | ||
CONTAINER_VERSION=v$(grep __version__ $VERSION_FILE | cut -d\" -f2) | ||
make docker-push VERSION=$CONTAINER_VERSION PROJECT=$PROJECT_NAME DOCKER_ORG=$DOCKER_ORG | ||
release-package: | ||
name: Release PyPI package | ||
env: | ||
PYPI_PASS: ${{ secrets.PYPI_PASS }} | ||
if: "contains(github.event.head_commit.message, 'Bump version') && github.ref == 'refs/heads/master' && '$PYPI_PASS' != ''" | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: actions/checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: | | ||
set -x | ||
python -m pip install -U pip | ||
python -m pip install -U setuptools twine wheel | ||
- name: Build package | ||
run: | | ||
set -x | ||
python setup.py --version | ||
python setup.py bdist_wheel sdist --format=gztar | ||
twine check dist/* | ||
- name: Publish package to PyPI | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_PASS }} | ||
# release-package: | ||
# name: Release PyPI package | ||
# env: | ||
# PYPI_PASS: ${{ secrets.PYPI_PASS }} | ||
# if: "contains(github.event.head_commit.message, 'Bump version') && github.ref == 'refs/heads/master' && '$PYPI_PASS' != ''" | ||
# runs-on: ubuntu-20.04 | ||
# steps: | ||
# - name: actions/checkout | ||
# uses: actions/checkout@v3 | ||
# - name: Set up Python 3.8 | ||
# uses: actions/setup-python@v3 | ||
# with: | ||
# python-version: 3.8 | ||
# - name: Install dependencies | ||
# run: | | ||
# set -x | ||
# python -m pip install -U pip | ||
# python -m pip install -U setuptools twine wheel | ||
# | ||
# - name: Build package | ||
# run: | | ||
# set -x | ||
# python setup.py --version | ||
# python setup.py bdist_wheel sdist --format=gztar | ||
# twine check dist/* | ||
# | ||
# - name: Publish package to PyPI | ||
# uses: pypa/gh-action-pypi-publish@master | ||
# with: | ||
# user: __token__ | ||
# password: ${{ secrets.PYPI_PASS }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PYVIRTUALDISPLAY_DISPLAYFD=0 | ||
SKIP_CLASSIC_CONTROL=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PYTEST_XDIST_AUTO_NUM_WORKERS=1 | ||
PYVIRTUALDISPLAY_DISPLAYFD=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.