Skip to content

Commit

Permalink
Merge pull request #102 from DiamondLightSource/version-from-tag
Browse files Browse the repository at this point in the history
Version from tag
  • Loading branch information
dkazanc authored Jun 27, 2023
2 parents 5522688 + 7d59349 commit 48b780a
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 10 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/conda_upload.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: httomolibgpu conda upload

# Run the workflow whenever a tag beginning with `v` is pushed to any branch
on:
push:
branches:
- main
pull_request:
branches:
- main
tags:
- v*

jobs:
build-linux:
Expand All @@ -18,7 +16,10 @@ jobs:

steps:
- name: Checkout repository code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.ref_name }}

# setup Python 3.9
- name: Setup Python 3.9
Expand All @@ -39,6 +40,8 @@ jobs:
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}

- name: Build and upload the package to httomo conda cloud
env:
LABEL: main
run: |
chmod +x ./.scripts/conda_upload.sh
./.scripts/conda_upload.sh
./.scripts/conda_upload.sh
40 changes: 40 additions & 0 deletions .github/workflows/nightly_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: httomolibgpu nightly dev conda package build + upload

on:
schedule:
# Run at midnight every day
- cron: '0 0 * * *'

jobs:
build-linux:
runs-on: ubuntu-latest

defaults:
run:
shell: bash -l {0}

steps:
- name: Checkout repository code
uses: actions/checkout@v3
with:
ref: "main"
fetch-depth: 0

# setup Python 3.9
- name: Setup Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Decrypt a secret
run: ./.scripts/decrypt_secret.sh
env:
LARGE_SECRET_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}

- name: Build and upload the package to httomo conda cloud
env:
LABEL: dev
run: |
chmod +x ./.scripts/conda_upload.sh
./.scripts/conda_upload.sh
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,9 @@ cov.xml
.pytest_cache/
.mypy_cache/
save_to_images

# These are files that are created during the conda build process that need to
# be ignored in order to avoid builds being marked as being in a "dirty" state
build_env_setup.sh
conda_build.sh
metadata_conda_debug.yaml
2 changes: 1 addition & 1 deletion .scripts/conda_upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ $CONDA/bin/conda build . -c conda-forge -c httomo -c astra-toolbox --no-test
find $CONDA_BLD_PATH/$OS -name *.tar.bz2 | while read file
do
echo $file
$CONDA/bin/anaconda -v --show-traceback --token $CONDA_TOKEN upload $file --force
$CONDA/bin/anaconda -v --show-traceback --token $CONDA_TOKEN upload --label $LABEL $file --force
done
1 change: 1 addition & 0 deletions conda/recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
python:
- 3.9
- 3.10
numpy:
- 1.24
4 changes: 2 additions & 2 deletions conda/recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{% set pyproject = load_file_data("../../pyproject.toml", from_recipe_dir=True) %}
{% set proj = pyproject.get("project") %}
{% set name = proj.get("name") %}
{% set version = proj.get("version") %}

package:
name: {{ name|lower }}
version: {{ version }}
version: {{ GIT_DESCRIBE_TAG|trim("v") }}

source:
path: ../../
Expand All @@ -19,6 +18,7 @@ requirements:
- python
- pip
- setuptools
- setuptools-git-versioning
run:
- python
- numpy
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ httomolibgpu = ["*.cu", "*.cuh"] # include cuda kernels in package

[tool.setuptools-git-versioning]
enabled = true
template = "{tag}"
dev_template = "{tag}"

[project]
name = "httomolibgpu"
Expand Down

0 comments on commit 48b780a

Please sign in to comment.