@@ -17,15 +17,14 @@ jobs:
1717 - name : Checkout
1818 uses : actions/checkout@v3
1919
20- - name : Setup python
21- uses : actions/setup-python@v4
20+ - name : Install
21+ uses : ./.github/ actions/install_requirements
2222 with :
23- python-version : " 3.x"
23+ requirements_file : requirements-lint.txt
24+ install_options : -e .[dev]
2425
2526 - name : Lint
26- run : |
27- .github/workflows/pip_install.sh lint -e .[dev]
28- tox -e pre-commit,mypy
27+ run : tox -e pre-commit,mypy
2928
3029 - name : Upload lockfiles
3130 uses : actions/upload-artifact@v3
4039 matrix :
4140 os : ["ubuntu-latest"] # can add windows-latest, macos-latest
4241 python : ["3.8", "3.9", "3.10", "3.11"]
42+ install : ["-e .[dev]"]
43+ # Make one version be non-editable to test both paths of version code
44+ include :
45+ - os : " ubuntu-latest"
46+ python : " 3.8"
47+ install : " .[dev]"
4348
4449 runs-on : ${{ matrix.os }}
4550 env :
@@ -52,13 +57,12 @@ jobs:
5257 with :
5358 fetch-depth : 0
5459
55- - name : Setup python ${{ matrix.python }}
56- uses : actions/setup-python@v4
60+ - name : Install
61+ uses : ./.github/ actions/install_requirements
5762 with :
58- python-version : ${{ matrix.python }}
59-
60- - name : Install with latest dependencies
61- run : .github/workflows/pip_install.sh test-${{ matrix.python }}-${{ matrix.os }} .[dev]
63+ python_version : ${{ matrix.python }}
64+ requirements_file : requirements-test-${{ matrix.os }}-${{ matrix.python }}.txt
65+ install_options : ${{ matrix.install }}
6266
6367 - name : Run tests
6468 run : pytest tests
6973 name : ${{ matrix.python }}/${{ matrix.os }}
7074 files : cov.xml
7175
72- - name : Upload lockfiles
73- uses : actions/upload-artifact@v3
74- with :
75- name : lockfiles
76- path : lockfiles
77-
7876 dist :
7977 if : github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
8078 runs-on : " ubuntu-latest"
@@ -119,8 +117,8 @@ jobs:
119117 uses : actions/checkout@v3
120118
121119 # image names must be all lower case
122- - run : |
123- echo IMAGE_REPOSITORY=ghcr.io/$(tr '[:upper:]' '[:lower:]' <<< "${{ github.repository }}") >> $GITHUB_ENV
120+ - name : Generate image repo name
121+ run : echo IMAGE_REPOSITORY=ghcr.io/$(tr '[:upper:]' '[:lower:]' <<< "${{ github.repository }}") >> $GITHUB_ENV
124122
125123 # obtain the python wheel from the dist step
126124 - uses : actions/download-artifact@v3
@@ -157,11 +155,11 @@ jobs:
157155 cache-to : type=gha,mode=max
158156
159157 - name : Test cli works in runtime image
160- # check that the latest tag can run with --version parameter
161158 run : |
162159 docker run ${{ env.IMAGE_REPOSITORY }} --version
163160 mkdir -p lockfiles
164- docker run --entrypoint pip ${{ env.IMAGE_REPOSITORY }} freeze > lockfiles/requirements.txt
161+ docker run --entrypoint pip ${{ env.IMAGE_REPOSITORY }} freeze | \
162+ sed '/file:/s/^/# Requirements for /' > lockfiles/requirements.txt
165163
166164 - name : Upload lockfiles
167165 uses : actions/upload-artifact@v3
@@ -178,10 +176,6 @@ jobs:
178176 steps :
179177 - uses : actions/download-artifact@v3
180178
181- - name : fixup requirements files
182- # use sed to comment out the self references in requirements files
183- run : sed -i '/file:/s/^/# Requirements for /' lockfiles/requirements*.txt
184-
185179 - name : Github Release
186180 # We pin to the SHA, not the tag, for security reasons.
187181 # https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
0 commit comments