Skip to content

Commit

Permalink
Merge pull request #92 from mantidproject/add_publish_workflow
Browse files Browse the repository at this point in the history
Add nightly workflow to publish mvesuvio
  • Loading branch information
MialLewis authored Dec 20, 2023
2 parents d3f0187 + 64d70a0 commit af24145
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 2 deletions.
37 changes: 37 additions & 0 deletions .github/actions/publish-package/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and upload conda package

inputs:
repository:
description: 'Anaconda repository'
required: true
default: 'mantid'
label:
description: 'Label'
required: false
default: 'nightly'
token:
description: 'Anaconda API Token'
required: true

description: Build and upload conda package
runs:
using: "composite"

steps:
- name: Make build-env
shell: bash -l {0}
run: |
conda config --set always_yes yes --set changeps1 no
conda create -n build-env python=3.8.*
conda activate build-envn
mamba install -c conda-forge mamba conda-build anaconda-client conda-verify
conda config --add channels mantid
conda config --add channels mantid/label/nightly
- name: Build package
shell: bash -l {0}
run: |
conda activate build-env
conda config --set anaconda_upload yes
conda build --user ${{ inputs.repository }} --token ${{ inputs.token }} --label ${{ inputs.label }} $GITHUB_WORKSPACE/conda |& tee upload.log
grep "Upload complete" upload.log
37 changes: 37 additions & 0 deletions .github/workflows/ci_tests_nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: mvesuvio nightly build

on:
schedule:
- cron: '0 2 * * *'

jobs:
test:
runs-on: self-hosted
defaults:
run:
shell: bash -l {0}

steps:
- name: Checkout mvesuvio
uses: actions/checkout@v3

- name: Setup Miniconda
uses: conda-incubator/[email protected]
with:
miniforge-version: latest
miniforge-variant: Mambaforge
activate-environment: mvesuvio-env
environment-file: environment.yml
auto-activate-base: false

# Runs Unit tests
- name: Run mvesuvio analysis unit tests
run: |
export MANTIDPROPERTIES=$(pwd)/Mantid.user.properties
python -m unittest discover -s ./EVSVesuvio/vesuvio_analysis/tests
# Runs System tests
- name: Run mvesuvio analysis system tests
run: |
export VESUVIOPROPERTIES=$(pwd)/EVSVesuvio/system_tests/test_config/vesuvio.user.properties
python -m unittest discover -s ./EVSVesuvio/system_tests
42 changes: 42 additions & 0 deletions .github/workflows/deploy_conda_nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy mvesuvio nightly

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

jobs:
build_conda_and_upload:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}

steps:
- name: Checkout mvesuvio
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main

- 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'}}
uses: conda-incubator/[email protected]
with:
miniforge-version: latest
miniforge-variant: Mambaforge
activate-environment: vesuvio-env
environment-file: environment.yml
auto-activate-base: false

- name: Build mvesuvio nightly conda package
if: ${{ env.recentCommits == 'true'}}
uses: ./.github/actions/publish-package
with:
label: nightly
token: ${{ secrets.ANACONDA_API_TOKEN }}
3 changes: 1 addition & 2 deletions .github/workflows/pr_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ jobs:

# Set up conda environnment
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2.1.1
uses: conda-incubator/setup-miniconda@v2.2.0
with:
miniforge-version: latest
miniforge-variant: Mambaforge
activate-environment: vesuvio-env
environment-file: environment.yml
python-version: 3.8
auto-activate-base: false

- name: Flake8
Expand Down

0 comments on commit af24145

Please sign in to comment.