forked from python-poetry/poetry
-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (115 loc) · 4.2 KB
/
.tests-matrix.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Reusable workflow consumed by tests.yaml; used to share a single matrix across jobs.
on:
workflow_call:
inputs:
runner:
required: true
type: string
python-version:
required: true
type: string
run-mypy:
required: true
type: boolean
run-pytest:
required: true
type: boolean
run-pytest-export:
required: true
type: boolean
defaults:
run:
shell: bash
env:
PYTHONWARNDEFAULTENCODING: 'true'
jobs:
mypy:
name: mypy
runs-on: ${{ inputs.runner }}
if: inputs.run-mypy
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: ./.github/actions/bootstrap-poetry
id: bootstrap-poetry
with:
python-version: ${{ inputs.python-version }}
- uses: ./.github/actions/poetry-install
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: .mypy_cache
key: mypy-${{ runner.os }}-py${{ steps.bootstrap-poetry.outputs.python-version }}-${{ hashFiles('pyproject.toml', 'poetry.lock') }}
restore-keys: |
mypy-${{ runner.os }}-py${{ steps.bootstrap-poetry.outputs.python-version }}-
mypy-${{ runner.os }}-
- run: poetry run mypy
pytest:
name: pytest
runs-on: ${{ inputs.runner }}
if: inputs.run-pytest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- uses: ./.github/actions/bootstrap-poetry
with:
python-version: ${{ inputs.python-version }}
- uses: ./.github/actions/poetry-install
with:
args: --with github-actions
- run: poetry run pytest --integration -v
env:
POETRY_TEST_INTEGRATION_GIT_USERNAME: ${{ github.actor }}
POETRY_TEST_INTEGRATION_GIT_PASSWORD: ${{ github.token }}
- run: git diff --exit-code --stat HEAD
pytest-export:
name: pytest (poetry-plugin-export)
runs-on: ${{ inputs.runner }}
if: inputs.run-pytest-export
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
path: poetry
- uses: ./poetry/.github/actions/bootstrap-poetry
with:
python-version: ${{ inputs.python-version }}
- name: Get poetry-plugin-export version
run: |
PLUGIN_VERSION=$(curl -s https://pypi.org/pypi/poetry-plugin-export/json | jq -r ".info.version")
echo "Found version ${PLUGIN_VERSION}"
echo version=${PLUGIN_VERSION} >> $GITHUB_OUTPUT
id: poetry-plugin-export-version
- name: Check out poetry-plugin-export
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
path: poetry-plugin-export
repository: python-poetry/poetry-plugin-export
ref: refs/tags/${{ steps.poetry-plugin-export-version.outputs.version }}
- name: Use local poetry
working-directory: poetry-plugin-export
# Replace the python version to avoid conflicts
# if the plugin still supports a wider range than Poetry itself.
run: |
perl -pi -e 's/^python =.*$/python = "~'"${PYTHON_VERSION}"'"/' pyproject.toml
poetry add --lock --group dev ../poetry
env:
PYTHON_VERSION: ${{ inputs.python-version }}
# This step can be removed after having released a poetry-plugin-export version
# that has cffi>=1.17.0 in its lock file.
- name: Force more recent cffi (workaround for Python 3.13)
working-directory: poetry-plugin-export
run: poetry update --lock cffi
- name: Install
working-directory: poetry-plugin-export
run: poetry install
- name: Run tests
working-directory: poetry-plugin-export
run: poetry run pytest -v
- name: Check for clean working tree
working-directory: poetry-plugin-export
run: |
git checkout -- pyproject.toml poetry.lock
git diff --exit-code --stat HEAD