Skip to content

Commit

Permalink
First test of anaconda build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
vhaasteren committed Nov 8, 2023
1 parent e87a55c commit 6199b61
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 13 deletions.
22 changes: 9 additions & 13 deletions .github/workflows/ci_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Python package CI/CD

on:
push:
branches: [ main ]
branches: [ main, anaconda ]
pull_request:
branches: [ main ]
release:
Expand Down Expand Up @@ -112,29 +112,25 @@ jobs:

conda-package:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
needs: [tests, build]
steps:
- uses: actions/checkout@v3
- name: Set up conda for Python ${{ matrix.python-version }}
- name: Set up conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
activate-environment: build-env
#environment-file: environment.yml
conda-channels: anaconda, conda-forge
- name: Install conda-build and anaconda-client
run: |
conda install conda-build anaconda-client
- name: Build conda package
run: |
conda config --set anaconda_upload no
PACKAGE_PATH=$(conda build recipe/ --output)
echo "PACKAGE_PATH=$PACKAGE_PATH" >> $GITHUB_ENV
- name: Upload conda package
conda build recipe/
- name: Upload conda package to Anaconda Cloud
if: github.event_name == 'release' && github.ref == 'refs/heads/main'
run: |
echo "Uploading to Anaconda Cloud..."
anaconda -t ${{ secrets.ANACONDA_API_TOKEN }} upload ${{ env.PACKAGE_PATH }}
anaconda -t ${{ secrets.ANACONDA_API_TOKEN }} upload $(conda build recipe/ --output)
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
41 changes: 41 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{% set data = load_setup_py_data(setup_file='../setup.py') %}

package:
name: "{{ data.get('name') }}"
version: "{{ data.get('version') }}"

source:
path: ..

build:
number: 0
script: "{{ PYTHON }} -m pip install . --no-deps --ignore-installed --no-cache-dir -vvv"

requirements:
host:
- python
- pip
- setuptools
- wheel
- setuptools_scm
- numpy
- cython
run:
- python
- numpy
- scipy

test:
imports:
- fastshermanmorrison

about:
home: "{{ data.get('project').get('urls').get('Homepage') }}"
license: "{{ data.get('project').get('license').get('file') }}"
license_file: ../LICENSE
summary: "{{ data.get('project').get('description') }}"
dev_url: "{{ data.get('project').get('urls').get('Bug Tracker') }}"

extra:
authors: "{{ data.get('project').get('authors')[0].get('name') }}"
email: "{{ data.get('project').get('authors')[0].get('email') }}"

0 comments on commit 6199b61

Please sign in to comment.