Try using libmamba solver for conda packaging #1309
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: conda-package | |
on: | |
push: | |
branches: [ master ] | |
tags: ["*"] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
package: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Linux", | |
os: ubuntu-latest | |
} | |
- { | |
name: "MacOSX", | |
os: macos-latest | |
} | |
- { | |
name: "Windows", | |
os: windows-2019 | |
} | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: 3.9 | |
activate-environment: hexrd | |
auto-activate-base: false | |
- name: Install build requirements | |
run: | | |
# Change default solver to be libmamba, so that it runs much faster | |
conda install -n base -c conda-forge conda-libmamba-solver | |
conda config --set solver libmamba | |
conda activate hexrd | |
# FIXME: downgrade urllib3 until this issue is fixed: | |
# https://github.com/Anaconda-Platform/anaconda-client/issues/654 | |
conda install --override-channels -c conda-forge anaconda-client conda-build conda 'urllib3<2.0.0' | |
# This is need to ensure ~/.profile or ~/.bashrc are used so the activate | |
# command works. | |
shell: bash -l {0} | |
- name: Build the package (host) | |
if: ${{ matrix.config.name != 'Linux' }} | |
run: | | |
conda activate hexrd | |
# FIXME: why do we have to set this again? It was set in the previous step! | |
conda install -c conda-forge conda-libmamba-solver | |
conda config --env --set solver libmamba | |
mkdir output | |
# Conda build is ignoring the .condarc for some reason, so we need to | |
# set this environment variable instead. | |
export CONDA_SOLVER=libmamba | |
conda build --override-channels -c conda-forge --output-folder output/ conda.recipe/ | |
# This is need to ensure ~/.profile or ~/.bashrc are used so the activate | |
# command works. | |
shell: bash -l {0} | |
- name: Build the package (container) | |
if: ${{ matrix.config.name == 'Linux' }} | |
uses: docker://centos:7 | |
with: | |
entrypoint: /github/workspace/.github/workflows/container_build.sh | |
- name: Upload the package to anaconda channel (tag push to master) | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
run: | | |
conda activate hexrd | |
anaconda --token ${{ secrets.ANACONDA_TOKEN }} upload --force --user HEXRD output/**/*.tar.bz2 | |
# This is need to ensure ~/.profile or ~/.bashrc are used so the activate | |
# command works. | |
shell: bash -l {0} | |
- name: Upload the package to anaconda prerelease channel (upload push to master) | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: | | |
conda activate hexrd | |
anaconda --token ${{ secrets.ANACONDA_TOKEN }} upload --force --user HEXRD --label hexrd-prerelease output/**/*.tar.bz2 | |
# This is need to ensure ~/.profile or ~/.bashrc are used so the activate | |
# command works. | |
shell: bash -l {0} | |
- name: Get version for the artifact names | |
run: echo "HEXRD_GIT_DESCRIBE=$(git describe --tag)" >> $GITHUB_ENV | |
- name: Upload the package to github | |
uses: actions/upload-artifact@v2 | |
with: | |
name: HEXRD-${{ matrix.config.name }}-${{ env.HEXRD_GIT_DESCRIBE }}.tar.bz2 | |
path: output/**/*.tar.bz2 |