Skip to content

Commit

Permalink
Allow installation of mise from tox workflow (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Dec 17, 2024
1 parent 22b8f1f commit 7fe2858
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ jobs:
uses: ./.github/workflows/tox.yml
with:
default_python: "3.10"
jobs_producing_coverage: 6
jobs_producing_coverage: 8
max_python: "3.13"
min_python: "3.10"
run_post: echo 'Running post'
run_pre: echo 'Running pre'
other_names: |
docs
lint
py-mise-macos:tox -e py:runner=macos-latest;mise=true
py-mise-ubuntu:tox -e py:runner=ubuntu-24.04;mise=true
node-version-file: .tool-versions

check: # This job does nothing and is only used for the branch protection
Expand Down
43 changes: 34 additions & 9 deletions .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
key: pre-commit-${{ matrix.name }}-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Set up Python ${{ matrix.python_version || '3.12' }}
if: ${{ !contains(matrix.shell, 'wsl') }}
if: ${{ !contains(matrix.shell, 'wsl') && matrix.mise != 'true' }}
uses: actions/setup-python@v5
with:
cache: ${{ hashFiles('requirements.txt', 'pyproject.toml') && 'pip' || '' }}
Expand All @@ -144,18 +144,43 @@ jobs:
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Install mise
if: ${{ matrix.mise == 'true' }}
run: |
set -exuo pipefail
type mise >/dev/null || {
curl -s https://mise.run | MISE_QUIET=1 sh
echo "$HOME/.local/share/mise/bin" >> $GITHUB_PATH
echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH
}
mise install
- name: Ensure mise python3 is used by default
if: ${{ matrix.mise == 'true' }}
run: |
set -exuo pipefail
if [[ "$(which python3)" != */mise/* ]]; then
echo "python3 is not the mise python3"
exit 1
fi
- name: Install python build tools
run: |
set -exuo pipefail
echo $PATH
python3 -m pip install --upgrade pip uv
# uv tool update-shell
uv tool install "tox>=4.23.2" --with "tox-uv>=1.16.0"
echo PATH=$PATH
# that depends on python3 blend being used and might not be already in path:
SCRIPTS_DIR=$(python3 -c 'import os,sysconfig;print(sysconfig.get_path("scripts",f"{os.name}_user"))')
if [[ ":$PATH:" != *":$SCRIPTS_DIR:"* ]]; then
export PATH=$SCRIPTS_DIR:$PATH
echo "$SCRIPTS_DIR" >> $GITHUB_PATH
echo "Added $SCRIPTS_DIR to PATH to avoid further issues."
fi
python3 -m pip install --disable-pip-version-check --upgrade --user --break-system-packages pip uv 'tox>=4.23.2' 'tox-uv>=1.16.0'
which -a uv pip tox
echo "uv tool update-shell"
tox --version
which -a uv
- name: Log installed dists
run: python3 -m uv pip freeze
echo "Log installed dists"
python3 -m uv pip freeze
- run: ${{ matrix.command }}

Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ mkdocs:
build:
os: ubuntu-24.04
tools:
python: "3.12"
python: "3.13"
commands:
- pip install --user tox
- python3 -m pip install --user tox
- python3 -m tox -e docs
python:
install:
Expand Down
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
nodejs 20.18.0
python 3.13.0

0 comments on commit 7fe2858

Please sign in to comment.