Skip to content

Commit

Permalink
Merge pull request OpenMS#68 from t0mdavid-m/install_all_dependencies
Browse files Browse the repository at this point in the history
Install all dependencies
  • Loading branch information
Arslan-Siraj authored Nov 21, 2024
2 parents 11ac8ce + a7ba5dd commit 4827271
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 72 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
78 changes: 47 additions & 31 deletions .github/workflows/build-windows-executable-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -112,15 +113,15 @@ 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"
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: "ON"
WITH_GUI: "OFF"
ADDRESS_SANITIZER: "Off"
BUILD_TYPE: "Release"
OPENMP: "Off"
Expand All @@ -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
Expand All @@ -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: |
Expand All @@ -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: |
Expand Down
2 changes: 2 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
4 changes: 1 addition & 3 deletions src/common/captcha_.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 4827271

Please sign in to comment.