Skip to content

Commit

Permalink
Run mvesuvio before uploading package
Browse files Browse the repository at this point in the history
During the nightly deployment workflow, it's best to test
the basic functunality of config and make sure that
at least this command does not give an error.

In the case of conda, this is best done in the conda recipe,
by adding a test section that runs the command for config.
(Also added command to run unit tests)
  • Loading branch information
GuiMacielPereira committed Dec 3, 2024
1 parent 379732f commit 4e15abf
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
19 changes: 16 additions & 3 deletions .github/actions/publish-pypi-package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,26 @@ runs:
shell: bash -l {0}
run: |
conda config --set always_yes yes --set changeps1 no
conda create -n build-env-pypi python=3.10.*
conda activate build-env-pypi
mamba install -c conda-forge python-build twine
conda create -n build-env-pypi -c conda-forge python=3.10.* python-build twine
- name: Build package
shell: bash -l {0}
run: |
conda activate build-env-pypi
python -m build
conda deactivate
- name: Test basic functunality of mvesuvio
shell: bash -l {0}
run: |
mamba create -n mvesuvio-test
conda activate mvesuvio-test
pip install dist/*.whl
mvesuvio config
conda deactivate
- name: Upload to PyPI
shell: bash -l {0}
run: |
conda activate build-env-pypi
twine upload -u __token__ -p ${{ inputs.token }} dist/*
19 changes: 10 additions & 9 deletions .github/workflows/deploy_conda_nightly.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Deploy mvesuvio nightly

on:
workflow_run:
workflows: ["mvesuvio nightly build"]
branches: [main]
types:
- completed
on: push
# workflow_run:
# workflows: ["mvesuvio nightly build"]
# branches: [main]
# types:
# - completed

jobs:
build_conda_and_upload:
Expand All @@ -24,8 +24,9 @@ jobs:
- name: Check for changes since last build
run: |
echo "recentCommits=$(test -z $(git log --since="yesterday" -1 --format=%h) && echo false || echo true)" >> $GITHUB_ENV
- name: Setup Miniconda
if: ${{ env.recentCommits == 'true'}}
# if: ${{ env.recentCommits == 'true'}}
uses: conda-incubator/[email protected]
with:
miniforge-version: latest
Expand All @@ -35,14 +36,14 @@ jobs:
auto-activate-base: false

- name: Build mvesuvio nightly conda package
if: ${{ env.recentCommits == 'true'}}
# if: ${{ env.recentCommits == 'true'}}
uses: ./.github/actions/publish-conda-package
with:
label: nightly
token: ${{ secrets.ANACONDA_API_TOKEN }}

- name: Build mvesuvio nightly PyPI package
if: ${{ env.recentCommits == 'true'}}
# if: ${{ env.recentCommits == 'true'}}
uses: ./.github/actions/publish-pypi-package
with:
token: ${{ secrets.PYPI_API_TOKEN }}
9 changes: 9 additions & 0 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ requirements:
test:
imports:
- mvesuvio
requires:
- pytest
- mock
source_files:
- tests/unit/
- tools/
commands:
- pytest
- mvesuvio config

about:
home: https://github.com/mantidproject/vesuvio
Expand Down

0 comments on commit 4e15abf

Please sign in to comment.