Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI for new release process #34

Merged
merged 4 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/devel.yaml
Original file line number Diff line number Diff line change
@@ -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
52 changes: 14 additions & 38 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -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 }})
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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'
70 changes: 70 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 7 additions & 10 deletions actions/upload_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down