forked from OpenMS/streamlit-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request OpenMS#39 from axelwalter/main
Add CI
- Loading branch information
Showing
25 changed files
with
469 additions
and
249 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
|
||
build-full-app: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build the full Docker image | ||
run: docker build . --file Dockerfile --tag streamlitapp:latest | ||
|
||
build-simple-app: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build the Docker image (pyOpenMS only) | ||
run: docker build . --file Dockerfile_simple --tag streamlitapp-simple:latest |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Pylint | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pylint | ||
- name: Analysing the code with pylint | ||
run: | | ||
pylint $(git ls-files '*.py') --disable=C0103,C0114,C0301,C0411,W0212,W0631,W0602,W1514,W2402,E0401,E1101,F0001,R1732 --errors-only |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Test workflow functions | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install pytest | ||
- name: Running test cases | ||
run: | | ||
pytest test.py |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,65 @@ | ||
import streamlit as st | ||
from src.common import * | ||
from pathlib import Path | ||
""" | ||
Main page for the OpenMS Template App. | ||
This module sets up and displays the Streamlit app for the OpenMS Template App. | ||
It includes: | ||
- Setting the app title. | ||
- Displaying a description. | ||
- Providing a download button for the Windows version of the app. | ||
Usage: | ||
Run this script to launch the OpenMS Template App. | ||
Note: | ||
- If run in local mode, the CAPTCHA control is not applied. | ||
- If not in local mode, CAPTCHA control is applied to verify the user. | ||
Returns: | ||
None | ||
""" | ||
|
||
import sys | ||
|
||
from src.captcha_ import * | ||
from pathlib import Path | ||
import streamlit as st | ||
|
||
from src.captcha_ import captcha_control | ||
from src.common import page_setup, save_params | ||
|
||
params = page_setup(page="main") | ||
|
||
|
||
def main(): | ||
""" | ||
Display main page content. | ||
""" | ||
st.title("Template App") | ||
st.markdown("## A template for an OpenMS streamlit app.") | ||
if Path("OpenMS-App.zip").exists(): | ||
st.markdown("## Installation") | ||
with open("OpenMS-App.zip", "rb") as file: | ||
st.download_button( | ||
label="Download for Windows", | ||
data=file, | ||
file_name="OpenMS-App.zip", | ||
mime="archive/zip", | ||
type="primary" | ||
) | ||
label="Download for Windows", | ||
data=file, | ||
file_name="OpenMS-App.zip", | ||
mime="archive/zip", | ||
type="primary", | ||
) | ||
save_params(params) | ||
|
||
|
||
# Check if the script is run in local mode (e.g., "streamlit run app.py local") | ||
if "local" in sys.argv: | ||
# In local mode, run the main function without applying captcha | ||
main() | ||
|
||
# If not in local mode, assume it's hosted/online mode | ||
else: | ||
|
||
# WORK LIKE MULTIPAGE APP | ||
if 'controllo' not in st.session_state or st.session_state['controllo'] == False: | ||
|
||
if "controllo" not in st.session_state or st.session_state["controllo"] is False: | ||
# Apply captcha control to verify the user | ||
captcha_control() | ||
|
||
else: | ||
else: | ||
# Run the main function | ||
main() | ||
|
||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
from PyInstaller.utils.hooks import copy_metadata | ||
|
||
datas = [] | ||
datas += copy_metadata('streamlit') | ||
datas += copy_metadata('streamlit_plotly_events') | ||
datas += copy_metadata('pyopenms') | ||
datas += copy_metadata('captcha') | ||
datas += copy_metadata('pyarrow') | ||
datas += copy_metadata("streamlit") | ||
datas += copy_metadata("streamlit_plotly_events") | ||
datas += copy_metadata("pyopenms") | ||
datas += copy_metadata("captcha") | ||
datas += copy_metadata("pyarrow") |
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
Oops, something went wrong.