From c6e1db7decca1fd215cad9daee26b4f1f6a9d5d0 Mon Sep 17 00:00:00 2001 From: MialLewis <95620982+MialLewis@users.noreply.github.com> Date: Wed, 20 Dec 2023 18:02:41 +0000 Subject: [PATCH] add nightly workflow --- .github/actions/publish-package/action.yml | 37 +++++++++++++++++++ .github/workflows/ci_tests_nightly.yml | 37 +++++++++++++++++++ .github/workflows/deploy_conda_nightly.yml | 42 ++++++++++++++++++++++ .github/workflows/pr_workflow.yml | 3 +- 4 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 .github/actions/publish-package/action.yml create mode 100644 .github/workflows/ci_tests_nightly.yml create mode 100644 .github/workflows/deploy_conda_nightly.yml diff --git a/.github/actions/publish-package/action.yml b/.github/actions/publish-package/action.yml new file mode 100644 index 00000000..183d390b --- /dev/null +++ b/.github/actions/publish-package/action.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/ci_tests_nightly.yml b/.github/workflows/ci_tests_nightly.yml new file mode 100644 index 00000000..92bc129c --- /dev/null +++ b/.github/workflows/ci_tests_nightly.yml @@ -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/setup-miniconda@v2.2.0 + 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 \ No newline at end of file diff --git a/.github/workflows/deploy_conda_nightly.yml b/.github/workflows/deploy_conda_nightly.yml new file mode 100644 index 00000000..2001c997 --- /dev/null +++ b/.github/workflows/deploy_conda_nightly.yml @@ -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 MSlice + 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/setup-miniconda@v2.2.0 + 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 }} \ No newline at end of file diff --git a/.github/workflows/pr_workflow.yml b/.github/workflows/pr_workflow.yml index 1e6a3c64..6a4ef6fe 100644 --- a/.github/workflows/pr_workflow.yml +++ b/.github/workflows/pr_workflow.yml @@ -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