Skip to content

Commit 4e15abf

Browse files
Run mvesuvio before uploading package
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)
1 parent 379732f commit 4e15abf

File tree

3 files changed

+35
-12
lines changed

3 files changed

+35
-12
lines changed

.github/actions/publish-pypi-package/action.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,26 @@ runs:
1414
shell: bash -l {0}
1515
run: |
1616
conda config --set always_yes yes --set changeps1 no
17-
conda create -n build-env-pypi python=3.10.*
18-
conda activate build-env-pypi
19-
mamba install -c conda-forge python-build twine
17+
conda create -n build-env-pypi -c conda-forge python=3.10.* python-build twine
2018
2119
- name: Build package
2220
shell: bash -l {0}
2321
run: |
2422
conda activate build-env-pypi
2523
python -m build
24+
conda deactivate
25+
26+
- name: Test basic functunality of mvesuvio
27+
shell: bash -l {0}
28+
run: |
29+
mamba create -n mvesuvio-test
30+
conda activate mvesuvio-test
31+
pip install dist/*.whl
32+
mvesuvio config
33+
conda deactivate
34+
35+
- name: Upload to PyPI
36+
shell: bash -l {0}
37+
run: |
38+
conda activate build-env-pypi
2639
twine upload -u __token__ -p ${{ inputs.token }} dist/*

.github/workflows/deploy_conda_nightly.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: Deploy mvesuvio nightly
22

3-
on:
4-
workflow_run:
5-
workflows: ["mvesuvio nightly build"]
6-
branches: [main]
7-
types:
8-
- completed
3+
on: push
4+
# workflow_run:
5+
# workflows: ["mvesuvio nightly build"]
6+
# branches: [main]
7+
# types:
8+
# - completed
99

1010
jobs:
1111
build_conda_and_upload:
@@ -24,8 +24,9 @@ jobs:
2424
- name: Check for changes since last build
2525
run: |
2626
echo "recentCommits=$(test -z $(git log --since="yesterday" -1 --format=%h) && echo false || echo true)" >> $GITHUB_ENV
27+
2728
- name: Setup Miniconda
28-
if: ${{ env.recentCommits == 'true'}}
29+
# if: ${{ env.recentCommits == 'true'}}
2930
uses: conda-incubator/setup-miniconda@v2.2.0
3031
with:
3132
miniforge-version: latest
@@ -35,14 +36,14 @@ jobs:
3536
auto-activate-base: false
3637

3738
- name: Build mvesuvio nightly conda package
38-
if: ${{ env.recentCommits == 'true'}}
39+
# if: ${{ env.recentCommits == 'true'}}
3940
uses: ./.github/actions/publish-conda-package
4041
with:
4142
label: nightly
4243
token: ${{ secrets.ANACONDA_API_TOKEN }}
4344

4445
- name: Build mvesuvio nightly PyPI package
45-
if: ${{ env.recentCommits == 'true'}}
46+
# if: ${{ env.recentCommits == 'true'}}
4647
uses: ./.github/actions/publish-pypi-package
4748
with:
4849
token: ${{ secrets.PYPI_API_TOKEN }}

conda/meta.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ requirements:
3434
test:
3535
imports:
3636
- mvesuvio
37+
requires:
38+
- pytest
39+
- mock
40+
source_files:
41+
- tests/unit/
42+
- tools/
43+
commands:
44+
- pytest
45+
- mvesuvio config
3746

3847
about:
3948
home: https://github.com/mantidproject/vesuvio

0 commit comments

Comments
 (0)