Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup miniconda action #29

Merged
merged 1 commit into from
Nov 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 24 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

defaults:
run:
shell: bash
shell: bash -l {0}

env:
PACKAGE_NAME: workflow-sandbox
Expand Down Expand Up @@ -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/[email protected]
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 .
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is the result of many hours of misery.

Some builds of projects with C extensions fail with errors like:

The input line is too long.
The syntax of the command is incorrect.

This is because of long filepaths. The conda build would be done in a directory like:

D:\a\labscript-c-extensions\labscript-c-extensions\conda_build\conda-bld\

Using ${{ runner.temp }}\cb instead results in the conda build being done in the directory:

D:\a\_temp\cb\

saving many characters in the filepath and causing the builds to not fail with the "input line too long" error


- name: Upload Artifact
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -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/[email protected]
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 \
Expand All @@ -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 \
Expand Down