Skip to content

Commit

Permalink
Change pr github workflow
Browse files Browse the repository at this point in the history
There were several changes in this commit:

- The host for running the job changed from self-hosted to
  ubuntu-latest. This falls in line with the GitHub recommendation to
  use the default ubuntu-latest for non-private repos. The host was
  made self-hosted because before the system tests exceeded GitHub's
  limit. The running time was decreased in a previous commit so using
  ubuntu-latest is now a viable option.
- Removed some unnecessary comments.
- Added steps that check whether analysis or calibration files were
  changed using git diff. The result of the check is stored in
  environment variables analysis-changed and calibration-changed.
- Calibration and analysis tests check the stored environment variables
  and run accordingly.
  • Loading branch information
GuiMacielPereira committed Jul 22, 2024
1 parent 5910398 commit 960c86f
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/pr_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: push

jobs:
test:
runs-on: self-hosted
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
Expand All @@ -16,7 +16,7 @@ jobs:

# Set up conda environnment
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2.2.0
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
miniforge-variant: Mambaforge
Expand All @@ -27,27 +27,37 @@ jobs:
- name: Flake8
run: python -m flake8 --config=config.flake8

# Remove `export MANTIDPROPERTIES=$(pwd)/Mantid.user.properties` when updated to mantid > 6.8.0
- name: Install Git
run: mamba install -y git

- name: Install mvesuvio package
run: pip install .

# Runs Unit tests
- name: Check for analysis files changed
run: |
echo "analysis-changed=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q '^src/' && echo true || echo false)" >> $GITHUB_ENV
- name: Check for calibration files changed
run: |
echo "calibration-changed=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q '^tools/calibration_scripts/' && echo true || echo false)" >> $GITHUB_ENV
- name: Run mvesuvio Analysis Unit Tests
if: ${{ env.analysis-changed == 'true'}}
run: |
export MANTIDPROPERTIES=$(pwd)/Mantid.user.properties
python -m unittest discover -s ./tests/analysis/unit
# Runs System tests
- name: Run mvesuvio Analysis System Tests
if: ${{ env.analysis-changed == 'true'}}
run: |
python -m unittest discover -s ./tests/analysis/system
- name: Run mvesuvio Calibration Unit Tests
if: ${{ env.calibration-changed == 'true'}}
run: |
export MANTIDPROPERTIES=$(pwd)/Mantid.user.properties
python -m unittest discover -s ./tests/calibration/unit
- name: Run Vesuvio Calibration System Tests
if: ${{ env.calibration-changed == 'true'}}
run: |
python -m unittest discover -s ./tests/calibration/system
Expand Down

0 comments on commit 960c86f

Please sign in to comment.