windows-wheels #148
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: windows-wheels | |
on: | |
push: # run on push events | |
paths-ignore: # but ignore everything in the docs subfolder | |
- 'docs/**' | |
- 'src/gui*/**' | |
- 'src/netedit/**' | |
- 'tests/netedit/**' | |
branches: | |
- '**' | |
tags: | |
- '*' | |
pull_request: # run on pull requests | |
paths-ignore: # but ignore everything in the docs subfolder | |
- 'docs/**' | |
workflow_dispatch: | |
schedule: | |
- cron: '5 1 * * *' | |
jobs: | |
build-wheels: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type: [libsumo] | |
python_version: [3.7, 3.8, 3.9, '3.10', 3.11, 3.12] | |
include: | |
- build_type: sumo | |
python_version: 3.8 | |
env: | |
CC: cl | |
CXX: cl | |
SUMO_LIBRARIES: D:\a\sumo\sumo\sumolibraries | |
TMPDIR: D:\a\sumo\sumo\tmp | |
steps: | |
- name: Cloning SUMO | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetching SUMO tags | |
run: git fetch --tags --force | |
- name: Cloning SUMO Libraries | |
uses: actions/checkout@v4 | |
with: | |
repository: DLR-TS/SUMOLibraries | |
path: sumolibraries | |
- name: Configuring Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
architecture: x64 | |
- name: "Set up compiler cache" | |
uses: actions/cache@v4 | |
with: | |
path: C:\Users\runneradmin\AppData\Local\Mozilla\sccache\cache | |
key: ${{ matrix.build_type }}-${{ matrix.python_version }}-${{ github.head_ref }}-${{ github.run_number }} | |
restore-keys: | | |
${{ matrix.build_type }}-${{ matrix.python_version }}-${{ github.head_ref }}- | |
${{ matrix.build_type }}-${{ matrix.python_version }}- | |
# required for CMake to find Ninja | |
- name: "Set up MSVC Developer Command Prompt" | |
# uses: seanmiddleditch/gha-setup-vsdevenv@v4 # disabled until it gets an update for node.js | |
uses: compnerd/gha-setup-vsdevenv@main | |
- name: Installing Python build environment | |
run: | | |
python -m pip install wheel build | |
mkdir tmp | |
- name: Building libsumo plain | |
if: matrix.build_type == 'libsumo' | |
run: | | |
cmake -Bbuild_msvc -GNinja -DCHECK_OPTIONAL_LIBS=false | |
cmake --build build_msvc --config Release --target libsumo libtraci | |
xcopy /s data .\tools\libsumo\data\ | |
python tools\build_config\version.py tools\build_config\setup-libsumo.py tools\setup.py | |
python -m build --wheel tools -o dist --config-setting=--plat-name=win_amd64 | |
- name: Uploading artifacts | |
if: matrix.build_type == 'libsumo' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libsumo-python-${{ matrix.python_version }}-wheels | |
path: dist | |
- name: Building SUMO Wheels | |
if: matrix.build_type == 'sumo' | |
run: | | |
python tools\build_config\version.py tools\build_config\setup-sumolib.py tools\setup.py | |
python -m build --wheel tools -o dist | |
python tools\build_config\version.py tools\build_config\setup-traci.py tools\setup.py | |
python -m build --wheel tools -o dist | |
copy build_config\pyproject.toml . | |
python tools\build_config\version.py tools\build_config\setup-sumo.py .\setup.py | |
python -m build --wheel --config-setting=--plat-name=win_amd64 --config-setting=-G=Ninja | |
python -c "import glob, os; f = glob.glob(\`"dist/eclipse_sumo-*\`")[0]; os.rename(f, f.replace(\`"cp38-cp38\`", \`"py2.py3-none\`"))" | |
- name: Uploading artifacts | |
if: matrix.build_type == 'sumo' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sumo-python-wheels | |
path: dist | |
- name: Plain libsumo tests | |
if: matrix.build_type == 'libsumo' | |
run: | | |
$env:PATH += ";$pwd\bin" | |
$env:TEXTTEST_TMP = "D:/texttest" | |
cd build_msvc | |
$env:TEXTTEST_CI_APPS = "-a complex.libsumo.ci" | |
ctest -R texttest --verbose | |
copy Testing/Temporary/LastTest.log D:/texttest | |
################### | |
# testing wheels | |
################### | |
test-wheels: | |
needs: [build-wheels] | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python_version: [3.7, 3.8, 3.9, '3.10', 3.11, 3.12] | |
env: | |
TEXTTEST_TMP: 'D:/texttest' | |
steps: | |
- name: Cloning SUMO | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetching SUMO tags | |
run: git fetch --tags --force | |
- name: Downloading Wheels artifact | |
uses: actions/download-artifact@v4 | |
- name: Configuring Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Preparing Python environment | |
run: | | |
python -m pip install texttest | |
python -m pip install (Get-ChildItem -Filter sumo-python-wheels/eclipse_sumo*).FullName | |
python -c "import sumo; print('SUMO_HOME=' + sumo.SUMO_HOME)" >> $env:GITHUB_ENV | |
- name: Running "sumo in the wheel" tests | |
if: github.repository == 'DLR-TS/sumo' | |
run: | | |
python -m pip install -r tools/req_ci.txt | |
python -m pip install -r tools/requirements.txt | |
$env:TEXTTEST_CI_APPS = "-v ci.fast -a activitygen,dfrouter,duarouter,jtrrouter,marouter,netgen,od2trips,polyconvert,netconvert,sumo" | |
tests\runCiTests.bat $env:pythonLocation\Scripts\texttestc.py | |
# $env:TEXTTEST_CI_APPS = "-v ci.fast -a complex,tools" | |
# tests\runCiTests.bat $env:pythonLocation\Scripts\texttestc.py | |
- name: Running meta tests and cleaning up | |
run: | | |
$env:TEXTTEST_CI_APPS = "-ts meta" | |
tests\runCiTests.bat $env:pythonLocation\Scripts\texttestc.py | |
python -m pip uninstall -y eclipse-sumo | |
- name: Installing libsumo | |
run: | | |
python -m pip install (Get-ChildItem -Filter sumo-python-wheels/sumolib-*).FullName (Get-ChildItem -Filter sumo-python-wheels/traci-*).FullName | |
python -m pip install --user (Get-ChildItem -Filter libsumo-python-${{ matrix.python_version }}-wheels/libsumo-*).FullName | |
# - name: Running libsumo tests | |
# run: | | |
# $env:TEXTTEST_CI_APPS = "-a complex.libsumo" | |
# tests\runCiTests.bat $env:pythonLocation\Scripts\texttestc.py | |
- name: Compressing test results | |
if: failure() | |
run: Compress-Archive -Path $env:TEXTTEST_TMP -DestinationPath D:/tt.zip | |
- name: Uploading test results | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: texttesttmp-${{ matrix.python_version }} | |
path: D:/tt.zip | |
if-no-files-found: warn | |
################### | |
# publishing wheels | |
################### | |
publish-wheels: | |
if: github.repository == 'eclipse-sumo/sumo' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags')) | |
needs: [test-wheels] | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
# this step removes the sumolib and traci packages which linux takes care of | |
- name: Moving artifacts | |
run: | | |
ls -lR | |
mkdir dist | |
mv ./*-wheels/* dist | |
rm -f dist/sumolib* dist/traci* | |
- name: Publish to Test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
skip-existing: true | |
- name: Publish to PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 |