Pace-Integration Checks #71
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pace-Integration Checks | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
types: [opened, reopened, synchronize] | |
workflow_dispatch: | |
inputs: | |
jenkins_url: | |
type: string | |
default: "" | |
description: jenkins_url (For use by Horace-Jenkins) | |
jenkins_id: | |
type: string | |
default: "" | |
description: jenkins_id (For use by Horace-Jenkins) | |
jobs: | |
notify_pending: | |
if: ${{ inputs.jenkins_url != '' && inputs.jenkins_id != '' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Notify Jenkins pending | |
run: | | |
export turl="https://github.com/pace-neutrons/pace-integration/actions/runs/${{ github.run_id }}" | |
curl -L -X POST \ | |
-H "Authorization: Bearer ${{ secrets.JENKINS_GH_TOKEN }}" \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
-d '{"state": "pending", "description": "Running integration test", "target_url": "${{ env.turl }}", "context": "PACE_integration"}' \ | |
${{ inputs.jenkins_url }} | |
test: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
matlab_version: [R2022b, R2023b, R2024a] | |
python_version: ["3.10"] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out pace-integration | |
uses: actions/checkout@v4 | |
- name: Set up MATLAB | |
uses: matlab-actions/setup-matlab@v2 | |
with: | |
release: ${{ matrix.matlab_version }} | |
# Cannot run matlab directly from the setup (gives license error) need to download a runner with the run-command actions | |
- name: Download Matlab command runner | |
uses: matlab-actions/run-command@v2 | |
with: | |
command: "ver" | |
- name: Set up Python environment | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install psutil numpy brille requests wheel | |
git clone --depth 1 https://github.com/spinw/spinw spinw_git | |
chmod 755 ./tools/run_gh_matlab.sh | |
- name: Build euphonic | |
run: | | |
git clone --depth 1 https://github.com/pace-neutrons/euphonic euphonic.git | |
cd euphonic.git | |
python -m pip install . | |
cd .. | |
git clone --depth 1 https://github.com/pace-neutrons/horace-euphonic-interface | |
cd horace-euphonic-interface | |
git submodule update --init euphonic_sqw_models | |
git submodule update --init light_python_wrapper | |
python create_mltbx.py | |
cd mltbx | |
echo "EUPHONIC_TOOLBOX=$(pwd)" >> $GITHUB_ENV | |
../../tools/run_gh_matlab.sh create_mltbx | |
cp horace_euphonic_interface.mltbx ../../ | |
- name: Build Horace-master | |
run: | | |
if [[ "${{ inputs.jenkins_id }}" == "" ]] | |
then | |
git clone --depth 1 https://github.com/pace-neutrons/horace horace_git | |
cd horace_git | |
else | |
# Using sparse checkout for a specific SHA | |
mkdir horace_git | |
cd horace_git | |
git init | |
git remote add origin https://github.com/pace-neutrons/horace | |
git fetch origin ${{ inputs.jenkins_id }} | |
git checkout FETCH_HEAD | |
fi | |
echo "HORACE_PATH=$(pwd)" >> $GITHUB_ENV | |
./tools/build_config/build.sh -b | |
cd ./../ | |
- name: Run spinw test | |
run: | | |
export HORACE_PATH=${{ env.HORACE_PATH }} | |
./tools/run_gh_matlab.sh "run('validate_horace_spinW_matlab_interface')" | |
# Brille not integrated into SpinW properly yet - skip the test for now | |
#- name: Run brille test | |
# run: | | |
# python brille_spinwaves/get_brille_toolbox.py | |
# export PYTHON_EX_PATH=`which python` | |
# ./run_gh_matlab.sh "run('brille_spinwaves/run_spinw_brille_test.m')" | |
- name: Run euphonic test | |
run: | | |
export PYTHON_EX_PATH=`which python` | |
export HORACE_PATH=${{ env.HORACE_PATH }} | |
export EUPHONIC_TOOLBOX=${{ env.EUPHONIC_TOOLBOX}} | |
./tools/run_gh_matlab.sh setup_and_run_euphonic_tests | |
#- name: Setup tmate | |
# if: ${{ failure() }} | |
# uses: mxschmitt/action-tmate@v3 | |
# if: always() | |
notify_success: | |
if: ${{ inputs.jenkins_url != '' && inputs.jenkins_id != '' }} | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Notify Jenkins pending | |
run: | | |
export turl="https://github.com/pace-neutrons/pace-integration/actions/runs/${{ github.run_id }}" | |
curl -L -X POST \ | |
-H "Authorization: Bearer ${{ secrets.JENKINS_GH_TOKEN }}" \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
-d '{"state": "success", "description": "Integration test passed", "target_url": "${{ env.turl }}", "context": "PACE_integration"}' \ | |
${{ inputs.jenkins_url }} |