Skip to content

Commit db914d3

Browse files
committed
Fix the CI
Signed-off-by: Bernát Gábor <[email protected]>
1 parent 284af1f commit db914d3

File tree

2 files changed

+98
-115
lines changed

2 files changed

+98
-115
lines changed

.github/workflows/check.yaml

Lines changed: 85 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
name: check
1+
name: 🧪 check
22
on:
33
workflow_dispatch:
44
push:
55
branches: ["main"]
6-
tags-ignore: ["**"]
76
pull_request:
87
schedule:
98
- cron: "0 8 * * *"
@@ -14,7 +13,7 @@ concurrency:
1413

1514
jobs:
1615
test:
17-
name: test ${{ matrix.py }} - ${{ matrix.os }}
16+
name: 🧪 test ${{ matrix.py }} - ${{ matrix.os }}
1817
if: github.event_name != 'schedule' || github.repository_owner == 'pypa'
1918
runs-on: ${{ matrix.os }}
2019
timeout-minutes: 40
@@ -23,15 +22,15 @@ jobs:
2322
matrix:
2423
py:
2524
- "3.13t"
26-
- "3.13"
27-
- "3.12"
28-
- "3.11"
29-
- "3.10"
30-
- "3.9"
31-
- "3.8"
32-
- pypy-3.10
33-
- pypy-3.9
34-
- pypy-3.8
25+
# - "3.13"
26+
# - "3.12"
27+
# - "3.11"
28+
# - "3.10"
29+
# - "3.9"
30+
# - "3.8"
31+
# - pypy-3.10
32+
# - pypy-3.9
33+
# - pypy-3.8
3534
- graalpy-24.1
3635
os:
3736
- ubuntu-latest
@@ -48,119 +47,95 @@ jobs:
4847
- { os: windows-latest, py: "pypy-3.8" }
4948
steps:
5049
- uses: taiki-e/install-action@cargo-binstall
51-
- name: Install OS dependencies
52-
run: |
53-
set -x
54-
for i in 1 2 3; do
55-
echo "try $i" && \
56-
${{ runner.os == 'Linux' && 'sudo apt-get update -y && sudo apt-get install snapd fish csh -y' || true }} && \
57-
${{ runner.os == 'Linux' && 'cargo binstall -y nu' || true }} && \
58-
${{ runner.os == 'macOS' && 'brew install fish tcsh nushell' || true }} && \
59-
${{ runner.os == 'Windows' && 'choco install nushell' || true }} && \
60-
exit 0 || true;
61-
sleep 1
62-
done
63-
exit 1
64-
shell: bash
50+
# - name: 🛠️ Install OS dependencies
51+
# run: |
52+
# for i in 1 2 3; do
53+
# echo "try $i" && \
54+
# if [ "${{ runner.os }}" = "Linux" ]; then
55+
# sudo apt-get install -y software-properties-common
56+
# sudo apt-add-repository ppa:fish-shell/release-4 -y
57+
# sudo apt-get update -y
58+
# sudo apt-get install snapd fish csh -y
59+
# cargo binstall -y nu
60+
# elif [ "${{ runner.os }}" = "macOS" ]; then
61+
# brew install fish tcsh nushell || brew upgrade fish tcsh nushell
62+
# elif [ "${{ runner.os }}" = "Windows" ]; then
63+
# choco install nushell
64+
# fi && exit 0 || true
65+
# sleep 1
66+
# done
67+
# shell: bash
6568
- uses: actions/checkout@v4
6669
with:
6770
fetch-depth: 0
68-
- name: Install the latest version of uv
71+
- name: 🚀 Install the latest version of uv
6972
uses: astral-sh/setup-uv@v4
70-
with:
71-
enable-cache: true
72-
cache-dependency-glob: "pyproject.toml"
73-
github-token: ${{ secrets.GITHUB_TOKEN }}
74-
- name: Add .local/bin to PATH Windows
75-
if: runner.os == 'Windows'
76-
shell: bash
77-
run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH
78-
- name: Add .local/bin to PATH macos-13
79-
if: matrix.os == 'macos-13'
73+
- name: 📦 Install tox
8074
shell: bash
81-
run: echo ~/.local/bin >> $GITHUB_PATH
82-
- name: Install tox
83-
if: matrix.py == '3.13' || matrix.py == '3.13t'
84-
run: uv tool install --python-preference only-managed --python 3.12 tox --with tox-uv
85-
- name: Install tox
86-
if: "!(matrix.py == '3.13' || matrix.py == '3.13t')"
87-
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
88-
- name: Setup brew python for test ${{ matrix.py }}
89-
if: startsWith(matrix.py, 'brew@')
9075
run: |
91-
set -e
92-
PY=$(echo '${{ matrix.py }}' | cut -c 6-)
93-
brew cleanup && brew upgrade python@$PY || brew install python@$PY
94-
echo "/usr/local/opt/python@$PY/libexec/bin" >>"${GITHUB_PATH}"
76+
PYVER=$([[ "${{ matrix.py }}" == "3.13" || "${{ matrix.py }}" == "3.13t" ]] && echo 3.12 || echo 3.13)
77+
uv tool install --python-preference only-managed --python $PYVER tox --with tox-uv
78+
- name: 🐍 Setup Python for test ${{ matrix.py }}
79+
if: ${{ !startsWith(matrix.py, 'graalpy-') }}
9580
shell: bash
96-
- name: Setup python for test ${{ matrix.py }}
97-
if: "!(startsWith(matrix.py, 'brew@') || endsWith(matrix.py, 't'))"
81+
run: |
82+
if [[ "${{ matrix.py }}" == brew@* ]]; then
83+
PY=$(echo '${{ matrix.py }}' | cut -c 6-)
84+
brew install python@$PY || brew upgrade python@$PY
85+
echo "/usr/local/opt/python@$PY/libexec/bin" >>"${GITHUB_PATH}"
86+
else
87+
uv python install -v --preview "${{ matrix.py }}"
88+
fi
89+
- name: 🐍 Setup Graal Python for test ${{ matrix.py }}
90+
if: ${{ startsWith(matrix.py, 'graalpy-') }}
9891
uses: actions/setup-python@v5
9992
with:
10093
python-version: ${{ matrix.py }}
101-
allow-prereleases: true
102-
# quansight-labs to install free-threaded python until actions/setup-python supports it
103-
# https://github.com/actions/setup-python/issues/771
104-
- name: Setup python for test ${{ matrix.py }}
105-
if: endsWith(matrix.py, 't')
106-
uses: quansight-labs/[email protected]
107-
with:
108-
python-version: ${{ matrix.py }}
109-
- name: Pick environment to run
110-
if: matrix.py != '3.13t'
94+
- name: 🧬 Pick environment to run
95+
shell: bash
11196
run: python tasks/pick_tox_env.py ${{ matrix.py }}
112-
- name: Pick environment to run
113-
if: matrix.py == '3.13t' && runner.os != 'Windows'
114-
run: python tasks/pick_tox_env.py ${{ matrix.py }} $Python_ROOT_DIR/bin/python
115-
- name: Pick environment to run
116-
if: matrix.py == '3.13t' && runner.os == 'Windows'
117-
run: python tasks/pick_tox_env.py ${{ matrix.py }} $env:Python_ROOT_DIR\python.exe
118-
- name: Setup test suite
119-
run: tox run -vv --notest --skip-missing-interpreters false
120-
- name: Run test suite
97+
- name: 📋 Print PATH entries
98+
shell: bash
99+
run: |
100+
echo "$PATH" | tr ':' '\n'
101+
- name: 🏗️ Setup test suite
102+
run: tox run -vvvv --notest --skip-missing-interpreters false
103+
- name: 🏃 Run test suite
121104
run: tox run --skip-pkg-install
122105
timeout-minutes: 20
123106
env:
124107
PYTEST_ADDOPTS: "-vv --durations=20"
125108
CI_RUN: "yes"
126109
DIFF_AGAINST: HEAD
127110

128-
check:
129-
name: ${{ matrix.tox_env }} - ${{ matrix.os }}
130-
if: github.event_name != 'schedule' || github.repository_owner == 'pypa'
131-
runs-on: ${{ matrix.os }}
132-
strategy:
133-
fail-fast: false
134-
matrix:
135-
os:
136-
- ubuntu-latest
137-
- windows-latest
138-
tox_env:
139-
- dev
140-
- docs
141-
- readme
142-
- upgrade
143-
- zipapp
144-
exclude:
145-
- { os: windows-latest, tox_env: readme }
146-
- { os: windows-latest, tox_env: docs }
147-
steps:
148-
- uses: actions/checkout@v4
149-
with:
150-
fetch-depth: 0
151-
- name: Install the latest version of uv
152-
uses: astral-sh/setup-uv@v4
153-
with:
154-
enable-cache: true
155-
cache-dependency-glob: "pyproject.toml"
156-
github-token: ${{ secrets.GITHUB_TOKEN }}
157-
- name: Add .local/bin to Windows PATH
158-
if: runner.os == 'Windows'
159-
shell: bash
160-
run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH
161-
- name: Install tox
162-
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
163-
- name: Setup check suite
164-
run: tox r -vv --notest --skip-missing-interpreters false -e ${{ matrix.tox_env }}
165-
- name: Run check for ${{ matrix.tox_env }}
166-
run: tox r --skip-pkg-install -e ${{ matrix.tox_env }}
111+
# check:
112+
# name: 🔎 check ${{ matrix.tox_env }} - ${{ matrix.os }}
113+
# if: github.event_name != 'schedule' || github.repository_owner == 'pypa'
114+
# runs-on: ${{ matrix.os }}
115+
# strategy:
116+
# fail-fast: false
117+
# matrix:
118+
# os:
119+
# - ubuntu-latest
120+
# - windows-latest
121+
# tox_env:
122+
# - dev
123+
# - docs
124+
# - readme
125+
# - upgrade
126+
# - zipapp
127+
# exclude:
128+
# - { os: windows-latest, tox_env: readme }
129+
# - { os: windows-latest, tox_env: docs }
130+
# steps:
131+
# - uses: actions/checkout@v4
132+
# with:
133+
# fetch-depth: 0
134+
# - name: 🚀 Install the latest version of uv
135+
# uses: astral-sh/setup-uv@v4
136+
# - name: 📦 Install tox
137+
# run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
138+
# - name: 🏗️ Setup check suite
139+
# run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.tox_env }}
140+
# - name: 🏃 Run check for ${{ matrix.tox_env }}
141+
# run: tox run --skip-pkg-install -e ${{ matrix.tox_env }}

tasks/pick_tox_env.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@
55
from pathlib import Path
66

77
py = sys.argv[1]
8+
env_lines = []
9+
810
if py.startswith("brew@"):
9-
py = py[len("brew@") :]
11+
brew_version = py[len("brew@") :]
12+
env_lines.append(f"TOX_DISCOVER=/opt/homebrew/bin/python{brew_version}")
13+
py = brew_version
14+
1015
if py.startswith("graalpy-"):
1116
py = "graalpy"
12-
env = f"TOXENV={py}"
13-
if len(sys.argv) > 2: # noqa: PLR2004
14-
env += f"\nTOX_BASEPYTHON={sys.argv[2]}"
15-
with Path(os.environ["GITHUB_ENV"]).open("ta", encoding="utf-8") as file_handler:
17+
18+
env_lines.append(f"TOXENV={py}")
19+
env = "\n".join(env_lines) + "\n"
20+
21+
with Path(os.environ["GITHUB_ENV"]).open("a", encoding="utf-8") as file_handler:
1622
file_handler.write(env)
23+
24+
print(f"Written to GITHUB_ENV:\n{env}")

0 commit comments

Comments
 (0)