5656 - uses : actions/checkout@v4
5757 with :
5858 fetch-depth : 0
59+ persist-credentials : false
5960
6061 - name : Install Conda Python ${{ matrix.cfg.python-version }} and power software
6162 if : matrix.cfg.label == 'conda'
@@ -144,11 +145,11 @@ jobs:
144145 julia -e 'ENV["PYTHON"]="/Users/runner/hostedtoolcache/Python/3.12.9/x64/bin/python"; using Pkg; Pkg.build("PyCall")'
145146
146147 - name : Special setup download delay
147- if : runner.os == 'macOS'
148- # file download in next section is flaky, esp. for Mac. use `sed -i "s;;;g"` for non-Mac
148+ if : false # runner.os == 'macOS'
149+ # file download in (basic) section is flaky for Mac. use `sed -i "s;;;g"` for non-Mac
149150 run : |
150- sed -E -i.bak "s;nb_retry=10;nb_retry=50 ;g" $(dirname $(which python))/../lib/python${{ matrix.cfg.python-version }}/site-packages/grid2op/MakeEnv/Make.py
151- sed -E -i.bak "s;time.sleep(1);time.sleep(3 );g" $(dirname $(which python))/../lib/python${{ matrix.cfg.python-version }}/site-packages/grid2op/MakeEnv/Make.py
151+ sed -E -i.bak "s;nb_retry=10;nb_retry=100 ;g" $(dirname $(which python))/../lib/python${{ matrix.cfg.python-version }}/site-packages/grid2op/MakeEnv/Make.py
152+ sed -E -i.bak "s;time.sleep(1);time.sleep(8 );g" $(dirname $(which python))/../lib/python${{ matrix.cfg.python-version }}/site-packages/grid2op/MakeEnv/Make.py
152153
153154 - name : Test PowerModels in PandaPower
154155 run : |
@@ -158,10 +159,115 @@ jobs:
158159 # loc is simply $CONDA_PREFIX but the setup-python counterpart env.pythonLocation seems broken
159160 # PdP testing above has a couple failures b/c Ipopt=1 unless downgrade (taking PM with it)
160161
161- - name : Test PandaModelsBackend
162- # if: false # for now since there's some issues
162+ - name : Test PandaModelsBackend (basic)
163+ if : runner.os == 'Linux'
163164 run : |
164- cd tests
165165 which python python-jl
166- python-jl test_basic_usage.py
167- # python test_backend_api.py
166+ python-jl tests/test_basic_usage.py
167+
168+ - name : Test PandaModelsBackend (API)
169+ run : |
170+ python-jl tests/test_backend_api.py
171+
172+ - name : Install pypa/build & build a binary wheel and a source tarball
173+ if : matrix.cfg.label == 'installer' && runner.os == 'Linux'
174+ run : |
175+ python -m pip install build --user
176+ python -m build
177+
178+ - name : Store the distribution packages
179+ if : matrix.cfg.label == 'installer' && runner.os != 'macOS'
180+ uses : actions/upload-artifact@v4
181+ with :
182+ name : python-package-distributions
183+ path : dist/
184+
185+ publish-to-pypi :
186+ name : >-
187+ Publish Python 🐍 distribution 📦 to PyPI
188+ if : startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
189+ needs :
190+ - build
191+ runs-on : ubuntu-latest
192+ environment :
193+ name : pypi
194+ url : https://pypi.org/p/pandamodelsbackend
195+ permissions :
196+ id-token : write # IMPORTANT: mandatory for trusted publishing
197+
198+ steps :
199+ - name : Download all the dists
200+ uses : actions/download-artifact@v4
201+ with :
202+ name : python-package-distributions
203+ path : dist/
204+ - name : Publish distribution 📦 to PyPI
205+ uses : pypa/gh-action-pypi-publish@release/v1
206+
207+ github-release :
208+ name : >-
209+ Sign the Python 🐍 distribution 📦 with Sigstore
210+ and upload them to GitHub Release
211+ needs :
212+ - publish-to-pypi
213+ runs-on : ubuntu-latest
214+
215+ permissions :
216+ contents : write # IMPORTANT: mandatory for making GitHub Releases
217+ id-token : write # IMPORTANT: mandatory for sigstore
218+
219+ steps :
220+ - name : Download all the dists
221+ uses : actions/download-artifact@v4
222+ with :
223+ name : python-package-distributions
224+ path : dist/
225+ - name : Sign the dists with Sigstore
226+ uses : sigstore/gh-action-sigstore-python@v3.0.0
227+ with :
228+ inputs : >-
229+ ./dist/*.tar.gz
230+ ./dist/*.whl
231+ - name : Create GitHub Release
232+ env :
233+ GITHUB_TOKEN : ${{ github.token }}
234+ run : >-
235+ gh release create
236+ "$GITHUB_REF_NAME"
237+ --repo "$GITHUB_REPOSITORY"
238+ --notes ""
239+ - name : Upload artifact signatures to GitHub Release
240+ env :
241+ GITHUB_TOKEN : ${{ github.token }}
242+ # Upload to GitHub Release using the `gh` CLI.
243+ # `dist/` contains the built packages, and the
244+ # sigstore-produced signatures and certificates.
245+ run : >-
246+ gh release upload
247+ "$GITHUB_REF_NAME" dist/**
248+ --repo "$GITHUB_REPOSITORY"
249+
250+ publish-to-testpypi :
251+ name : Publish Python 🐍 distribution 📦 to TestPyPI
252+ needs :
253+ - build
254+ runs-on : ubuntu-latest
255+
256+ environment :
257+ name : testpypi
258+ url : https://test.pypi.org/p/pandamodelsbackend
259+
260+ permissions :
261+ id-token : write # IMPORTANT: mandatory for trusted publishing
262+
263+ steps :
264+ - name : Download all the dists
265+ uses : actions/download-artifact@v4
266+ with :
267+ name : python-package-distributions
268+ path : dist/
269+ - name : Publish distribution 📦 to TestPyPI
270+ uses : pypa/gh-action-pypi-publish@release/v1
271+ with :
272+ repository-url : https://test.pypi.org/legacy/
273+ verbose : true
0 commit comments