From 6199b61b1a7406f4f9e812ad6c245a970d4e4a4f Mon Sep 17 00:00:00 2001 From: Rutger van Haasteren Date: Wed, 8 Nov 2023 20:21:14 +0100 Subject: [PATCH] First test of anaconda build scripts --- .github/workflows/ci_test.yml | 22 ++++++++----------- recipe/meta.yaml | 41 +++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 13 deletions(-) create mode 100644 recipe/meta.yaml diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index 220f670..e26e9ff 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -2,7 +2,7 @@ name: Python package CI/CD on: push: - branches: [ main ] + branches: [ main, anaconda ] pull_request: branches: [ main ] release: @@ -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 }} diff --git a/recipe/meta.yaml b/recipe/meta.yaml new file mode 100644 index 0000000..59fc194 --- /dev/null +++ b/recipe/meta.yaml @@ -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') }}"