Skip to content

update conda builda and verify steps #459

update conda builda and verify steps

update conda builda and verify steps #459

Workflow file for this run

name: Pixi Packaging and Deployment
on:
workflow_dispatch:
push:
branches: [main]
tags: ['v*']
pull_request:
# Run on pull requests targeting any base branch
jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for accurate versioning
fetch-tags: true # Fetch tags to ensure versioning works correctly
- uses: prefix-dev/setup-pixi@v0.8.8
with:
pixi-version: v0.41.4
manifest-path: pyproject.toml
- name: build pypi package
run: |
pixi run build-pypi
- name: build conda package
run: |
pixi run build-conda
mkdir -p /tmp/local-channel/noarch
mkdir -p /tmp/local-channel/linux-64
cp *.conda /tmp/local-channel/noarch/
cp *.conda /tmp/local-channel/linux-64/
# extract version from the package file name "snapred-<version>-<build>.conda"
echo "PKG_VERSION=$(ls *.conda | cut -d'-' -f2)" >> $GITHUB_ENV
- name: Verify Conda Package
uses: neutrons/conda-verify@v0.1.2
with:
python-version: "3.11"
local-channel: /tmp/local-channel
package-name: ${{ env.PKG_NAME }}=${{ env.PKG_VERSION }} # install exact version
extra-channels: neutrons mantid oncat conda-forge
extra-commands: |
python -c "import snapred"
python -c "import mantid"
- name: upload conda package to anaconda
if: startsWith(github.ref, 'refs/tags/v')
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
IS_RC: ${{ contains(github.ref, 'rc') }}
run: |
# label is main or rc depending on the tag-name
CONDA_LABEL="main"
if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi
echo pushing ${{ github.ref }} with label $CONDA_LABEL
pixi run anaconda upload --label $CONDA_LABEL --user neutrons snapred-*.conda
trigger-deploy:
runs-on: ubuntu-latest
needs: [linux]
# only trigger deploys from protected branches and tags
if: ${{github.ref_protected || github.ref_type == 'tag' }}
steps:
- name: Determine Environment
uses: neutrons/branch-mapper@v2
id: conda_env_name
with:
prefix: snapred
- name: Trigger deploy
id: trigger
uses: eic/trigger-gitlab-ci@v3
with:
url: https://code.ornl.gov
token: ${{ secrets.GITLAB_TRIGGER_TOKEN }}
ref_name: main
project_id: 7835
variables: |
PLAY="update"
CONDA_ENV="${{ steps.conda_env_name.outputs.name }}"