@@ -19,38 +19,36 @@ jobs:
1919 lint :
2020 runs-on : " ubuntu-latest"
2121 steps :
22- - name : Run black, flake8, mypy
23- uses : dls-controls/pipenv-run-action@v1
24- with :
25- pipenv-run : lint
22+ - name : Checkout
23+ uses : actions/checkout@v2
24+
25+ - name : Lint
26+ run : |
27+ pip install --user .[dev]
28+ tox -e pre-commit,mypy
2629
2730 wheel :
2831 strategy :
2932 fail-fast : false
3033 matrix :
3134 os : ["ubuntu-latest"]
32- python : ["3.7 "]
35+ python : ["3.8 "]
3336
3437 runs-on : ${{ matrix.os }}
3538 steps :
3639 - uses : actions/checkout@v2
37- with :
38- fetch-depth : 0
3940
4041 - name : Create Sdist and Wheel
4142 # Set SOURCE_DATE_EPOCH from git commit for reproducible build
4243 # https://reproducible-builds.org/
43- # Set group writable and umask to do the same to match inside DLS
4444 run : |
45- chmod -R g+w .
46- umask 0002
4745 SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) pipx run build --sdist --wheel
4846
4947 - name : Upload Wheel and Sdist as artifacts
5048 uses : actions/upload-artifact@v2
5149 with :
5250 name : dist
53- path : dist/*
51+ path : dist
5452
5553 - name : Install minimum python version
5654 uses : actions/setup-python@v2
@@ -67,35 +65,68 @@ jobs:
6765 fail-fast : false
6866 matrix :
6967 os : ["ubuntu-latest"] # can add windows-latest, macos-latest
70- python : ["3.7 ", "3.8 ", "3.9 "]
71- pipenv : ["skip-lock" ]
68+ python : ["3.8 ", "3.9 ", "3.10 "]
69+ lock : [false ]
7270
7371 include :
74- # Add an extra Python3.7 runner to use the lockfile
72+ # Add an extra Python3.10 runner to use the lockfile
7573 - os : " ubuntu-latest"
76- python : " 3.7 "
77- pipenv : " deploy "
74+ python : " 3.10 "
75+ lock : true
7876
7977 runs-on : ${{ matrix.os }}
8078 env :
8179 # https://github.com/pytest-dev/pytest/issues/2042
8280 PY_IGNORE_IMPORTMISMATCH : " 1"
81+ # enable QT tests with no X Display
82+ QT_QPA_PLATFORM : " offscreen"
8383
8484 steps :
85- - name : Setup repo and test
86- uses : dls-controls/pipenv-run-action@v1
85+ - name : Checkout
86+ uses : actions/checkout@v2
87+ with :
88+ fetch-depth : 0
89+
90+ - name : Setup python ${{ matrix.python }}
91+ uses : actions/setup-python@v2
8792 with :
8893 python-version : ${{ matrix.python }}
89- pipenv-install : --dev --${{ matrix.pipenv }}
90- allow-editable-installs : ${{ matrix.pipenv == 'deploy' }}
91- pipenv-run : tests
94+
95+ - name : Install with locked dependencies
96+ if : matrix.lock
97+ run : |
98+ touch requirements.txt requirements_dev.txt
99+ pip install -r requirements.txt -e .
100+ pip freeze --exclude-editable > requirements.txt
101+ pip install -r requirements_dev.txt -e .[dev]
102+ pip freeze --exclude-editable > requirements_dev.txt
103+
104+ - name : Install with latest dependencies
105+ if : ${{ ! matrix.lock }}
106+ run : pip install -e .[dev]
107+
108+ - name : Run tests
109+ run : pytest tests
110+
111+ - name : Create requirements_dev.txt
112+ run : |
113+ pip freeze --exclude-editable > requirements_dev.txt
92114
93115 - name : Upload coverage to Codecov
94116 uses : codecov/codecov-action@v2
95117 with :
96- name : ${{ matrix.python }}/${{ matrix.os }}/${{ matrix.pipenv }}
118+ name : ${{ matrix.python }}/${{ matrix.os }}/${{ matrix.lock }}
97119 files : cov.xml
98120
121+ - name : Upload build files
122+ if : matrix.lock
123+ uses : actions/upload-artifact@v2
124+ with :
125+ name : buildfiles
126+ path : |
127+ requirements.txt
128+ requirements_dev.txt
129+
99130 release :
100131 needs : [lint, wheel, test]
101132 runs-on : ubuntu-latest
@@ -104,15 +135,16 @@ jobs:
104135 steps :
105136 - uses : actions/download-artifact@v2
106137 with :
107- name : dist
108- path : dist
138+ path : artifacts
109139
110140 - name : Github Release
111141 # We pin to the SHA, not the tag, for security reasons.
112142 # https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
113143 uses : softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 # v0.1.14
114144 with :
115- files : dist/*
145+ files : |
146+ artifacts/dist/*
147+ artifacts/buildfiles/*
116148 generate_release_notes : true
117149 env :
118150 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -121,4 +153,62 @@ jobs:
121153 env :
122154 TWINE_USERNAME : __token__
123155 TWINE_PASSWORD : ${{ secrets.pypi_token }}
124- run : pipx run twine upload dist/*
156+ run : pipx run twine upload artifacts/dist/*
157+
158+ make-container :
159+ needs : [lint, wheel, test]
160+ runs-on : ubuntu-latest
161+ permissions :
162+ contents : read
163+ packages : write
164+
165+ steps :
166+ - name : Checkout
167+ uses : actions/checkout@v2
168+
169+ - uses : actions/download-artifact@v2
170+ with :
171+ name : dist
172+ path : dist
173+
174+ - name : Cache Docker layers
175+ uses : actions/cache@v2
176+ with :
177+ path : /tmp/.buildx-cache
178+ key : ${{ runner.os }}-buildx-${{ github.sha }}
179+ restore-keys : |
180+ ${{ runner.os }}-buildx-
181+
182+ - name : Log in to GitHub Docker Registry
183+ if : github.event_name != 'pull_request'
184+ uses : docker/login-action@v1
185+ with :
186+ registry : ghcr.io
187+ username : ${{ github.actor }}
188+ password : ${{ secrets.GITHUB_TOKEN }}
189+
190+ - name : Docker meta
191+ id : meta
192+ uses : docker/metadata-action@v4
193+ with :
194+ images : ghcr.io/${{ github.repository }}
195+ tags : |
196+ type=ref,event=branch
197+ type=ref,event=tag
198+ type=raw,value=latest
199+
200+ - name : Set up Docker Buildx
201+ id : buildx
202+ uses : docker/setup-buildx-action@v1
203+
204+ - name : Build runtime image
205+ uses : docker/build-push-action@v2
206+ with :
207+ file : .devcontainer/Dockerfile
208+ context : .
209+ push : ${{ github.event_name != 'pull_request' }}
210+ build-args : BASE=python:3.10-slim
211+ tags : ${{ steps.meta.outputs.tags }}
212+ labels : ${{ steps.meta.outputs.labels }}
213+ cache-from : type=local,src=/tmp/.buildx-cache
214+ cache-to : type=local,dest=/tmp/.buildx-cache
0 commit comments