From adaec33fd69342e1280cec12256ec373aa1f2e11 Mon Sep 17 00:00:00 2001 From: Benjamin Kiessling Date: Sun, 21 Apr 2024 14:18:14 +0200 Subject: [PATCH] Use ramber-build for building conda packages --- .github/workflows/test.yml | 68 ++++++++++++++++---------------- conda/build.sh | 1 - conda/conda_build_config.yaml | 4 -- conda/{meta.yaml => recipe.yaml} | 28 +++++++++---- 4 files changed, 55 insertions(+), 46 deletions(-) delete mode 100755 conda/build.sh delete mode 100644 conda/conda_build_config.yaml rename conda/{meta.yaml => recipe.yaml} (58%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1f35aea43..b9e2df836 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,9 +13,9 @@ jobs: python-version: [3.8, 3.9, '3.10', '3.11'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies and kraken @@ -39,11 +39,11 @@ jobs: if: startsWith(github.ref, 'refs/tags/') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python 3.9 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.9 - name: Build a binary wheel and a source tarball @@ -68,43 +68,43 @@ jobs: if: startsWith(github.ref, 'refs/tags/') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: conda-incubator/setup-miniconda@v2 + - uses: conda-incubator/setup-miniconda@v3 with: python-version: 3.9 miniforge-variant: Mambaforge - name: install dependencies build shell: bash -l {0} - run: mamba install "conda-build>=3.20" colorama pip ruamel ruamel.yaml rich jsonschema conda-verify anaconda-client mamba + run: mamba install colorama pip ruamel ruamel.yaml rich jsonschema conda-verify anaconda-client # Runs the action with the following inputs or defaults if not specified. - - name: install boa - shell: bash -l {0} - run: pip install https://github.com/mamba-org/boa/archive/refs/tags/0.14.0.zip - - name: validate recipe - shell: bash -l {0} - id: conda_validation - run: | - PACKAGE_PATHS=$(conda mambabuild . --output --check -c conda-forge | tail -n 1) - echo "package_paths=$PACKAGE_PATHS" >> $GITHUB_OUTPUT - - name: run build - shell: bash -l {0} - run: conda mambabuild . -c conda-forge - - name: convert packages - shell: bash -l {0} - run: | - conda convert -p osx-arm64 -p osx-64 -o conda_convert ${{ steps.conda_validation.outputs.package_paths }} - mkdir conda_convert/linux-64 - cp -f ${{ steps.conda_validation.outputs.package_paths }} conda_convert/linux-64 - - name: upload to anaconda - shell: bash -l {0} - run: anaconda -t ${{ secrets.ANACONDA_TOKEN }} upload --no-progress --force conda_convert/*/* + - name: Build linux-64 conda package + uses: prefix-dev/rattler-build-action@v0.2.6 + with: + recipe-path: "conda/recipe.yaml" + build-args: "--experimental --target-platform linux-64" + - name: Build osx-64 conda package + uses: prefix-dev/rattler-build-action@v0.2.6 + with: + recipe-path: "conda/recipe.yaml" + build-args: "--experimental --target-platform osx-64" + - name: Build osx-arm64 conda package + uses: prefix-dev/rattler-build-action@v0.2.6 + with: + recipe-path: "conda/recipe.yaml" + build-args: "--experimental --target-platform osx-arm64" + - name: Upload conda package + - run: | + for pkg in $(find output -type f \( -name "*.conda" -o -name "*.tar.bz2" \) ); do + echo "Uploading ${pkg}" + rattler-build upload anaconda -o mittagessen -a ${{ secrets.ANACONDA_TOKEN }} "${pkg}" + done - name: Upload conda artifacts to GH storage - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: conda_packages - path: conda_convert/*/*.tar.bz2 + path: output/*/*.conda autodraft-gh-release: name: Create github release @@ -112,11 +112,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: conda_packages path: conda - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: pypi_packages path: pypi @@ -138,11 +138,11 @@ jobs: startsWith(github.ref, 'refs/tags/') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python 3.9 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.9 - name: Install sphinx-multiversion diff --git a/conda/build.sh b/conda/build.sh deleted file mode 100755 index 07d551f99..000000000 --- a/conda/build.sh +++ /dev/null @@ -1 +0,0 @@ -pip install --no-deps . diff --git a/conda/conda_build_config.yaml b/conda/conda_build_config.yaml deleted file mode 100644 index d0d6407a9..000000000 --- a/conda/conda_build_config.yaml +++ /dev/null @@ -1,4 +0,0 @@ -python: - - 3.9 - - '3.10' - - '3.11' diff --git a/conda/meta.yaml b/conda/recipe.yaml similarity index 58% rename from conda/meta.yaml rename to conda/recipe.yaml index 1620e62cc..18128d46d 100644 --- a/conda/meta.yaml +++ b/conda/recipe.yaml @@ -1,16 +1,27 @@ +context: + git_url: . + git_tag: ${{ git.latest_tag(git_url) }} + package: name: kraken - version: {{ GIT_DESCRIBE_TAG }} + version: ${{ git_tag }} source: - git_url: .. + git: ${{ git_url }} + tag: ${{ git_tag }} + +build: + script: pip install --no-deps . requirements: build: - - python - - setuptools - - pbr + - python>=3.8,<3.12 + - setuptools + - pbr + host: + - python>=3.8,<3.12 run: + - python>=3.8,<3.12 - python-bidi - lxml - regex @@ -35,7 +46,10 @@ requirements: - conda-forge::threadpoolctl~=3.4.0 - albumentations - rich + about: - home: https://kraken.re - license: APACHE + homepage: https://kraken.re + license: Apache-2.0 summary: 'OCR/HTR engine for all the languages' + repository: https://github.com/mittagessen/kraken + documentation: https://kraken.re