Make and upload Conda packages #60
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: Make and upload Conda packages | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
schedule: | |
# - cron: '0-59/5 * * * *' # Every 5 minutes | |
- cron: '0 00 * * 0' # Weekly, 12AM Sundays UTC | |
env: | |
ANACONDA_USER: rydiqule | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { os: ubuntu-latest, python: '3.11', arch: x64} | |
- { os: ubuntu-latest, python: '3.10', arch: x64 } | |
- { os: ubuntu-latest, python: '3.9', arch: x64 } | |
- { os: ubuntu-latest, python: '3.8', arch: x64 } | |
- { os: macos-13, python: '3.11', arch: x64 } | |
- { os: macos-13, python: '3.10', arch: x64 } | |
- { os: macos-13, python: '3.9', arch: x64 } | |
- { os: macos-13, python: '3.8', arch: x64 } | |
- { os: macos-latest, python: '3.11', arch: arm64} | |
- { os: macos-latest, python: '3.10', arch: arm64} | |
- { os: macos-latest, python: '3.9', arch: arm64} | |
- { os: windows-latest, python: '3.11', arch: x64 } | |
- { os: windows-latest, python: '3.10', arch: x64 } | |
- { os: windows-latest, python: '3.9', arch: x64 } | |
- { os: windows-latest, python: '3.8', arch: x64 } | |
if: github.repository == 'QTC-UMD/rydiqule-vendored-conda-builds' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Checkout latest tag | |
if: github.event_name == 'schedule' | |
shell: bash -l {0} | |
run: git checkout $(git describe --tags `git rev-list --tags --max-count=1`) | |
- name: Set BUILD_NOARCH=true | |
if: strategy.job-index == 0 | |
shell: bash -l {0} | |
run: echo "BUILD_NOARCH=true" >> $GITHUB_ENV | |
- name: Install Miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.python }} | |
architecture: ${{ matrix.arch }} | |
miniconda-version: "latest" | |
- name: Configure xcode | |
if: runner.os == 'macOS' | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
# osx-arm64 build of setuptools-conda not available on channel yet, building locally | |
# setuptools 69(.5.1?) has bug that prevents local build from succeeding | |
# osx-arm64 needs different compiler args | |
- name: Conda package (macOS-arm64) | |
if: runner.os == 'macOS' && matrix.arch == 'arm64' | |
shell: bash -l {0} | |
run: | | |
export CC='gcc-13' | |
git clone https://github.com/chrisjbillington/setuptools-conda | |
cd setuptools-conda/ | |
python -m setuptools_conda build --setup-requires='setuptools<69.5,wheel,setuptools_scm,importlib_metadata,distlib,toml,conda-build,conda-verify,ripgrep' . | |
python -m conda_index ./conda_packages | |
conda install conda_packages/osx-arm64/setuptools-conda-*.tar.bz2 | |
cd .. | |
python make_packages.py ${{ runner.temp }} | |
- name: Conda package (Unix) | |
if: runner.os != 'Windows' && matrix.arch != 'arm64' | |
shell: bash -l {0} | |
run: | | |
conda install -c labscript-suite setuptools-conda | |
python make_packages.py ${{ runner.temp }} | |
- name: Conda Package (Windows) | |
if: runner.os == 'Windows' | |
shell: cmd /C CALL {0} | |
run: | | |
conda install -c labscript-suite setuptools-conda && ^ | |
python make_packages.py ${{ runner.temp }} | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: # v4 requires all artifact names are unique on upload | |
name: conda_packages-${{ matrix.os }}-py${{ matrix.python }}-${{ matrix.arch }} | |
path: ./conda_packages | |
upload: | |
name: Upload | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download All Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: conda_packages-* | |
path: ./conda_packages | |
merge-multiple: true | |
- name: Install Miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-update-conda: true | |
- name: Install cloud client | |
shell: bash -l {0} | |
run: conda install anaconda-client | |
# - name: Publish to Anaconda test label | |
# if: github.event.ref_type != 'tag' && github.event_name != 'schedule' | |
# shell: bash -l {0} | |
# run: | | |
# anaconda \ | |
# --token ${{ secrets.ANACONDA_API_TOKEN }} \ | |
# upload \ | |
# --user $ANACONDA_USER \ | |
# --label test \ | |
# --skip-existing \ | |
# conda_packages/*/* | |
- name: Publish to Anaconda main label | |
if: (github.event_name == 'push' && contains(github.ref, '/tags')) || github.event_name == 'schedule' | |
shell: bash -l {0} | |
run: | | |
anaconda \ | |
--token ${{ secrets.ANACONDA_API_TOKEN }} \ | |
upload \ | |
--user $ANACONDA_USER \ | |
--skip-existing \ | |
conda_packages/*/* |