diff --git a/.gitignore b/.gitignore index 841e961..c81f728 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ __pycache__/ -venv/ .tox/ .hypothesis/ .mutmut-cache diff --git a/Jenkinsfile b/Jenkinsfile index 274efe1..8a36853 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,10 +12,9 @@ } } steps { - echo "Building for Linux" - sh ". ./env.sh; dobuild" - echo "Testing for Linux" - sh ". ./env.sh; domut_ci && dotest_ci" + echo "Running CI for Linux" + sh "pip install tox" + sh "tox -q r -e ci" sh "mv dist dist.linux" archiveArtifacts artifacts: 'dist.linux', fingerprint: true cleanWs cleanWhenAborted: false, cleanWhenFailure: false, cleanWhenNotBuilt: false, cleanWhenUnstable: false @@ -26,11 +25,9 @@ label 'windows' } steps { - echo "Building for Windows" - sh ". .\\env.ps1; dobuild" - echo "Testing for Windows" - pwsh ".\\env.ps1; domut_ci; dotest_ci" - pwsh "mv dist dist.windows" + echo "Running CI for Windows" + sh "tox -q r -e ci" + sh "mv dist dist.windows" archiveArtifacts artifacts: 'dist.windows', fingerprint: true cleanWs cleanWhenAborted: false, cleanWhenFailure: false, cleanWhenNotBuilt: false, cleanWhenUnstable: false } diff --git a/env.ps1 b/env.ps1 deleted file mode 100644 index 2434519..0000000 --- a/env.ps1 +++ /dev/null @@ -1,50 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-only -# Copyright 2022 Jookia - -# Set up UTF-8 support for PowerShell pipes -[System.Console]::OutputEncoding = [System.Text.Encoding]::UTF8; -[System.Console]::InputEncoding = [System.Text.Encoding]::UTF8; -$env:PYTHONIOENCODING = "utf-8"; - -Function Activate { .\venv\Scripts\Activate.ps1 } - -Function Die { - Param ( $Message ) - Remove-Item -Recurse venv - Write-Output $Message - Exit 1 -} - -Function Setup { - Write-Output "No venv found, creating..." - python -m venv venv || Die "Unable to create venv" - Write-Output "Activating venv..." - Activate - Write-Output "Updating pip..." - python -m pip -q install -U pip || Die "Unable to update pip" - Write-Output "Installing requirements..." - python -m pip -q install --use-pep517 -r requirements.txt || Die "Unable to install requirements" - New-Item venv\.stamp | Out-Null - Write-Output "All done!" -} - -If (Test-Path -Path venv\.stamp) { Activate } Else { Setup } - -$env:PYTHONPATH += ";$PWD\src"; - -# NOTE: PowerShell functions always return success even if the commands inside -# failed. This makes it infeasible to do proper error checking. -# See https://github.com/PowerShell/PowerShell/issues/12218 - -Function Global:resetenv { rm -r venv; .\env.ps1 } -Function Global:dotidy { black src tests } -Function Global:dolint { flake8 src tests } -Function Global:dotest { pytest -q -n auto -x -l --sw --hypothesis-profile=dev $args } -Function Global:dotest_dev { pytest -vv -n 0 -x -l --sw --hypothesis-profile=dev $args } -Function Global:dotest_ci { pytest -q -n auto --hypothesis-profile=ci } -Function Global:dotest_long { pytest -q -n auto --hypothesis-profile=long } -Function Global:docheck { dotidy; dolint; dotest } -Function Global:_envps1_domut { mutmut run --paths-to-mutate "src/newlang/parse2,src/newlang/i18n.py" $args } -Function Global:domut { _envps1_domut } -Function Global:domut_ci { _envps1_domut --no-progress || mutmut results } -Function Global:dobuild { python -m build } diff --git a/env.sh b/env.sh deleted file mode 100644 index e25f574..0000000 --- a/env.sh +++ /dev/null @@ -1,41 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-only -# Copyright 2022 Jookia - -activate() { . venv/bin/activate; } - -die() { - rm -r venv - echo "$1" -} - -setup() { - echo "No venv found, creating..." - if ! python3 -m venv venv ; then die "Unable to create venv"; return; fi - echo "Activating venv..." - activate - echo "Updating pip..." - if ! pip -q install -U pip ; then die "Unable to update pip"; return; fi - echo "Installing requirements..." - if ! pip -q install --use-pep517 -r requirements.txt ; then die "Unable to install requirements"; return; fi - touch venv/.stamp - echo "All done!" -} - -if test -e venv/.stamp; then activate; else setup; fi - -export PYTHONPATH="$PYTHONPATH:$PWD/src" - -unset -f activate die setup - -resetenv() { rm -r venv; . ./env.sh; } -dotidy() { black src tests; } -dolint() { flake8 src tests; } -dotest() { pytest -q -n auto -x -l --sw --hypothesis-profile=dev $@; } -dotest_dev() { pytest -vv -n 0 -x -l --sw --hypothesis-profile=dev $@; } -dotest_ci() { pytest -q -n auto --hypothesis-profile=ci; } -dotest_long() { pytest -q -n auto --hypothesis-profile=long; } -docheck() { dotidy && dolint && dotest; } -_envsh_domut() { mutmut run --paths-to-mutate "src/newlang/parse2,src/newlang/i18n.py" $@; } -domut() { _envsh_domut; } -domut_ci() { _envsh_domut --no-progress || (mutmut results; exit 1); } -dobuild() { python -m build; }