From 828f10212b169960ad15c1867ca6815b51bb63e0 Mon Sep 17 00:00:00 2001 From: atmorling Date: Tue, 22 Oct 2024 11:51:25 +0200 Subject: [PATCH] Prefix release CI (#301) --- .github/workflows/publish.yml | 59 ++++++++++++++++++++++ publish/recipes/release/ecoscope.yaml | 73 +++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 publish/recipes/release/ecoscope.yaml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 793d555c..7779161d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -95,6 +95,65 @@ jobs: '${{ github.ref_name }}' dist/** --repo '${{ github.repository }}' + build-for-prefix: + name: Build prefix package + needs: + - github-release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Download the built dist + uses: actions/download-artifact@v4 + with: + name: pip-dist + path: dist/ + - name: Add tag to recipe + run: sed -i "s/TAG_VERSION/${{ github.ref_name }}/g" publish/recipes/release/ecoscope.yaml + - name: Add dist to recipe + run: sed -i "s/DIST_NAME/$(find ./dist/*.tar.gz -printf "%f\n")/g" publish/recipes/release/ecoscope.yaml + - name: Log the generated recipe + run: cat publish/recipes/release/ecoscope.yaml + - name: Create channel + run: mkdir -p /tmp/ecoscope/release/artifacts + - name: Build prefix release + uses: prefix-dev/rattler-build-action@v0.2.16 + with: + recipe-path: publish/recipes/release/ecoscope.yaml + build-args: --output-dir /tmp/ecoscope/release/artifacts --channel https://prefix.dev/ecoscope-workflows --channel conda-forge + - name: Upload conda channel + uses: actions/upload-artifact@v4 + with: + name: release-artifacts + path: | + /tmp/ecoscope/release/artifacts/ + !/tmp/ecoscope/release/artifacts/bld + !/tmp/ecoscope/release/artifacts/src_cache + if-no-files-found: error + compression-level: 0 + + publish-to-prefix: + name: Publish to prefix + needs: + - build-for-prefix + runs-on: ubuntu-latest + steps: + - name: Download conda channel + uses: actions/download-artifact@v4 + with: + name: release-artifacts + path: /tmp/ecoscope/release/artifacts + - name: Log conda channel contents + run: ls -lR /tmp/ecoscope/release/artifacts + - uses: actions/checkout@v4 + - name: Publish to prefix.dev + uses: prefix-dev/rattler-build-action@v0.2.16 + - run: | + for file in /tmp/ecoscope/release/artifacts/**/*.conda; do + rattler-build upload prefix -c ecoscope-workflows "$file" || true + done + env: + PREFIX_API_KEY: ${{ secrets.PREFIX_API_KEY }} + publish-to-pypi: name: Publish to PyPI needs: diff --git a/publish/recipes/release/ecoscope.yaml b/publish/recipes/release/ecoscope.yaml new file mode 100644 index 00000000..669f566e --- /dev/null +++ b/publish/recipes/release/ecoscope.yaml @@ -0,0 +1,73 @@ +context: + name: ecoscope + version: TAG_VERSION + +package: + name: ecoscope + version: ${{ version }} + +source: + path: ../../../dist/DIST_NAME + +build: + noarch: python + script: SETUPTOOLS_SCM_PRETEND_VERSION=${{ version }} pip install . -v + number: 5 + +requirements: + host: + - python + - setuptools >=45 + - setuptools-scm >=6.2 + - pip + run: + - python + - backoff + - earthengine-api + - earthranger-client + - fiona <1.10.0 + - geopandas <=0.14.2 + - numpy <2 # added by me, but should be ensured by geopandas anyway + - pyproj + - rasterio + - tqdm + # ~ analysis ~ + - astroplan + # - datashader # (cisaacstern) per atmorling, not required for current workflows + - igraph + - mapclassify + # - matplotlib # disabling in favor of matplotlib-base which is smaller + - matplotlib-base + - networkx + - numba + - scipy + - scikit-image + - scikit-learn + # ~ plotting ~ + # - kaleido # not available on conda and do we actually use this? + - plotly + # - scikit-learn # duplicate with analysis + # ~ mapping ~ + - lonboard==0.0.3 + # - matplotlib # duplicate with analysis + # - mapclassify # duplicate with analysis + +tests: + - python: + imports: + - ecoscope + - ecoscope.analysis + - ecoscope.base + - ecoscope.io + - ecoscope.mapping + - ecoscope.plotting + +about: + summary: Standard Analytical Reporting Framework for Conservation + license: BSD-3-Clause + license_file: LICENSE + +extra: + recipe-maintainers: + - cisaacstern + - atmorling