Build executable without Wix #9
This file contains hidden or 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: Build executable without Wix | |
| on: | |
| #push: | |
| # branches: | |
| # - main | |
| # - development | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| env: | |
| OPENMS_VERSION: 3.5.0 | |
| PYTHON_VERSION: 3.10.0 | |
| # Define needed TOPP tools here | |
| TOPP_TOOLS: "OpenNuXL FileConverter PercolatorAdapter" | |
| jobs: | |
| build-openms: | |
| runs-on: windows-2022 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: OpenMS/OpenMS | |
| ref: release/${{ env.OPENMS_VERSION }} | |
| path: 'OpenMS' | |
| - name: Install Qt (Windows) | |
| uses: jurplel/install-qt-action@v4 | |
| with: | |
| version: '6.8.3' ## Note this version is build with win64_msvc2022_64 and should always match what we use | |
| arch: 'win64_msvc2022_64' | |
| cache: 'false' | |
| archives: 'qtsvg qtimageformats qtbase' | |
| # https://github.com/marketplace/actions/visual-studio-shell | |
| - name: Set up Visual Studio shell | |
| uses: egor-tensin/vs-shell@v2 | |
| with: | |
| arch: x64 | |
| - name: Setup build tools | |
| shell: bash | |
| run: | | |
| choco install ccache ninja -y --no-progress | |
| choco install cmake --version=3.31.1 -y --no-progress --force | |
| ## GH CLI "SHOULD BE" installed. Sometimes I had to manually install nonetheless. Super weird. | |
| # https://github.com/actions/runner-images/blob/main/images/win/scripts/Installers/Install-GitHub-CLI.ps1 | |
| echo "C:/Program Files (x86)/GitHub CLI" >> $GITHUB_PATH | |
| - name: Extract branch/PR infos | |
| shell: bash | |
| run: | | |
| cd OpenMS | |
| RUN_NAME_LOCAL=$(echo ${GITHUB_REF#refs/heads/} | tr / -) | |
| echo "RUN_NAME=${RUN_NAME_LOCAL}" >> $GITHUB_ENV | |
| echo "BASE_REF=$(gh pr view --json baseRefName -q .baseRefName || echo ${RUN_NAME_LOCAL})" >> $GITHUB_ENV | |
| id: extract_branch | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache contrib | |
| id: cache-contrib-win | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ github.workspace }}/OpenMS/contrib | |
| key: ${{ runner.os }}-contrib3 | |
| - name: Load contrib build | |
| if: steps.cache-contrib-win.outputs.cache-hit != 'true' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| cd OpenMS/contrib | |
| # Download the file using the URL fetched from GitHub | |
| gh release download -R OpenMS/contrib --pattern 'contrib_build-Windows.tar.gz' | |
| # Extract the archive | |
| 7z x -so contrib_build-Windows.tar.gz | 7z x -si -ttar | |
| rm contrib_build-Windows.tar.gz | |
| ls | |
| - name: Add contrib to PATH | |
| shell: bash | |
| run: | | |
| # Add contrib library path for runtime DLL resolution | |
| echo "${{ github.workspace }}/OpenMS/contrib/lib" >> $GITHUB_PATH | |
| - name: Setup ccache cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: .ccache | |
| key: ${{ runner.os }}-ccache-${{ env.RUN_NAME }}-${{ github.run_number }} | |
| # Restoring: From current branch, otherwise from base branch, otherwise from any branch. | |
| restore-keys: | | |
| ${{ runner.os }}-ccache-${{ env.RUN_NAME }} | |
| ${{ runner.os }}-ccache-${{ env.BASE_REF }} | |
| ${{ runner.os }}-ccache- | |
| - name: Add THIRDPARTY | |
| shell: bash | |
| run: | | |
| # initialize THIRDPARTY | |
| cd OpenMS | |
| git submodule update --init THIRDPARTY | |
| cd .. | |
| # add third-party binaries to PATH | |
| # use flat THIRDPARTY structure | |
| mkdir -p _thirdparty | |
| cp -R OpenMS/THIRDPARTY/Windows/x86_64/* _thirdparty/ | |
| cp -R OpenMS/THIRDPARTY/All/* _thirdparty/ | |
| # add third-party binaries to PATH | |
| for thirdpartytool in ${{ github.workspace }}/_thirdparty/* | |
| do | |
| echo $thirdpartytool >> $GITHUB_PATH | |
| done | |
| - name: Build Windows | |
| shell: bash | |
| run: | | |
| mkdir $GITHUB_WORKSPACE/OpenMS/bld/ | |
| bash OpenMS/tools/ci/capture-env.sh -v $GITHUB_WORKSPACE/OpenMS/bld/CMakeCache.txt | |
| ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/cibuild.cmake | |
| env: | |
| OPENMS_CONTRIB_LIBS: "${{ github.workspace }}/OpenMS/contrib" | |
| CI_PROVIDER: "GitHub-Actions" | |
| CMAKE_GENERATOR: "Ninja" | |
| SOURCE_DIRECTORY: "${{ github.workspace }}/OpenMS" | |
| BUILD_NAME: "${{ env.RUN_NAME }}-Win64-class-topp-${{ github.run_number }}" | |
| ENABLE_STYLE_TESTING: "OFF" | |
| ENABLE_TOPP_TESTING: "ON" | |
| ENABLE_CLASS_TESTING: "ON" | |
| WITH_GUI: "OFF" | |
| WITH_PARQUET: "OFF" | |
| ADDRESS_SANITIZER: "Off" | |
| BUILD_TYPE: "Release" | |
| OPENMP: "Off" | |
| USE_STATIC_BOOST: "On" | |
| # BUILD_FLAGS: "-p:CL_MPCount=2" # For VS Generator and MSBuild | |
| BUILD_FLAGS: "-j2" # Ninja will otherwise use all cores (doesn't go well in GHA) | |
| CMAKE_CCACHE_EXE: "ccache" | |
| CCACHE_BASEDIR: ${{ github.workspace }} | |
| CCACHE_DIR: ${{ github.workspace }}/.ccache | |
| CCACHE_COMPRESS: true | |
| CCACHE_COMPRESSLEVEL: 12 | |
| CCACHE_MAXSIZE: 400M | |
| - name: Test Windows | |
| shell: bash | |
| run: ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/citest.cmake | |
| env: | |
| SOURCE_DIRECTORY: "${{ github.workspace }}/OpenMS" | |
| CI_PROVIDER: "GitHub-Actions" | |
| BUILD_NAME: "${{ env.RUN_NAME }}-Win64-class-topp-${{ github.run_number }}" | |
| - name: Package | |
| shell: bash | |
| run: | | |
| ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/cipackage.cmake | |
| env: | |
| SOURCE_DIRECTORY: "${{ github.workspace }}/OpenMS" | |
| PACKAGE_TYPE: zip | |
| SEARCH_ENGINES_DIRECTORY: "${{ github.workspace }}/_thirdparty" | |
| CI_PROVIDER: "GitHub-Actions" | |
| CPACK_PACKAGE_FILE_NAME: "openms-package" | |
| - name: Upload package as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: openms-package | |
| path: | | |
| ${{ github.workspace }}/OpenMS/bld/*.zip | |
| #${{ github.workspace }}/OpenMS/bld/bin/* | |
| #${{ github.workspace }}/_thirdparty/* | |
| #${{ github.workspace }}/OpenMS/bld/bin/OpenNuXL.exe | |
| #${{ github.workspace }}/OpenMS/bld/bin/FileConverter.exe | |
| #${{ github.workspace }}/OpenMS/bld/bin/PercolatorAdapter.exe | |
| #${{ github.workspace }}/OpenMS/bld/bin/*.dll | |
| #${{ github.workspace }}/_thirdparty/*.exe | |
| #${{ github.workspace }}/_thirdparty/ThermoRawFileParser/** | |
| #${{ github.workspace }}/_thirdparty/Percolator/** | |
| build-executable: | |
| runs-on: windows-2022 | |
| needs: build-openms | |
| env: | |
| PYTHON_VERSION: 3.10.0 | |
| APP_NAME: OpenMS-NuXLApp | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download package as artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: openms-package | |
| path: openms-package | |
| - name: Extract bin and share from package | |
| run: | | |
| cd openms-package | |
| unzip "*.zip" -d . | |
| cp -r openms-package/bin ../openms-bin | |
| cp -r openms-package/share ../share | |
| - name: Set up Python (regular distribution) | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} # Use the same version as the embeddable version | |
| - name: Setup python embeddable version | |
| run: | | |
| # Create a directory for the embeddable Python version | |
| mkdir python-${{ env.PYTHON_VERSION }} | |
| # Download and unzip the embeddable Python version | |
| curl -O https://www.python.org/ftp/python/${{ env.PYTHON_VERSION }}/python-${{ env.PYTHON_VERSION }}-embed-amd64.zip | |
| unzip python-${{ env.PYTHON_VERSION }}-embed-amd64.zip -d python-${{ env.PYTHON_VERSION }} | |
| rm python-${{ env.PYTHON_VERSION }}-embed-amd64.zip | |
| # Define paths for the regular Python distribution and the embeddable distribution | |
| $PYTHON_DIR="${{ runner.tool_cache }}/Python/${{ env.PYTHON_VERSION }}/x64" # Path from actions/setup-python | |
| $EMBED_DIR="python-${{ env.PYTHON_VERSION }}" | |
| mkdir -p $EMBED_DIR/Lib/site-packages/tkinter | |
| mkdir -p $EMBED_DIR/tcl | |
| # Copy necessary Tkinter files from the regular Python distribution | |
| cp -r $PYTHON_DIR/Lib/tkinter/* $EMBED_DIR/Lib/site-packages/tkinter/ | |
| cp -r $PYTHON_DIR/tcl/* $EMBED_DIR/tcl/ | |
| cp $PYTHON_DIR/DLLs/_tkinter.pyd $EMBED_DIR/ | |
| cp $PYTHON_DIR/DLLs/tcl86t.dll $EMBED_DIR/ | |
| cp $PYTHON_DIR/DLLs/tk86t.dll $EMBED_DIR/ | |
| - name: Install pip | |
| run: | | |
| curl -O https://bootstrap.pypa.io/get-pip.py | |
| ./python-${{ env.PYTHON_VERSION }}/python get-pip.py --no-warn-script-location | |
| rm get-pip.py | |
| - name: Uncomment 'import site' in python310._pth file | |
| run: | | |
| sed -i 's/#import site/import site/' python-${{ env.PYTHON_VERSION }}/python310._pth | |
| - name: Install Required Packages | |
| run: .\python-${{ env.PYTHON_VERSION }}\python -m pip install --force-reinstall -r requirements_embd_py310_win.txt --no-warn-script-location | |
| - name: Set to offline deployment | |
| run: | | |
| $content = Get-Content -Raw settings.json | ConvertFrom-Json | |
| $content.online_deployment = $false | |
| $content | ConvertTo-Json -Depth 100 | Set-Content settings.json | |
| - name: Create .bat file | |
| run: | | |
| echo " start /min .\python-${{ env.PYTHON_VERSION }}\python -m streamlit run app.py local" > ${{ env.APP_NAME }}.bat | |
| - name: Create All-in-one executable folder | |
| run: | | |
| if (Test-Path -Path "streamlit_exe") { | |
| Remove-Item -Recurse -Force "streamlit_exe" | |
| } | |
| mkdir streamlit_exe | |
| mv python-${{ env.PYTHON_VERSION }} streamlit_exe | |
| cp -r src streamlit_exe | |
| cp -r content streamlit_exe | |
| cp -r assets streamlit_exe | |
| cp -r example-data streamlit_exe | |
| cp -r .streamlit streamlit_exe | |
| cp app.py streamlit_exe | |
| cp settings.json streamlit_exe | |
| cp ${{ env.APP_NAME }}.bat streamlit_exe | |
| cp openms-bin/*.dll streamlit_exe | |
| cp -r share streamlit_exe/share | |
| $files = $env:TOPP_TOOLS -split ' ' | |
| foreach ($file in $files) { | |
| Copy-Item "openms-bin/${file}.exe" -Destination "streamlit_exe/${file}.exe" | |
| } | |
| - name: Generate Readme.txt | |
| shell: bash | |
| run: | | |
| cat <<EOF > streamlit_exe/Readme.txt | |
| Welcome to ${{ env.APP_NAME }} app! | |
| To launch the application: | |
| 1. Navigate to the installation directory. | |
| 2. Double-click on the file: ${{ env.APP_NAME }}.bat or ${{ env.APP_NAME }} shortcut. | |
| Additional Information: | |
| - If multiple Streamlit apps are running, you can change the port in the .streamlit/config.toml file. | |
| Example: | |
| [server] | |
| port = 8502 | |
| Reach out to us: | |
| - Join our Discord server for support and community discussions: https://discord.com/invite/4TAGhqJ7s5 | |
| - Contribute or stay updated with the latest OpenMS web app developments on GitHub: https://github.com/OpenMS/streamlit-template | |
| - Checkout the ${{ env.APP_NAME }} on Github: https://github.com/Arslan-Siraj/nuxl-app | |
| - Visit our website for more information: https://openms.de/ | |
| Thanks for using ${{ env.APP_NAME }}! | |
| EOF | |
| - name: Archive build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: OpenMS_NuXLApp_without_Wix | |
| path: | | |
| streamlit_exe |