Skip to content

Update for pip install #14

Update for pip install

Update for pip install #14

name: conda
on:
release:
types: [published]
pull_request:
paths:
- "buildscripts/conda-recipes/**"
- ".github/workflows/build-upload-conda.yml"
- "src/**"
- setup.py
- MANIFEST.in
- pyproject.toml
workflow_dispatch:
jobs:
# Job to deploy pyomp conda matrixed on os and python version.
deploy-conda:
name: ${{ matrix.os }} ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
env:
CONDA_LABEL: dev
strategy:
matrix:
# TODO: Add windows.
os: [ubuntu-latest, macos-latest, ubuntu-24.04-arm]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Determine conda label
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "CONDA_LABEL=dev" >> $GITHUB_ENV
elif [[ "${{ github.event_name }}" == "release" && "${{ github.event.release.prerelease }}" == "true" ]]; then
echo "CONDA_LABEL=test" >> $GITHUB_ENV
else
echo "CONDA_LABEL=main" >> $GITHUB_ENV
fi
- uses: actions/checkout@v4
# Checkout the repo with history to get the commit hash for the build
# string.
with:
fetch-depth: 0
- name: Create and activate conda env
uses: conda-incubator/setup-miniconda@v3
with:
python-version: "3.10"
auto-update-conda: false
show-channel-urls: true
- name: Build and upload pyomp
# This ensures conda env is active.
shell: bash -l {0}
run: |
# Setup the anaconda environment.
conda remove --name base conda-anaconda-telemetry
conda install -q -y -c conda-forge conda-build conda-verify anaconda-client
conda config --set anaconda_upload no
# Build the package.
conda build \
-c conda-forge \
--python ${{ matrix.python-version }} \
buildscripts/conda-recipes/pyomp
# Get the output file path.
OUTPUT=$(conda build -c conda-forge --output \
--python ${{ matrix.python-version }} \
buildscripts/conda-recipes/pyomp)
# Upload the package.
anaconda -t ${{ secrets.ANACONDA_TOKEN }} upload \
--user python-for-hpc --label ${{ env.CONDA_LABEL}} \
--force "$OUTPUT"
deploy-containers:
needs: deploy-conda
if: github.event_name == 'release' && !github.event.release.prerelease
uses: ./.github/workflows/build-containers.yml
secrets: inherit