diff --git a/.github/workflows/build-windows-executable-app-with-pyinstaller.yaml b/.github/workflows/build-windows-executable-app-with-pyinstaller.yaml index 6b31993c8..42646e822 100644 --- a/.github/workflows/build-windows-executable-app-with-pyinstaller.yaml +++ b/.github/workflows/build-windows-executable-app-with-pyinstaller.yaml @@ -1,14 +1,15 @@ name: Build executable for Windows with pyinstaller on: workflow_dispatch: +env: + OPENMS_VERSION: 3.2.0 + # Define needed TOPP tools here + TOPP_TOOLS: "FeatureFinderMetabo MetaboliteAdductDecharger SiriusExport" jobs: build-openms: runs-on: windows-latest - env: - OPENMS_VERSION: 3.0.0 - steps: - name: Checkout uses: actions/checkout@v3 @@ -130,6 +131,17 @@ jobs: CCACHE_COMPRESSLEVEL: 12 CCACHE_MAXSIZE: 400M + - 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: Test Windows shell: bash run: $LAUNCHER ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/citest.cmake @@ -139,17 +151,11 @@ jobs: CI_PROVIDER: "GitHub-Actions" BUILD_NAME: "${{ env.RUN_NAME }}-Win64-class-topp-${{ github.run_number }}" - - name: Upload TOPP tools as artifact - uses: actions/upload-artifact@v3 + - name: Upload package as artifact + uses: actions/upload-artifact@v4 with: - name: OpenMS-bin - path: OpenMS/bld/bin - - - name: Upload share as artifact - uses: actions/upload-artifact@v3 - with: - name: OpenMS-share - path: OpenMS/share + name: openms-package + path: ${{ github.workspace }}/OpenMS/bld/*.zip build-executable: runs-on: windows-latest @@ -162,17 +168,18 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Download TOPP tools as artifact - uses: actions/download-artifact@v3 + - name: Download package as artifact + uses: actions/download-artifact@v4 with: - name: OpenMS-bin - path: openms-bin + name: openms-package + path: openms-package - - name: Download share as artifact - uses: actions/download-artifact@v3 - with: - name: OpenMS-share - path: share + - 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 uses: actions/setup-python@v4 @@ -213,17 +220,34 @@ jobs: call myenv\Scripts\activate.bat pyinstaller --onefile --additional-hooks-dir ./hooks run_app.py --clean + - 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: Copy everything to dist directory run: | - cp -r .streamlit dist/.streamlit - cp -r content dist/content - cp -r src dist/src - cp -r assets dist/assets - cp -r example-data dist/example-data - cp -r openms-bin dist/bin - cp -r share dist/share - cp app.py dist/ + mkdir streamlit_exe + + mv python-${{ env.PYTHON_VERSION }} streamlit_exe + mv run_app.bat streamlit_exe + cp -r src streamlit_exe + cp -r content streamlit_exe + cp -r docs streamlit_exe + cp -r assets streamlit_exe + cp -r example-data streamlit_exe + cp openms-bin/*.dll streamlit_exe + cp -r .streamlit streamlit_exe + cp -r share streamlit_exe/share + cp app.py streamlit_exe + cp settings.json streamlit_exe + cp default-parameters.json streamlit_exe + + $files = $env:TOPP_TOOLS -split ' ' + foreach ($file in $files) { + Copy-Item "openms-bin/${file}.exe" -Destination "streamlit_exe/${file}.exe" + } - name: Modify .spec file shell: bash @@ -236,15 +260,10 @@ jobs: call myenv\Scripts\activate.bat pyinstaller run_app.spec --clean - - name: Delete OpenMS bin artifact - uses: geekyeggo/delete-artifact@v2 - with: - name: OpenMS-bin - - - name: Delete OpenMS share artifact - uses: geekyeggo/delete-artifact@v2 + - name: Delete OpenMS package artifact + uses: geekyeggo/delete-artifact@v5 with: - name: OpenMS-share + name: openms-package - name: Upload artifact uses: actions/upload-artifact@v3 diff --git a/.github/workflows/build-windows-executable-app.yaml b/.github/workflows/build-windows-executable-app.yaml index 62503a7ad..da8e75fa8 100644 --- a/.github/workflows/build-windows-executable-app.yaml +++ b/.github/workflows/build-windows-executable-app.yaml @@ -5,14 +5,15 @@ on: pull_request: branches: [ "main" ] workflow_dispatch: +env: + OPENMS_VERSION: 3.2.0 + # Define needed TOPP tools here + TOPP_TOOLS: "FeatureFinderMetabo FeatureLinkerUnlabeledKD SiriusExport" jobs: build-openms: runs-on: windows-latest - env: - OPENMS_VERSION: 3.0.0 - steps: - name: Checkout uses: actions/checkout@v4 @@ -112,7 +113,7 @@ jobs: ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/cibuild.cmake env: #OS_PREFIX_PATH: "${{ env.Qt5_DIR }}/lib/cmake;${{ env.Qt5_DIR }}" - CONTRIB_BUILD_DIRECTORY: "${{ github.workspace }}/OpenMS/contrib" + OPENMS_CONTRIB_LIBS: "${{ github.workspace }}/OpenMS/contrib" CI_PROVIDER: "GitHub-Actions" CMAKE_GENERATOR: "Ninja" SOURCE_DIRECTORY: "${{ github.workspace }}/OpenMS" @@ -120,7 +121,7 @@ jobs: ENABLE_STYLE_TESTING: "OFF" ENABLE_TOPP_TESTING: "ON" ENABLE_CLASS_TESTING: "ON" - WITH_GUI: "ON" + WITH_GUI: "OFF" ADDRESS_SANITIZER: "Off" BUILD_TYPE: "Release" OPENMP: "Off" @@ -136,24 +137,28 @@ jobs: - name: Test Windows shell: bash - run: $LAUNCHER ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/citest.cmake + run: ctest --output-on-failure -V -S $GITHUB_WORKSPACE/OpenMS/tools/ci/citest.cmake env: - LAUNCHER: "" SOURCE_DIRECTORY: "${{ github.workspace }}/OpenMS" CI_PROVIDER: "GitHub-Actions" BUILD_NAME: "${{ env.RUN_NAME }}-Win64-class-topp-${{ github.run_number }}" - - name: Upload TOPP tools as artifact - uses: actions/upload-artifact@v4 - with: - name: OpenMS-bin - path: OpenMS/bld/bin + - 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 share as artifact + - name: Upload package as artifact uses: actions/upload-artifact@v4 with: - name: OpenMS-share - path: OpenMS/share + name: openms-package + path: ${{ github.workspace }}/OpenMS/bld/*.zip build-executable: runs-on: windows-latest @@ -166,17 +171,18 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Download TOPP tools as artifact + - name: Download package as artifact uses: actions/download-artifact@v4 with: - name: OpenMS-bin - path: openms-bin + name: openms-package + path: openms-package - - name: Download share as artifact - uses: actions/download-artifact@v4 - with: - name: OpenMS-share - path: share + - 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: Setup python embeddable version run: | @@ -202,30 +208,40 @@ jobs: run: | echo '@echo off' > run_app.bat echo '.\\python-${{ env.PYTHON_VERSION }}\\python -m streamlit run app.py local' >> run_app.bat - + + - 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 All-in-one executable folder run: | mkdir streamlit_exe + mv python-${{ env.PYTHON_VERSION }} streamlit_exe mv run_app.bat streamlit_exe cp -r src streamlit_exe cp -r content streamlit_exe + cp -r docs streamlit_exe cp -r assets streamlit_exe cp -r example-data streamlit_exe + cp openms-bin/*.dll streamlit_exe cp -r .streamlit streamlit_exe - cp -r openms-bin streamlit_exe/bin cp -r share streamlit_exe/share cp app.py streamlit_exe + cp settings.json streamlit_exe + cp default-parameters.json streamlit_exe - - name: Delete OpenMS bin artifact - uses: geekyeggo/delete-artifact@v5 - with: - name: OpenMS-bin + $files = $env:TOPP_TOOLS -split ' ' + foreach ($file in $files) { + Copy-Item "openms-bin/${file}.exe" -Destination "streamlit_exe/${file}.exe" + } - - name: Delete OpenMS share artifact + - name: Delete OpenMS bin artifact uses: geekyeggo/delete-artifact@v5 with: - name: OpenMS-share + name: openms-package - name: Compress streamlit_exe folder to OpenMS-App.zip run: | diff --git a/app.py b/app.py index 907c581c4..2f863cde1 100644 --- a/app.py +++ b/app.py @@ -1,5 +1,7 @@ import streamlit as st from pathlib import Path +# For some reason the windows version only works if this is imported here +import pyopenms if __name__ == '__main__': pages = { diff --git a/src/common/captcha_.py b/src/common/captcha_.py index 5788d08e9..b8dfaa685 100644 --- a/src/common/captcha_.py +++ b/src/common/captcha_.py @@ -10,9 +10,6 @@ import os -consent_component = st_components.declare_component("gdpr_consent", path=Path("gdpr_consent")) - - def delete_all_pages(main_script_path_str: str) -> None: """ Delete all pages except the main page from an app's configuration. @@ -203,6 +200,7 @@ def captcha_control(): ga = st.session_state.settings['analytics']['google-analytics']['enabled'] pp = st.session_state.settings['analytics']['piwik-pro']['enabled'] if (ga or pp) and (st.session_state.tracking_consent is None): + consent_component = st_components.declare_component("gdpr_consent", path=Path("gdpr_consent")) with st.spinner(): # Ask for consent st.session_state.tracking_consent = consent_component(