Skip to content

Merge pull request #210 from neutrons/check-missing-props #220

Merge pull request #210 from neutrons/check-missing-props

Merge pull request #210 from neutrons/check-missing-props #220

name: Tests, Package, and Deployment
on:
workflow_dispatch:
pull_request:
push:
branches: [next, qa, main]
tags: ["v*"]
env:
PKG_NAME: refred
jobs:
tests:
runs-on: ubuntu-24.04
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Pixi
uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.49.0
- name: mypy type annotations
run: pixi run mypy src/${{ env.PKG_NAME }} test
- name: Unit test with code coverage
run: pixi run test -vv --cov=${{ env.PKG_NAME }} --cov-report=xml --cov-report=term
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
verbose: true
token: ${{ secrets.CODECOV_TOKEN }} # required
build:
runs-on: ubuntu-24.04
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 100
fetch-tags: true
ref: ${{ github.ref }}
- name: Setup Pixi
uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.49.0
- name: Build Conda package
run: |
pixi run conda-build
mkdir -p /tmp/local-channel/linux-64
cp *.conda /tmp/local-channel/linux-64
- name: Verify conda package
uses: neutrons/conda-verify@main
with:
package-name: refred
local-channel: /tmp/local-channel
python-version: "3.11"
extra-channels: mantid neutrons
extra-commands: pixi run python -c "import lr_reduction; import mantid; import qtpy; import configobj"
- name: Upload conda package as artifact
uses: actions/upload-artifact@v6
if: startsWith(github.ref, 'refs/tags/v')
with:
name: artifact-conda-package
path: ${{ env.PKG_NAME }}-*.conda
publish:
runs-on: ubuntu-24.04
needs: [tests, build]
if: startsWith(github.ref, 'refs/tags/v')
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 100
fetch-tags: true
ref: ${{ github.ref }}
- name: Setup Pixi
uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.49.0
- name: Download conda package artifact
uses: actions/download-artifact@v7
with:
name: artifact-conda-package
- name: Upload package to anaconda
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 ${{ env.PKG_NAME }}-*.conda