Skip to content

Commit

Permalink
Bump version to 1.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakski authored Nov 21, 2024
1 parent abee619 commit 3e063bb
Show file tree
Hide file tree
Showing 14 changed files with 235 additions and 1,350 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- test
paths-ignore:
- README.md
- LICENSE
Expand All @@ -12,16 +13,16 @@ on:

jobs:
linux:
name: Linux, Python ${{ matrix.python-version }}, Sphinx ${{ matrix.sphinx-version }}
name: Linux, Python ${{ matrix.python }}, environment ${{ matrix.env }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.9'
sphinx-version:
- '3'
- '4'
- '5'
python: ["3.10", "3.11"]
env: ["1", "2", "3", "4", "5"]
exclude:
# ModuleNotFoundError: No module named 'tomli'
- python: "3.10"
env: "5"
steps:
- name: Cache dependencies
uses: actions/cache@v2
Expand All @@ -36,9 +37,9 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.python }}

- name: Run tests
run: ./ci.sh test "sphinx${SPHINX_VERSION}"
run: ./ci.sh test "$ENV_NUMBER"
env:
SPHINX_VERSION: ${{ matrix.sphinx-version }}
ENV_NUMBER: ${{ matrix.env }}
12 changes: 12 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# [1.1.3] - 2024-11-21
### Added
- Tests for Sphinx 7 and 8

### Fixed
- Missing compose_all in ruamel.yaml 0.18

### Removed
- Tests for Sphinx 3. `ImportError: cannot import name 'Union' from 'types'`
for Python above 3.9. Version constraint is left for compatibility, but support
for Sphinx 3 will be dropped in future versions.

# [1.1.2] - 2024-11-13
### Changed
- Support for ruamel.yaml 0.18.x
Expand Down
89 changes: 30 additions & 59 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,6 @@ on_error() {
exit "$exit_code"
}

restore_lockfile() {
if [ -e poetry.lock.save ]; then
echo "Restoring original poetry.lock file..."
mv poetry.lock.save poetry.lock
fi
}

restore_pyproject() {
if [ -e pyproject.toml.save ]; then
echo "Restoring original pyproject.toml file..."
mv pyproject.toml.save pyproject.toml
fi
}

on_exit() {
restore_lockfile
restore_pyproject
}

ensure_poetry() {
if which poetry >/dev/null; then
return 0
fi
echo "Ensuring Poetry is installed..."
mkdir -p "${HOME}/.local/lib"
declare poetry_venv_path
poetry_venv_path="${HOME}/.local/lib/poetry_venv"
if [ ! -e "$poetry_venv_path" ]; then
python3 -m venv --upgrade-deps "$poetry_venv_path"
fi
if [ ! -e "${poetry_venv_path}/bin/poetry" ]; then
"${poetry_venv_path}/bin/pip" install "poetry==1.3.2"
fi
mkdir -p "${HOME}/.local/bin"
ln -sf "${poetry_venv_path}/bin/poetry" "${HOME}/.local/bin/poetry"
}

print_help() {
cat << EOF
Handle continuous integration tasks.
Expand All @@ -59,39 +22,47 @@ Subcommands:
EOF
}

# Poetry doesn't implement `--constraint` flag like pip. Yet we want to ensure
# that tests run always with the same dependency versions.
# shellcheck disable=SC2034
update_requirements_cmd() {
cp pyproject.toml pyproject.toml.save
cp poetry.lock poetry.lock.save
declare sphinx_version
for sphinx_version in 3 4 5; do
poetry add --lock "Sphinx@^${sphinx_version}"
poetry export --with dev --output "requirements-sphinx${sphinx_version}.txt"
cp poetry.lock.save poetry.lock
declare selected=${1:-} i
declare -a env1 env2 env3 env4
# Some contrib extensions don't specify required Sphinx version in dependencies, yet fail on setup
env1=(
"Sphinx>=4,<5"
"sphinxcontrib-applehelp<=1.0.5"
"sphinxcontrib-devhelp<=1.0.2"
"sphinxcontrib-htmlhelp<=2.0.1"
"sphinxcontrib-serializinghtml<=1.1.5"
"sphinxcontrib-qthelp<=1.0.3"
)
env2=("Sphinx>=5,<6")
# ruamel.yaml deprecated compose_all in 0.18
env3=("Sphinx>=5,<6" "ruamel.yaml>=0.17,<0.18")
env4=("Sphinx>=6,<7")
env5=("Sphinx>=7,<8")
for i in {1..5}; do
if [ -n "$selected" ] && [ "$i" != "$selected" ]; then
continue
fi
declare -n constraints="env${i}"
python3 -m venv --clear venv
./venv/bin/pip install ".[test]" "${constraints[@]}"
./venv/bin/pip freeze --exclude "sphinxcontrib-autoyaml" >"tests/requirements-${i}.txt"
if [ "$selected" = "$i" ]; then
break
fi
done
rm poetry.lock.save
mv pyproject.toml.save pyproject.toml
}

test_cmd() {
declare requirements=$1
declare wheel_file
for wheel_file in ./dist/*.whl; do
rm "$wheel_file"
done
poetry install --verbose
poetry build --format wheel
declare env=$1
python3 -m venv --clear venv
./venv/bin/pip install --no-deps -r "requirements-${requirements}.txt"
./venv/bin/pip install --no-deps ./dist/*.whl
./venv/bin/pip install --no-deps -r "tests/requirements-${env}.txt" .
./venv/bin/python -m tests -v
}

main() {
trap 'on_error ${BASH_SOURCE[0]}:${LINENO}' ERR
trap on_exit EXIT
ensure_poetry

declare subcommand
subcommand=$1
Expand Down
Loading

0 comments on commit 3e063bb

Please sign in to comment.