From 424f44f51fd5d71db27166d1ae0047b8a552a2be Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Fri, 14 Apr 2023 10:01:42 +0100 Subject: [PATCH 1/4] Handle dev packages in version check. --- python/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/setup.py b/python/setup.py index 6d6b0f16a..c6a746036 100644 --- a/python/setup.py +++ b/python/setup.py @@ -39,7 +39,7 @@ ) # Check the Sire version. - if int(sire.legacy.__version__.replace(".", "")) < min_ver_int: + if int(sire.legacy.__version__.replace(".", "").replace("dev", "")) < min_ver_int: raise ImportError("BioSimSpace requires Sire version '%s' or above." % min_ver) from setuptools import setup, find_packages From 4c149f59e04ce5a31dd1a1cf330aedbc638cc32e Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Fri, 14 Apr 2023 11:50:15 +0100 Subject: [PATCH 2/4] Allow channel label to be specified via an environment variable. --- actions/upload_package.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/actions/upload_package.py b/actions/upload_package.py index 7d8452571..6baf7249c 100644 --- a/actions/upload_package.py +++ b/actions/upload_package.py @@ -16,6 +16,12 @@ else: conda_token = "TEST" +# Get the anaconda channel labels. +if "ANACONDA_LABEL" in os.environ: + conda_label = os.environ["ANACONDA_LABEL"] +else: + conda_label = "dev" + # get the root conda directory conda = os.environ["CONDA"] @@ -50,17 +56,8 @@ def run_cmd(cmd): tag = run_cmd(f"git --git-dir={gitdir} --work-tree={srcdir} tag --contains") -# If the tag is not empty, then set the label to main (this is a release) -if tag is not None and tag.lstrip().rstrip() != "": - print(f"\nTag {tag} is set. This is a 'main' release.") - label = "--label main --label dev" -else: - # this is a development release - print("\nNo tag is set. This is a 'devel' release.") - label = "--label dev" - # Upload the packages to the openbiosim channel on Anaconda Cloud. -cmd = f"anaconda --token {conda_token} upload --user openbiosim {label} --force {packages}" +cmd = f"anaconda --token {conda_token} upload --user openbiosim --label {conda_label} --force {packages}" print(f"\nUpload command:\n\n{cmd}\n") From b94cea5566f719860e7dacda869b38333cda5ef6 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Fri, 14 Apr 2023 11:51:19 +0100 Subject: [PATCH 3/4] Update GitHub actions workflow scripts. --- .github/workflows/devel.yaml | 70 ++++++++++++++++++++++++++++++++++++ .github/workflows/main.yaml | 52 ++++++++------------------- .github/workflows/pr.yaml | 70 ++++++++++++++++++++++++++++++++++++ 3 files changed, 154 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/devel.yaml create mode 100644 .github/workflows/pr.yaml diff --git a/.github/workflows/devel.yaml b/.github/workflows/devel.yaml new file mode 100644 index 000000000..797741d97 --- /dev/null +++ b/.github/workflows/devel.yaml @@ -0,0 +1,70 @@ +name: Release Devel + +on: + workflow_dispatch: + push: + branches: [ devel ] + +jobs: + build: + name: build (${{ matrix.python-version }}, ${{ matrix.platform.name }}) + runs-on: ${{ matrix.platform.os }} + strategy: + max-parallel: 9 + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10"] + platform: + - { name: "windows", os: "windows-latest", shell: "pwsh" } + - { name: "linux", os: "ubuntu-latest", shell: "bash -l {0}" } + - { name: "macos", os: "macos-latest", shell: "bash -l {0}" } + exclude: + # Exclude all but the latest Python from all but Linux + - platform: + { name: "macos", os: "macos-latest", shell: "bash -l {0}" } + python-version: "3.8" + - platform: { name: "windows", os: "windows-latest", shell: "pwsh" } + python-version: "3.8" + - platform: + { name: "macos", os: "macos-latest", shell: "bash -l {0}" } + python-version: "3.9" + - platform: { name: "windows", os: "windows-latest", shell: "pwsh" } + python-version: "3.9" + environment: + name: biosimspace-build + defaults: + run: + shell: ${{ matrix.platform.shell }} + env: + SIRE_DONT_PHONEHOME: 1 + SIRE_SILENT_PHONEHOME: 1 + steps: + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: ${{ matrix.python-version }} + activate-environment: bss_build + miniforge-version: latest + miniforge-variant: Mambaforge + use-mamba: true +# + - name: Clone the devel branch + run: git clone -b devel https://github.com/openbiosim/biosimspace +# + - name: Setup Conda + run: mamba install -y -c conda-forge boa anaconda-client packaging=21 pip-requirements-parser +# + - name: Update Conda recipe + run: python ${{ github.workspace }}/biosimspace/actions/update_recipe.py +# + - name: Prepare build location + run: mkdir ${{ github.workspace }}/build +# + - name: Build Conda package using mamba build + run: conda mambabuild -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/biosimspace/recipes/biosimspace +# + - name: Upload Conda package + run: python ${{ github.workspace }}/biosimspace/actions/upload_package.py + env: + ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} + ANACONDA_LABEL: dev diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 316fbdac6..8afd4347b 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,17 +1,12 @@ -name: Build +name: Release Main on: workflow_dispatch: - push: - branches: [ devel ] - pull_request: - branches: [ devel ] - -# Note that push and pull-request builds are automatically -# now skipped by GitHub if -# [skip ci], [ci skip], [no ci], [skip actions], or [actions skip] -# are in the commit message. We don't need to check for this ourselves. - + inputs: + upload_packages: + description: "Upload packages to anaconda (yes/no)?" + required: true + default: "no" jobs: build: name: build (${{ matrix.python-version }}, ${{ matrix.platform.name }}) @@ -22,21 +17,9 @@ jobs: matrix: python-version: ["3.8", "3.9", "3.10"] platform: - - { - name: "windows", - os: "windows-latest", - shell: "pwsh" - } - - { - name: "linux", - os: "ubuntu-latest", - shell: "bash -l {0}" - } - - { - name: "macos", - os: "macos-latest", - shell: "bash -l {0}" - } + - { name: "windows", os: "windows-latest", shell: "pwsh" } + - { name: "linux", os: "ubuntu-latest", shell: "bash -l {0}" } + - { name: "macos", os: "macos-latest", shell: "bash -l {0}" } environment: name: biosimspace-build defaults: @@ -45,7 +28,6 @@ jobs: env: SIRE_DONT_PHONEHOME: 1 SIRE_SILENT_PHONEHOME: 1 - REPO: "${{ github.event.pull_request.head.repo.full_name || github.repository }}" steps: - uses: conda-incubator/setup-miniconda@v2 with: @@ -56,13 +38,8 @@ jobs: miniforge-variant: Mambaforge use-mamba: true # - - name: Clone the devel branch (push to devel) - run: git clone https://github.com/${{ env.REPO }} - if: github.event_name != 'pull_request' -# - - name: Clone the feature branch (pull request to devel) - run: git clone -b ${{ github.head_ref }} --single-branch https://github.com/${{ env.REPO }} - if: github.event_name == 'pull_request' + - name: Clone the main branch + run: git clone -b main https://github.com/openbiosim/biosimspace # - name: Setup Conda run: mamba install -y -c conda-forge boa anaconda-client packaging=21 pip-requirements-parser @@ -74,12 +51,11 @@ jobs: run: mkdir ${{ github.workspace }}/build # - name: Build Conda package using mamba build - run: conda mambabuild -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/biosimspace/recipes/biosimspace + run: conda mambabuild -c conda-forge -c openbiosim/label/main ${{ github.workspace }}/biosimspace/recipes/biosimspace # - name: Upload Conda package run: python ${{ github.workspace }}/biosimspace/actions/upload_package.py env: - SRC_DIR: ${{ github.workspace }}/biosimspace - BUILD_DIR: ${{ github.workspace }}/build ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} - if: github.event_name != 'pull_request' + ANACONDA_LABEL: main + if: github.event.inputs.upload_packages == 'yes' diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 000000000..e5dce94c3 --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,70 @@ +name: Pull-Request + +on: + pull_request: + branches: [devel, main] + +jobs: + build: + name: build (${{ matrix.python-version }}, ${{ matrix.platform.name }}) + runs-on: ${{ matrix.platform.os }} + strategy: + max-parallel: 9 + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10"] + platform: + - { name: "windows", os: "windows-latest", shell: "pwsh" } + - { name: "linux", os: "ubuntu-latest", shell: "bash -l {0}" } + - { name: "macos", os: "macos-latest", shell: "bash -l {0}" } + exclude: + # Exclude all but the latest Python from all + # but Linux + - platform: + { name: "macos", os: "macos-latest", shell: "bash -l {0}" } + python-version: "3.8" + - platform: { name: "windows", os: "windows-latest", shell: "pwsh" } + python-version: "3.8" + - platform: + { name: "macos", os: "macos-latest", shell: "bash -l {0}" } + python-version: "3.9" + - platform: { name: "windows", os: "windows-latest", shell: "pwsh" } + python-version: "3.9" + environment: + name: biosimspace-build + defaults: + run: + shell: ${{ matrix.platform.shell }} + env: + SIRE_DONT_PHONEHOME: 1 + SIRE_SILENT_PHONEHOME: 1 + REPO: "${{ github.event.pull_request.head.repo.full_name || github.repository }}" + steps: + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: ${{ matrix.python-version }} + activate-environment: bss_build + miniforge-version: latest + miniforge-variant: Mambaforge + use-mamba: true +# + - name: Clone the feature branch + run: git clone -b ${{ github.head_ref }} --single-branch https://github.com/${{ env.REPO }} +# + - name: Setup Conda + run: mamba install -y -c conda-forge boa anaconda-client packaging=21 pip-requirements-parser +# + - name: Update Conda recipe + run: python ${{ github.workspace }}/biosimspace/actions/update_recipe.py +# + - name: Prepare build location + run: mkdir ${{ github.workspace }}/build +# + - name: Build Conda package using mamba build using main channel + if: ${{ github.base_ref == 'main' }} + run: conda mambabuild -c conda-forge -c openbiosim/label/main ${{ github.workspace }}/biosimspace/recipes/biosimspace +# + - name: Build Conda package using mamba build using dev channel + if: ${{ github.base_ref != 'main' }} + run: conda mambabuild -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/biosimspace/recipes/biosimspace From d2969ee8d05860036901d54719b0e0e3fb2ee8b2 Mon Sep 17 00:00:00 2001 From: Lester Hedges Date: Fri, 14 Apr 2023 13:34:14 +0100 Subject: [PATCH 4/4] Update Sire requirement. --- requirements.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 4f1034d78..f03c841af 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,10 @@ # BioSimSpace runtime requirements. -sire ~=2023.2.0 +# main +# sire~=2023.2.2 + +# devel +sire==2023.3.0.dev configargparse ipywidgets<8