Compare commits
No commits in common. "main" and "0.7.10" have entirely different histories.
@ -1,53 +0,0 @@
|
|||||||
name: pyzebra CI/CD pipeline
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
env:
|
|
||||||
CONDA: /opt/miniforge3
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
prepare:
|
|
||||||
runs-on: pyzebra
|
|
||||||
steps:
|
|
||||||
- run: $CONDA/bin/conda config --add channels conda-forge
|
|
||||||
- run: $CONDA/bin/conda config --set solver libmamba
|
|
||||||
|
|
||||||
test-env:
|
|
||||||
runs-on: pyzebra
|
|
||||||
needs: prepare
|
|
||||||
if: github.ref == 'refs/heads/main'
|
|
||||||
env:
|
|
||||||
BUILD_DIR: ${{ runner.temp }}/conda_build
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- run: $CONDA/bin/conda build --no-anaconda-upload --output-folder $BUILD_DIR ./conda-recipe
|
|
||||||
- run: $CONDA/bin/conda remove --name test --all --keep-env -y
|
|
||||||
- run: $CONDA/bin/conda install --name test --channel $BUILD_DIR python=3.8 pyzebra -y
|
|
||||||
- run: sudo systemctl restart pyzebra-test.service
|
|
||||||
|
|
||||||
prod-env:
|
|
||||||
runs-on: pyzebra
|
|
||||||
needs: prepare
|
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
env:
|
|
||||||
BUILD_DIR: ${{ runner.temp }}/conda_build
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- run: $CONDA/bin/conda build --token ${{ secrets.ANACONDA_TOKEN }} --output-folder $BUILD_DIR ./conda-recipe
|
|
||||||
- run: $CONDA/bin/conda remove --name prod --all --keep-env -y
|
|
||||||
- run: $CONDA/bin/conda install --name prod --channel $BUILD_DIR python=3.8 pyzebra -y
|
|
||||||
- run: sudo systemctl restart pyzebra-prod.service
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
runs-on: pyzebra
|
|
||||||
needs: [test-env, prod-env]
|
|
||||||
if: always()
|
|
||||||
steps:
|
|
||||||
- run: $CONDA/bin/conda build purge-all
|
|
58
.gitlab-ci.yml
Normal file
58
.gitlab-ci.yml
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- deploy
|
||||||
|
- publish
|
||||||
|
- cleanup
|
||||||
|
|
||||||
|
workflow:
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
variables:
|
||||||
|
BUILD_PATH: /home/pyzebra/build-prod
|
||||||
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||||
|
variables:
|
||||||
|
BUILD_PATH: /home/pyzebra/build-test
|
||||||
|
|
||||||
|
default:
|
||||||
|
before_script:
|
||||||
|
- source /opt/miniconda3/etc/profile.d/conda.sh
|
||||||
|
|
||||||
|
build-job:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- conda config --add channels conda-forge
|
||||||
|
- conda config --set solver libmamba
|
||||||
|
- conda build --no-anaconda-upload --output-folder $BUILD_PATH ./conda-recipe
|
||||||
|
|
||||||
|
deploy-test-job:
|
||||||
|
stage: deploy
|
||||||
|
environment: testing
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||||
|
script:
|
||||||
|
- conda activate test
|
||||||
|
- conda install --channel $BUILD_PATH --force-reinstall pyzebra -y
|
||||||
|
- sudo systemctl restart pyzebra-test.service
|
||||||
|
|
||||||
|
deploy-prod-job:
|
||||||
|
stage: deploy
|
||||||
|
environment: production
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
script:
|
||||||
|
- conda activate prod
|
||||||
|
- conda install --channel $BUILD_PATH pyzebra -y
|
||||||
|
- sudo systemctl restart pyzebra-prod.service
|
||||||
|
|
||||||
|
publish-job:
|
||||||
|
stage: publish
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
script:
|
||||||
|
- conda activate base
|
||||||
|
- anaconda --token $ANACONDA_TOKEN upload $(conda build --output-folder $BUILD_PATH ./conda-recipe --output)
|
||||||
|
|
||||||
|
cleanup-job:
|
||||||
|
stage: cleanup
|
||||||
|
script:
|
||||||
|
- conda build purge-all
|
@ -7,19 +7,18 @@ import subprocess
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
default_branch = "main"
|
|
||||||
branch = subprocess.check_output("git rev-parse --abbrev-ref HEAD", shell=True).decode().strip()
|
branch = subprocess.check_output("git rev-parse --abbrev-ref HEAD", shell=True).decode().strip()
|
||||||
if branch != default_branch:
|
if branch != "main":
|
||||||
print(f"Aborting, not on '{default_branch}' branch.")
|
print("Aborting, not on 'main' branch.")
|
||||||
return
|
return
|
||||||
|
|
||||||
version_filepath = os.path.join(os.path.basename(os.path.dirname(__file__)), "__init__.py")
|
filepath = "pyzebra/__init__.py"
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("level", type=str, choices=["patch", "minor", "major"])
|
parser.add_argument("level", type=str, choices=["patch", "minor", "major"])
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
with open(version_filepath) as f:
|
with open(filepath) as f:
|
||||||
file_content = f.read()
|
file_content = f.read()
|
||||||
|
|
||||||
version = re.search(r'__version__ = "(.*?)"', file_content).group(1)
|
version = re.search(r'__version__ = "(.*?)"', file_content).group(1)
|
||||||
@ -37,12 +36,11 @@ def main():
|
|||||||
|
|
||||||
new_version = f"{major}.{minor}.{patch}"
|
new_version = f"{major}.{minor}.{patch}"
|
||||||
|
|
||||||
with open(version_filepath, "w") as f:
|
with open(filepath, "w") as f:
|
||||||
f.write(re.sub(r'__version__ = "(.*?)"', f'__version__ = "{new_version}"', file_content))
|
f.write(re.sub(r'__version__ = "(.*?)"', f'__version__ = "{new_version}"', file_content))
|
||||||
|
|
||||||
os.system(f"git commit {version_filepath} -m 'Updating for version {new_version}'")
|
os.system(f"git commit {filepath} -m 'Updating for version {new_version}'")
|
||||||
os.system(f"git tag -a {new_version} -m 'Release {new_version}'")
|
os.system(f"git tag -a {new_version} -m 'Release {new_version}'")
|
||||||
os.system("git push --follow-tags")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -6,4 +6,4 @@ from pyzebra.sxtal_refgen import *
|
|||||||
from pyzebra.utils import *
|
from pyzebra.utils import *
|
||||||
from pyzebra.xtal import *
|
from pyzebra.xtal import *
|
||||||
|
|
||||||
__version__ = "0.7.11"
|
__version__ = "0.7.10"
|
||||||
|
@ -364,7 +364,7 @@ def create():
|
|||||||
_update_proj_plots()
|
_update_proj_plots()
|
||||||
|
|
||||||
proj_auto_checkbox = CheckboxGroup(
|
proj_auto_checkbox = CheckboxGroup(
|
||||||
labels=["Projections Intensity Range"], active=[0], width=145, margin=[10, 5, 0, 5]
|
labels=["Projections Intensity Range:"], active=[0], width=145, margin=[10, 5, 0, 5]
|
||||||
)
|
)
|
||||||
proj_auto_checkbox.on_change("active", proj_auto_checkbox_callback)
|
proj_auto_checkbox.on_change("active", proj_auto_checkbox_callback)
|
||||||
|
|
||||||
|
@ -689,7 +689,7 @@ def create():
|
|||||||
_update_image()
|
_update_image()
|
||||||
|
|
||||||
main_auto_checkbox = CheckboxGroup(
|
main_auto_checkbox = CheckboxGroup(
|
||||||
labels=["Frame Intensity Range"], active=[0], width=145, margin=[10, 5, 0, 5]
|
labels=["Frame Intensity Range:"], active=[0], width=145, margin=[10, 5, 0, 5]
|
||||||
)
|
)
|
||||||
main_auto_checkbox.on_change("active", main_auto_checkbox_callback)
|
main_auto_checkbox.on_change("active", main_auto_checkbox_callback)
|
||||||
|
|
||||||
@ -721,7 +721,7 @@ def create():
|
|||||||
_update_proj_plots()
|
_update_proj_plots()
|
||||||
|
|
||||||
proj_auto_checkbox = CheckboxGroup(
|
proj_auto_checkbox = CheckboxGroup(
|
||||||
labels=["Projections Intensity Range"], active=[0], width=145, margin=[10, 5, 0, 5]
|
labels=["Projections Intensity Range:"], active=[0], width=145, margin=[10, 5, 0, 5]
|
||||||
)
|
)
|
||||||
proj_auto_checkbox.on_change("active", proj_auto_checkbox_callback)
|
proj_auto_checkbox.on_change("active", proj_auto_checkbox_callback)
|
||||||
|
|
||||||
|
11
scripts/pyzebra-test.service
Normal file
11
scripts/pyzebra-test.service
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=pyzebra-test web server
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=pyzebra
|
||||||
|
ExecStart=/bin/bash /usr/local/sbin/pyzebra-test.sh
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
4
scripts/pyzebra-test.sh
Normal file
4
scripts/pyzebra-test.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
source /opt/miniconda3/etc/profile.d/conda.sh
|
||||||
|
|
||||||
|
conda activate test
|
||||||
|
python /opt/pyzebra/pyzebra/app/cli.py --port=5010 --allow-websocket-origin=pyzebra.psi.ch:5010 --args --spind-path=/opt/spind
|
10
scripts/pyzebra.service
Normal file
10
scripts/pyzebra.service
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=pyzebra web server
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/bin/bash /usr/local/sbin/pyzebra.sh
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
4
scripts/pyzebra.sh
Normal file
4
scripts/pyzebra.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
source /opt/miniconda3/etc/profile.d/conda.sh
|
||||||
|
|
||||||
|
conda activate prod
|
||||||
|
pyzebra --port=80 --allow-websocket-origin=pyzebra.psi.ch:80 --args --spind-path=/opt/spind
|
Loading…
x
Reference in New Issue
Block a user