Skip to content

Commit

Permalink
Fixed broken dev dependencies in pyproject.toml (rather than sketchy CI)
Browse files Browse the repository at this point in the history
Made Windows CI generally a lot smoother/faster
Windows pyenv, poetry install cache
  • Loading branch information
julianneswinoga committed Dec 14, 2023
1 parent 66bcfc9 commit 5d95a67
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 71 deletions.
96 changes: 29 additions & 67 deletions .circleci/config.yml
Expand Up @@ -63,12 +63,12 @@ jobs:
- run:
name: Delete JSBSim tests
command: rm --verbose tests/test_*JSBSim*.py
- run:
name: Poetry build
command: poetry build --no-ansi --no-interaction
- run:
name: Poetry install
command: poetry install --no-ansi --no-interaction
- run:
name: Poetry build
command: poetry build --no-ansi --no-interaction
- run:
name: Install coverage
command: pip install -U coverage coveralls
Expand Down Expand Up @@ -130,22 +130,8 @@ jobs:
shell: powershell.exe
steps:
- checkout
- run:
name: Uninstall python
command: |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
RefreshEnv
choco uninstall python --yes
RefreshEnv
choco uninstall python3 --yes
Get-ChildItem -Path "C:/"
$py_sys_location = "C:/Python311"
If (Test-Path $py_sys_location) {
Remove-Item -Recurse -Force $py_sys_location
}
else {
Write-Host "$py_sys_location not found"
}
- restore_cache:
key: &pyenv-win-cache pyenv-cache-{{ arch }}-<< parameters.python-version >>-{{ .Branch }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "poetry.lock" }}
- run:
name: Install pyenv-win
command: |
Expand All @@ -156,82 +142,58 @@ jobs:
- run:
name: Install Python
command: |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
RefreshEnv
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"; RefreshEnv
pyenv install << parameters.python-version >>
RefreshEnv
pyenv global << parameters.python-version >>
RefreshEnv
pyenv version
python -c "import sys; print(sys.executable)"
python --version
pyenv exec python -c "import sys; print(sys.executable)"
pyenv exec python --version
- run:
name: Update Pip
command: |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
RefreshEnv
python -m pip install -U pip
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"; RefreshEnv
pyenv exec python -m pip install -U pip
- run:
name: Install Poetry
command: |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
RefreshEnv
python -m pip install -U poetry==1.1.15
RefreshEnv
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"; RefreshEnv
pyenv exec python -m pip install -U poetry==1.1.15
# Work around broken urllib3 dependency from poetry 1.1.15
python -m pip install --upgrade urllib3==1.26.12
pyenv exec python -m pip install --upgrade urllib3==1.26.12
- when:
# 3.10 has a problem with numpy 1.19.5, from JSBSim
# This hack can be removed when 3.6 support is dropped
condition:
equal: [ "3.10.5", << parameters.python-version >> ]
steps:
- run:
name: Remove JSBSim and sh
command: |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
RefreshEnv
python -m poetry remove --dev JSBSim sh
- run:
name: Delete JSBSim tests
command: remove-item "tests/test_*JSBSim*.py"
- when:
condition:
# omg wtf circleci. No "else"?
and:
- not:
equal: [ "3.10.5", << parameters.python-version >> ]
steps:
- run:
name: Poetry remove sh
command: |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
RefreshEnv
python -m poetry remove --dev sh
- run:
name: Poetry build
command: |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
RefreshEnv
python -m poetry build --no-ansi --no-interaction
- run:
name: Poetry install
command: |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
RefreshEnv
python -m poetry install --no-ansi --no-interaction
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"; RefreshEnv
pyenv exec python -m poetry install --no-ansi --no-interaction
- run:
name: Install coverage
command: |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
RefreshEnv
python -m pip install -U coverage
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"; RefreshEnv
pyenv exec python -m pip install -U coverage
- save_cache:
key: *pyenv-win-cache
paths:
- "C:/Users/circleci/.pyenv"
- "C:/Users/circleci/AppData/Local/pypoetry/Cache/virtualenvs"
- run:
name: Poetry build
command: |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"; RefreshEnv
pyenv exec python -m poetry build --no-ansi --no-interaction
- run:
name: Run pytest
command: |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
RefreshEnv
python -m poetry run coverage run -m pytest tests/
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"; RefreshEnv
pyenv exec python -m poetry run coverage run -m pytest tests/
poetry_publish:
executor:
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

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

4 changes: 2 additions & 2 deletions pyproject.toml
Expand Up @@ -21,15 +21,15 @@ requests = "==2.27.1"
sphinx = "==4.3.2" # Supports 3.6, and doesn't depend on importlib-metadata (conflict with flake8)
sphinx_mdinclude = "^0.5.2"
sphinx-rtd-theme = "^0.5.2" # Can't `poetry update` with 1.0.0?
sh = "^1.14.3"
sh = { version = "^1.14.3", markers = "sys_platform == 'linux'" }
pytest-cov = "^3.0.0"
requests-mock = "^1.11.0"
Flake8-pyproject = "^1.2.3"
# Following are pegged at the latest version that supports Python 3.6
pytest = "==7.0.1"
GitPython = "==3.1.20"
pytest-mock = "==3.6.1"
JSBSim = "==1.1.11"
JSBSim = { version = "==1.1.11", markers = "python_version != '3.10'" }
black = "==22.8.0"
flake8 = "==5.0.4"

Expand Down
2 changes: 1 addition & 1 deletion scripts/run_tests.sh
Expand Up @@ -21,6 +21,6 @@ for arg in "$@"; do
set -- "$@" "$arg"
done

poetry build
poetry install
poetry build
pytest --cov-report term-missing:skip-covered --cov=flightgear_python tests/ "$@"

0 comments on commit 5d95a67

Please sign in to comment.