Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e2267d2

Browse files
committed
Update CI actions for new packaging
- remove old compile step - update python-action to v4 and "primary" python to 3.11 - produce sdist and wheel just once - ensure we're testing after installing from wheel, sdist, and source
1 parent bbb14b4 commit e2267d2

File tree

1 file changed

+45
-26
lines changed

1 file changed

+45
-26
lines changed

.github/workflows/ci.yml

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
- name: Checkout working copy
1717
uses: actions/checkout@v3
1818
- name: Set up Python
19-
uses: actions/setup-python@v3
19+
uses: actions/setup-python@v4
2020
with:
21-
python-version: "3.10"
21+
python-version: "3.11"
2222
- name: Install checkers
2323
run: |
2424
python -mpip install --upgrade pip
@@ -28,43 +28,51 @@ jobs:
2828
- name: black
2929
run: black --check --diff --color --quiet .
3030

31+
# REPLACE BY: job which python -mbuild, and uploads the sdist and wheel to artifacts
32+
# build is not binary so can just build the one using whatever python version
3133
compile:
32-
strategy:
33-
fail-fast: false
34-
matrix:
35-
python-version:
36-
- "3.8"
37-
- "3.9"
38-
- "3.10"
39-
- "3.11"
40-
- "3.12.0-alpha - 3.12"
41-
- "pypy-3.8"
42-
- "pypy-3.9"
43-
pyyaml-version: ["5.1.*", "5.4.*", "6.0.*", "6.*"]
4434
runs-on: ubuntu-latest
4535

4636
steps:
4737
- name: Checkout working copy
4838
uses: actions/checkout@v3
49-
- name: Set up Python ${{ matrix.python-version }}
50-
uses: actions/setup-python@v3
5139
with:
52-
python-version: ${{ matrix.python-version }}
40+
submodules: true
41+
- name: Set up Python
42+
uses: actions/setup-python@v4
43+
with:
44+
python-version: "3.11"
5345
- name: Install dependency
5446
run: |
5547
python -mpip install --upgrade pip
56-
python -mpip install pyyaml==${{ matrix.pyyaml-version }}
57-
- name: Build regexes.py
58-
run: python setup.py build_regexes -i
59-
- name: Check results
48+
python -mpip install build
49+
- name: Build sdist and wheel
6050
run: |
61-
# check that _regexes exists, and .eggs does not (== setuptools used our dependency)
62-
test -e src/ua_parser/_regexes.py -a ! -e .eggs
51+
python -mbuild
52+
- name: Upload sdist
53+
uses: actions/upload-artifact@v3
54+
with:
55+
name: sdist
56+
path: dist/*.tar.gz
57+
retention-days: 1
58+
59+
- name: Upload wheel
60+
uses: actions/upload-artifact@v3
61+
with:
62+
name: wheel
63+
path: dist/*.whl
64+
retention-days: 1
6365

6466
test:
67+
runs-on: ubuntu-latest
68+
needs: compile
6569
strategy:
6670
fail-fast: false
6771
matrix:
72+
source:
73+
- wheel
74+
- sdist
75+
- source
6876
python-version:
6977
- "3.8"
7078
- "3.9"
@@ -73,14 +81,18 @@ jobs:
7381
- "3.12.0-alpha - 3.12"
7482
- "pypy-3.8"
7583
- "pypy-3.9"
76-
runs-on: ubuntu-latest
84+
include:
85+
- source: sdist
86+
artifact: dist/*.tar.gz
87+
- source: wheel
88+
artifact: dist/*.whl
7789
steps:
7890
- name: Checkout working copy
7991
uses: actions/checkout@v3
8092
with:
8193
submodules: true
8294
- name: Set up Python ${{ matrix.python-version }}
83-
uses: actions/setup-python@v3
95+
uses: actions/setup-python@v4
8496
with:
8597
python-version: ${{ matrix.python-version }}
8698
- name: Install test dependencies
@@ -94,7 +106,14 @@ jobs:
94106
fi
95107
fi
96108
python -mpip install -r requirements_dev.txt
109+
- name: download ${{ matrix.source }} artifact
110+
if: matrix.artifact
111+
uses: actions/download-artifact@v3
112+
with:
113+
name: ${{ matrix.source }}
114+
path: dist/
97115
- name: install package in environment
98-
run: pip install .
116+
run: |
117+
pip install ${{ matrix.artifact || '.' }}
99118
- name: run tests
100119
run: pytest -v -Werror -Wignore::ImportWarning --doctest-glob="*.rst"

0 commit comments

Comments
 (0)