Skip to content

Commit 5724eb6

Browse files
committed
Allow installation of mise from tox workflow
1 parent 22b8f1f commit 5724eb6

File tree

3 files changed

+37
-9
lines changed

3 files changed

+37
-9
lines changed

.github/workflows/test.yml

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
other_names: |
2222
docs
2323
lint
24+
py-mise-macos:tox -e py:runner=macos-latest;mise=true
25+
py-mise-ubuntu:tox -e py:runner=ubuntu-24.04;mise=true
2426
node-version-file: .tool-versions
2527

2628
check: # This job does nothing and is only used for the branch protection

.github/workflows/tox.yml

+34-9
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ jobs:
124124
key: pre-commit-${{ matrix.name }}-${{ hashFiles('.pre-commit-config.yaml') }}
125125

126126
- name: Set up Python ${{ matrix.python_version || '3.12' }}
127-
if: ${{ !contains(matrix.shell, 'wsl') }}
127+
if: ${{ !contains(matrix.shell, 'wsl') && matrix.mise != 'true' }}
128128
uses: actions/setup-python@v5
129129
with:
130130
cache: ${{ hashFiles('requirements.txt', 'pyproject.toml') && 'pip' || '' }}
@@ -144,18 +144,43 @@ jobs:
144144
run: |
145145
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
146146
147+
- name: Install mise
148+
if: ${{ matrix.mise == 'true' }}
149+
run: |
150+
set -exuo pipefail
151+
type mise >/dev/null || {
152+
curl -s https://mise.run | MISE_QUIET=1 sh
153+
echo "$HOME/.local/share/mise/bin" >> $GITHUB_PATH
154+
echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH
155+
}
156+
mise install
157+
158+
- name: Ensure mise python3 is used by default
159+
if: ${{ matrix.mise == 'true' }}
160+
run: |
161+
set -exuo pipefail
162+
if [[ "$(which python3)" != */mise/* ]]; then
163+
echo "python3 is not the mise python3"
164+
exit 1
165+
fi
166+
147167
- name: Install python build tools
148168
run: |
149169
set -exuo pipefail
150-
echo $PATH
151-
python3 -m pip install --upgrade pip uv
152-
# uv tool update-shell
153-
uv tool install "tox>=4.23.2" --with "tox-uv>=1.16.0"
170+
echo PATH=$PATH
171+
# that depends on python3 blend being used and might not be already in path:
172+
SCRIPTS_DIR=$(python3 -c 'import os,sysconfig;print(sysconfig.get_path("scripts",f"{os.name}_user"))')
173+
if [[ ":$PATH:" != *":$SCRIPTS_DIR:"* ]]; then
174+
export PATH=$SCRIPTS_DIR:$PATH
175+
echo "$SCRIPTS_DIR" >> $GITHUB_PATH
176+
echo "Added $SCRIPTS_DIR to PATH to avoid further issues."
177+
fi
178+
python3 -m pip install --disable-pip-version-check --upgrade --user --break-system-packages pip uv 'tox>=4.23.2' 'tox-uv>=1.16.0'
179+
which -a uv pip tox
180+
echo "uv tool update-shell"
154181
tox --version
155-
which -a uv
156-
157-
- name: Log installed dists
158-
run: python3 -m uv pip freeze
182+
echo "Log installed dists"
183+
python3 -m uv pip freeze
159184
160185
- run: ${{ matrix.command }}
161186

.tool-versions

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
nodejs 20.18.0
2+
python 3.13.0

0 commit comments

Comments
 (0)