Skip to content

Commit efaa466

Browse files
committed
Trying to properly cache installed python
1 parent a8ff006 commit efaa466

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

.github/workflows/pre-commit_wsl.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
# python-version: [ "3.12" ]
1717
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
1818
distribution: [ "Ubuntu-22.04", "Ubuntu-24.04" ]
19+
max-parallel: 1
1920
name: Pre-commit WSL python ${{ matrix.python-version }} dist ${{ matrix.distribution }}
2021
steps:
2122
- name: Bootstrapping dist ${{ matrix.distribution }}
@@ -24,7 +25,6 @@ jobs:
2425
distribution: ${{ matrix.distribution }}
2526
use-cache: 'true'
2627
update: 'true'
27-
wsl-shell-command: bash --norc -euo pipefail
2828
additional-packages: |
2929
python3
3030
python3-pip
@@ -44,7 +44,17 @@ jobs:
4444
libffi-dev
4545
liblzma-dev
4646
python3-openssl
47+
- name: Cache pyenv in WSL
48+
id: cache-pyenv
49+
uses: actions/cache@v4
50+
with:
51+
path: |
52+
.pyenv
53+
.bash_profile
54+
.bashrc
55+
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.distribution }}
4756
- name: Install pyenv in WSL
57+
if: steps.cache-pyenv.outputs.cache-hit != 'true'
4858
shell: wsl-bash {0}
4959
run: |
5060
pwd
@@ -62,6 +72,7 @@ jobs:
6272
- name: Install python ${{matrix.python-version}} using pyenv in WSL
6373
shell: wsl-bash {0}
6474
run: |
75+
source ~/.bash_profile
6576
pyenv install ${{matrix.python-version}}
6677
pyenv global ${{matrix.python-version}}
6778
- name: Clone repo
@@ -73,6 +84,7 @@ jobs:
7384
- name: 'Install requirements (standard or constraints ${{ matrix.python-version }})'
7485
shell: wsl-bash {0}
7586
run: |
87+
source ~/.bash_profile
7688
cd the_repo
7789
python -mvenv .env
7890
source .env/bin/activate
@@ -100,6 +112,7 @@ jobs:
100112
- name: 'Install development requirements'
101113
shell: wsl-bash {0}
102114
run: |
115+
source ~/.bash_profile
103116
cd the_repo
104117
source .env/bin/activate
105118
@@ -112,13 +125,15 @@ jobs:
112125
- name: 'pre-commit'
113126
shell: wsl-bash {0}
114127
run: |
128+
source ~/.bash_profile
115129
cd the_repo
116130
source .env/bin/activate
117131
118132
pre-commit run -a
119133
- name: 'pytest + coverage (${{ matrix.python-version }})'
120134
shell: wsl-bash {0}
121135
run: |
136+
source ~/.bash_profile
122137
cd the_repo
123138
source .env/bin/activate
124139

0 commit comments

Comments
 (0)