From 4c93d81620ccd936d3736df38033a2737aa3f1cf Mon Sep 17 00:00:00 2001 From: chrisjbillington Date: Fri, 19 Nov 2021 19:29:48 +1100 Subject: [PATCH] use setup-miniconda action to install miniconda Also: * install setuptools-conda from labscript-suite * build conda packages in ${{ runner.temp }}\cb on Windows, which is a short filepath. This helps avoid very long filepaths causing failure during the build. --- .github/workflows/release.yml | 65 +++++++++++++---------------------- 1 file changed, 24 insertions(+), 41 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8b58b67..6bbe711 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ on: defaults: run: - shell: bash + shell: bash -l {0} env: PACKAGE_NAME: workflow-sandbox @@ -97,50 +97,35 @@ jobs: - name: Set Variables for Conda Build run: | - if [ $RUNNER_OS == Windows ] && [ ${{ matrix.arch }} == x64 ]; then - CONDA_INSTALLER=Miniconda3-latest-Windows-x86_64.exe - elif [ $RUNNER_OS == Windows ]; then - CONDA_INSTALLER=Miniconda3-latest-Windows-x86.exe - elif [ $RUNNER_OS == Linux ]; then - CONDA_INSTALLER=Miniconda3-latest-Linux-x86_64.sh - else - CONDA_INSTALLER=Miniconda3-latest-MacOSX-x86_64.sh - fi if [ $NOARCH == true ]; then CONDA_BUILD_ARGS="--noarch" else CONDA_BUILD_ARGS="" fi - echo "CONDA_INSTALLER=$CONDA_INSTALLER" >> $GITHUB_ENV echo "CONDA_BUILD_ARGS=$CONDA_BUILD_ARGS" >> $GITHUB_ENV + - name: Install Miniconda + # 2.0.1 until https://github.com/conda-incubator/setup-miniconda/pull/189 merged + # and released. Then can change to v2 + uses: conda-incubator/setup-miniconda@v2.0.1 + with: + auto-update-conda: true + python-version: ${{ matrix.python }} + architecture: ${{ matrix.arch }} + miniconda-version: "latest" + - name: Conda package (Unix) if: runner.os != 'Windows' run: | - curl -LO https://repo.continuum.io/miniconda/$CONDA_INSTALLER - bash "$CONDA_INSTALLER" -b -p .miniconda - source .miniconda/etc/profile.d/conda.sh - conda activate - conda update -n base -c defaults conda - conda create -n py${{ matrix.python }} python=${{ matrix.python }} - conda activate py${{ matrix.python }} - conda install -c cbillington setuptools-conda - pip install --upgrade setuptools_scm + conda install -c labscript-suite setuptools-conda setuptools-conda build $CONDA_BUILD_ARGS . - name: Conda Package (Windows) if: runner.os == 'Windows' - shell: cmd + shell: cmd /C CALL {0} run: | - curl -LO https://repo.continuum.io/miniconda/%CONDA_INSTALLER% - %CONDA_INSTALLER% /S /D=%CD%\.miniconda && ^ - .miniconda\Scripts\activate && ^ - conda update -n base -c defaults conda && ^ - conda create -n py${{ matrix.python }} python=${{ matrix.python }} && ^ - conda activate py${{ matrix.python }} && ^ - conda install -c cbillington setuptools-conda && ^ - pip install --upgrade setuptools_scm && ^ - setuptools-conda build %CONDA_BUILD_ARGS% . + conda install -c labscript-suite setuptools-conda && ^ + setuptools-conda build %CONDA_BUILD_ARGS% --croot ${{ runner.temp }}\cb . - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -243,19 +228,19 @@ jobs: user: __token__ password: ${{ secrets.pypi }} - - name: Install Miniconda and cloud client - run: | - curl -LO https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh - bash Miniconda3-latest-Linux-x86_64.sh -b -p .miniconda - source .miniconda/etc/profile.d/conda.sh - conda activate - conda install anaconda-client + - name: Install Miniconda + # 2.0.1 until https://github.com/conda-incubator/setup-miniconda/pull/189 merged + # and released. Then can change to v2 + uses: conda-incubator/setup-miniconda@v2.0.1 + with: + auto-update-conda: true + + - name: Install Anaconda cloud client + run: conda install anaconda-client - name: Publish to Anaconda test label if: github.event.ref_type != 'tag' run: | - source .miniconda/etc/profile.d/conda.sh - conda activate anaconda \ --token ${{ secrets.ANACONDA_API_TOKEN }} \ upload \ @@ -266,8 +251,6 @@ jobs: - name: Publish to Anaconda main label if: github.event.ref_type == 'tag' run: | - source .miniconda/etc/profile.d/conda.sh - conda activate anaconda \ --token ${{ secrets.ANACONDA_API_TOKEN }} \ upload \