Skip to content

Commit 47eec05

Browse files
committed
CI scripts, again
1 parent 460346e commit 47eec05

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

.github/workflows/coverage.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ jobs:
2323
uses: actions/setup-python@v2
2424
with:
2525
python-version: ${{ matrix.python-version }}
26-
- name: Install tools
26+
- name: Install tools in CI virtualenv
2727
run: |
2828
python -m pip install --upgrade pip
2929
pip install flake8
3030
pip install pdm
31-
- name: Create virtualenv and install dependencies
31+
- name: Create in-project virtualenv and install dependencies
3232
run: |
3333
pdm python install ${{ matrix.python-version }}
3434
# "When you run pdm install the first time on a new PDM-managed project, whose Python interpreter is not decided yet,
3535
# PDM will create a virtualenv in <project_root>/.venv, and install dependencies into it."
36-
# --https://pdm-project.org/en/latest/usage/venv/
36+
# https://pdm-project.org/en/latest/usage/venv/
3737
pdm install
38-
- name: Install coverage tool in virtualenv
38+
- name: Install coverage tool in in-project virtualenv
3939
run: |
4040
pdm run python -m ensurepip
4141
pdm run python -m pip install coverage

.github/workflows/python-package.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: actions/setup-python@v2
2626
with:
2727
python-version: ${{ matrix.python-version }}
28-
- name: Install tools
28+
- name: Install tools in CI venv
2929
run: |
3030
python -m pip install --upgrade pip
3131
pip install flake8
@@ -36,12 +36,19 @@ jobs:
3636
flake8 . --config=flake8rc --count --select=E9,F63,F7,F82 --show-source --statistics
3737
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
3838
flake8 . --config=flake8rc --count --exit-zero --max-complexity=100 --max-line-length=127 --statistics
39-
- name: Create virtualenv and install dependencies
39+
- name: Determine Python version string for PDM
4040
run: |
41-
pdm python install ${{ matrix.python-version }}
41+
TARGET_PYTHON_VERSION_FOR_PDM=$( python -c 'import sys; v = sys.argv[1]; print(v if "-" not in v else v.replace("-", "@"))' ${{ matrix.python-version }} )
42+
# We need this hack at all because CI expects e.g. "pypy-3.10", whereas PDM expects "[email protected]".
43+
# Now that we have the result, send it to an environment variable so that the next step can use it.
44+
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable
45+
echo "TARGET_PYTHON_VERSION=$TARGET_PYTHON_VERSION_FOR_PDM" >> "$GITHUB_ENV"
46+
- name: Create in-project virtualenv and install dependencies
47+
run: |
48+
pdm python install "$TARGET_PYTHON_VERSION_FOR_PDM"
4249
# "When you run pdm install the first time on a new PDM-managed project, whose Python interpreter is not decided yet,
4350
# PDM will create a virtualenv in <project_root>/.venv, and install dependencies into it."
44-
# --https://pdm-project.org/en/latest/usage/venv/
51+
# https://pdm-project.org/en/latest/usage/venv/
4552
pdm install
4653
- name: Test with unpythonic.test.fixtures
4754
run: |

0 commit comments

Comments
 (0)