From d6b96db2a437544498c367d5e1fee5bc427a4d45 Mon Sep 17 00:00:00 2001 From: Xuwznln <18435084+Xuwznln@users.noreply.github.com> Date: Fri, 1 Aug 2025 22:27:59 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4post-link=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=EF=BC=8C=E6=9B=B4=E6=96=B0=E6=9E=84=E5=BB=BA=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=BB=A5=E6=94=AF=E6=8C=81=E5=A4=9A=E5=B9=B3=E5=8F=B0=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=EF=BC=8C=E8=B0=83=E6=95=B4=E4=BE=9D=E8=B5=96=E9=A1=B9?= =?UTF-8?q?=E4=BB=A5=E9=80=82=E5=BA=94=E4=B8=8D=E5=90=8C=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .conda/recipe.yaml | 5 ++- .conda/scripts/post-link.bat | 9 ----- .conda/scripts/post-link.sh | 9 ----- .github/workflows/unilabos-conda-build.yml | 46 ++++++++++++++++++++-- 4 files changed, 46 insertions(+), 23 deletions(-) delete mode 100644 .conda/scripts/post-link.bat delete mode 100644 .conda/scripts/post-link.sh diff --git a/.conda/recipe.yaml b/.conda/recipe.yaml index eb92da7..9ebf263 100644 --- a/.conda/recipe.yaml +++ b/.conda/recipe.yaml @@ -7,7 +7,6 @@ source: target_directory: unilabos build: - noarch: python script: - set PIP_NO_INDEX= - if: win @@ -33,8 +32,10 @@ requirements: - conda-forge::python ==3.11.11 - compilers - cmake - - make - ninja + - if: unix + then: + - make - sphinx - sphinx_rtd_theme - numpy diff --git a/.conda/scripts/post-link.bat b/.conda/scripts/post-link.bat deleted file mode 100644 index 352b78c..0000000 --- a/.conda/scripts/post-link.bat +++ /dev/null @@ -1,9 +0,0 @@ -@echo off -setlocal enabledelayedexpansion - -REM upgrade pip -"%PREFIX%\python.exe" -m pip install --upgrade pip - -REM install extra deps -"%PREFIX%\python.exe" -m pip install paho-mqtt opentrons_shared_data -"%PREFIX%\python.exe" -m pip install git+https://github.com/Xuwznln/pylabrobot.git diff --git a/.conda/scripts/post-link.sh b/.conda/scripts/post-link.sh deleted file mode 100644 index ef96f15..0000000 --- a/.conda/scripts/post-link.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -set -euxo pipefail - -# make sure pip is available -"$PREFIX/bin/python" -m pip install --upgrade pip - -# install extra deps -"$PREFIX/bin/python" -m pip install paho-mqtt opentrons_shared_data -"$PREFIX/bin/python" -m pip install git+https://github.com/Xuwznln/pylabrobot.git diff --git a/.github/workflows/unilabos-conda-build.yml b/.github/workflows/unilabos-conda-build.yml index 38b483a..5bc99b9 100644 --- a/.github/workflows/unilabos-conda-build.yml +++ b/.github/workflows/unilabos-conda-build.yml @@ -8,6 +8,10 @@ on: branches: [main, dev] workflow_dispatch: inputs: + platforms: + description: '选择构建平台 (逗号分隔): linux-64, osx-64, osx-arm64, win-64' + required: false + default: 'linux-64' upload_to_anaconda: description: '是否上传到Anaconda.org' required: false @@ -16,7 +20,20 @@ on: jobs: build: - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + platform: linux-64 + - os: macos-13 # Intel + platform: osx-64 + - os: macos-latest # ARM64 + platform: osx-arm64 + - os: windows-latest + platform: win-64 + + runs-on: ${{ matrix.os }} defaults: run: @@ -27,7 +44,21 @@ jobs: with: fetch-depth: 0 + - name: Check if platform should be built + id: should_build + run: | + if [[ "${{ github.event_name }}" != "workflow_dispatch" ]]; then + echo "should_build=true" >> $GITHUB_OUTPUT + elif [[ -z "${{ github.event.inputs.platforms }}" ]]; then + echo "should_build=true" >> $GITHUB_OUTPUT + elif [[ "${{ github.event.inputs.platforms }}" == *"${{ matrix.platform }}"* ]]; then + echo "should_build=true" >> $GITHUB_OUTPUT + else + echo "should_build=false" >> $GITHUB_OUTPUT + fi + - name: Setup Miniconda + if: steps.should_build.outputs.should_build == 'true' uses: conda-incubator/setup-miniconda@v3 with: miniconda-version: 'latest' @@ -39,28 +70,36 @@ jobs: show-channel-urls: true - name: Install rattler-build and anaconda-client + if: steps.should_build.outputs.should_build == 'true' run: | conda install -c conda-forge rattler-build anaconda-client - name: Show environment info + if: steps.should_build.outputs.should_build == 'true' run: | conda info conda list | grep -E "(rattler-build|anaconda-client)" + echo "Platform: ${{ matrix.platform }}" + echo "OS: ${{ matrix.os }}" echo "Building UniLabOS package" - name: Build conda package + if: steps.should_build.outputs.should_build == 'true' run: | rattler-build build -r .conda/recipe.yaml -c uni-lab -c robostack-staging -c conda-forge - name: List built packages + if: steps.should_build.outputs.should_build == 'true' run: | echo "Built packages in output directory:" find ./output -name "*.conda" | head -10 + ls -la ./output/${{ matrix.platform }}/ || echo "${{ matrix.platform }} directory not found" ls -la ./output/noarch/ || echo "noarch directory not found" echo "Output directory structure:" find ./output -type f -name "*.conda" - name: Prepare artifacts for upload + if: steps.should_build.outputs.should_build == 'true' run: | mkdir -p conda-packages-temp find ./output -name "*.conda" -exec cp {} conda-packages-temp/ \; @@ -68,15 +107,16 @@ jobs: ls -la conda-packages-temp/ - name: Upload conda package artifacts + if: steps.should_build.outputs.should_build == 'true' uses: actions/upload-artifact@v4 with: - name: conda-package-unilabos + name: conda-package-unilabos-${{ matrix.platform }} path: conda-packages-temp if-no-files-found: warn retention-days: 30 - name: Upload to Anaconda.org (uni-lab organization) - if: github.event.inputs.upload_to_anaconda == 'true' + if: steps.should_build.outputs.should_build == 'true' && (github.event.inputs.upload_to_anaconda == 'true' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request')) run: | for package in $(find ./output -name "*.conda"); do echo "Uploading $package to uni-lab organization..."