Merge pull request #411 from neutrons/new_calib #442
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: addie_ci | |
env: | |
TRIGGER_URL: "https://code.ornl.gov/api/v4/projects/5749/trigger/pipeline" | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: [next] | |
tags: ['v*'] | |
jobs: | |
linux: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04] | |
python-version: ["3.8"] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
miniforge-version: latest | |
python-version: ${{ matrix.python-version }} | |
environment-file: environment.yml | |
- name: Apt install deps | |
run: | | |
sudo apt update | |
sudo apt-get install xvfb freeglut3-dev libglu1-mesa | |
- name: Mantid pre-requisites | |
shell: bash -l {0} | |
run: | | |
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16 | |
mkdir ~/.mantid | |
echo "CheckMantidVersion.OnStartup=0" > ~/.mantid/Mantid.user.properties | |
echo "UpdateInstrumentDefinitions.OnStartup=0" >> ~/.mantid/Mantid.user.properties | |
echo "usagereports.enabled=0" >> ~/.mantid/Mantid.user.properties | |
export DISPLAY=:99.0 | |
sleep 3 | |
- name: Lint | |
shell: bash -l {0} | |
run: flake8 . --count | |
- name: Test | |
shell: bash -l {0} | |
run: | | |
python -c "import mantid" | |
python -c "import qtpy" | |
python -c "import mantidqt" | |
xvfb-run --server-args="-screen 0 640x480x24" --auto-servernum mantidworkbench --help | |
echo "import time;time.sleep(5)" > workbenchshutdown.py | |
xvfb-run --auto-servernum pytest --mpl tests | |
- name: Build python wheel # cannot be used without mantid | |
shell: bash -l {0} | |
run: | | |
python3 -m pip install setuptools==48.0.0 | |
pip install check-wheel-contents | |
python -m build --wheel --no-isolation | |
check-wheel-contents dist/addie-*.whl # currently bad package | |
- name: Build conda libraray | |
shell: bash -l {0} | |
run: | | |
# set up environment | |
python3 -m pip install setuptools==47.0.0 | |
conda install -y anaconda-client conda-build conda-verify boa | |
cd conda.recipe | |
echo "versioningit $(versioningit ../)" | |
# build the package | |
VERSION=$(versioningit ../) conda mambabuild --output-folder . . -c neutrons -c mantid | |
conda verify noarch/addie*.tar.bz2 | |
- name: Deploy to Anaconda | |
shell: bash -l {0} | |
if: startsWith(github.ref, 'refs/tags/v') | |
env: | |
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
IS_RC: ${{ contains(github.ref, 'rc') }} | |
run: | | |
# label is main or rc depending on the tag-name | |
CONDA_LABEL="main" | |
if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi | |
echo pushing ${{ github.ref }} with label $CONDA_LABEL | |
anaconda upload --label $CONDA_LABEL conda.recipe/noarch/addie-*.tar.bz2 | |
trigger-deploy: | |
runs-on: ubuntu-22.04 | |
needs: [linux] | |
# only trigger deploys from protected branches | |
if: ${{ github.ref_protected || github.ref_type == 'tag' }} | |
steps: | |
- name: Determine Environment | |
uses: neutrons/branch-mapper@v2 | |
id: conda_env_name | |
with: | |
prefix: addie | |
- name: Trigger deploy | |
id: trigger | |
uses: eic/trigger-gitlab-ci@v2 | |
with: | |
url: https://code.ornl.gov | |
token: ${{ secrets.GITLAB_TRIGGER_TOKEN }} | |
project_id: 5749 | |
ref_name: master | |
variables: | | |
PLAY="update" | |
CONDA_ENV="${{ steps.conda_env_name.outputs.name }}" | |
- name: Annotate commit | |
uses: peter-evans/commit-comment@v2 | |
with: | |
body: | | |
GitLab pipeline for ${{ steps.conda_env_name.outputs.name }} has been submitted for this commit: ${{ steps.trigger.outputs.web_url }} |