Skip to content

Commit 77f897e

Browse files
authored
Merge pull request #37 from bschroeter/main
Conda release pipeline
2 parents 628adf8 + 9aaed90 commit 77f897e

16 files changed

+962
-34
lines changed

.conda/build_env.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Required for 'Build and upload conda packages' workflow
2+
3+
channels:
4+
- conda-forge
5+
- accessnri
6+
- coecms
7+
- default
8+
9+
dependencies:
10+
- anaconda-client
11+
- conda-build
12+
- versioneer

.conda/meorg_client_dev.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: meorg_client_dev
2+
3+
channels:
4+
- conda-forge
5+
- accessnri
6+
- coecms
7+
- defaults
8+
9+
dependencies:
10+
- python>=3.9
11+
- requests>=2.31.0
12+
- click>=8.1.7
13+
- PyYAML>=6.0.1
14+
- pip
15+
- pytest
16+
- black
17+
- ruff
18+
- pip:
19+
- -r mkdocs-requirements.txt

.conda/meta.yaml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{% set data = load_setup_py_data() %}
2+
{% set version = data.get('version') %}
3+
4+
package:
5+
name: meorg_client
6+
version: "{{ version }}"
7+
8+
source:
9+
path: ..
10+
11+
12+
build:
13+
noarch: python
14+
number: 0
15+
script: "{{ PYTHON }} -m pip install . -vv"
16+
17+
18+
requirements:
19+
host:
20+
- python >=3.9
21+
- pip
22+
- setuptools>=64
23+
- versioneer
24+
run:
25+
- python >=3.9
26+
- requests >=2.31.0
27+
- click >=8.1.7
28+
- PyYAML >=6.0.1
29+
30+
test:
31+
imports:
32+
- meorg_client

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
meorg_client/_version.py export-subst

.github/workflows/cd.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Conda Publish
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
jobs:
8+
conda_deployment:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: conda-incubator/setup-miniconda@v2
15+
with:
16+
python-version: '3.9'
17+
environment-file: .conda/build_env.yaml
18+
auto-update-conda: false
19+
auto-activate-base: false
20+
show-channel-urls: true
21+
- name: Build and upload the conda packages
22+
uses: uibcdf/[email protected]
23+
with:
24+
python-version: '3.9'
25+
meta_yaml_dir: .conda
26+
user: bschroeter
27+
label: main
28+
token: ${{ secrets.ANACONDA_TOKEN_BEN }}

docs/contributing.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Contributing
2+
3+
The following outlines the process to contribute to meorg_client.
4+
5+
## 1. Clone the repository
6+
7+
```shell
8+
# Create a work space for repos
9+
mkdir -p $HOME/work
10+
11+
# Move into it
12+
cd $HOME/work
13+
14+
# Clone the repo
15+
git clone [email protected]:CABLE-LSM/meorg_client.git
16+
17+
# Move into it
18+
cd meorg_client
19+
```
20+
21+
## 2. Set up the dev environment
22+
23+
```shell
24+
# Create the development environment
25+
conda env create -f .conda/meorg_client_dev.yaml
26+
```
27+
28+
## 3. Install meorg_client in editable mode
29+
30+
```shell
31+
# Install as editable
32+
pip install -e .
33+
```
34+
35+
You can now edit the source code in your editor of choice and have changes immediately reflected in your environment for rapid development.
36+
37+
Please follow the standard contribution guidelines in addressing issues for the project.

docs/releasing.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Releasing
2+
3+
Releases are generated from a stable main as needed to reflect developments and community needs.
4+
5+
Release generation is restricted to project administrators.
6+
7+
Releasing the client involves publishing a tagged release on Github:
8+
1. Go to https://github.com/CABLE-LSM/meorg_client/releases/new
9+
2. Under "Choose a tag", start typing a new release, following SemVer (without leading "v") and click "Create new tag X on publish".
10+
3. Ensure Target is set to "main".
11+
4. Generate release notes if applicable.
12+
5. Enter the tag you set in (2) WITH a leading "v".
13+
6. Edit the release description as needed.
14+
7. Set as the latest release.
15+
8. Click "Publish release".
16+
17+
## Testing the release
18+
19+
To test the release prior to actually releasing the code, you can approximate the build and publication process locally.
20+
21+
```shell
22+
# Move into the repo directory
23+
cd $HOME/work/meorg_client
24+
25+
# Create a build environment
26+
conda env create -n meorg_client_build -f .conda/build_env.yaml
27+
28+
# Activate the environment
29+
conda activate meorg_client_build
30+
31+
# Build the project
32+
conda build .
33+
34+
# If it worked, install the local package
35+
conda install --use-local meorg_client
36+
```
37+
38+
The build should exit immediately upon failure, however, there may be silent errors that can occur, such as no version number on either the pip or conda package (see the logs and look for "None" or "0.0.0" in build artefacts). In this case, there would be a failure in the upload to anaconda.org in the Github Action.
39+
40+
Most users will generally not need to test the build and release process for typical development tasks.

meorg_client/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
"""Root init file."""
2+
3+
from . import _version
4+
5+
__version__ = _version.get_versions()["version"]

0 commit comments

Comments
 (0)