Skip to content

Reduction process: effective-instrument geometry. #3732

Reduction process: effective-instrument geometry.

Reduction process: effective-instrument geometry. #3732

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
push:
branches: [main, qa, next]
tags: ['v*']
jobs:
tests:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Set up MicroMamaba
uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: '1.5.10-0'
environment-file: environment.yml
condarc: |
channels:
- conda-forge
- default
- mantid/label/nightly
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
- name: Apt install deps
run: |
sudo apt update
sudo apt-get install xvfb
- name: Start xvfb daemon
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
- name: Test with pytest
run: |
xvfb-run --server-args="-screen 0 1280x1024x16" -a python -m pytest --cov=src --cov-report=xml --cov-report=term -m "not integration"
- name: Upload coverage reports
uses: codecov/codecov-action@v5
if:
github.actor != 'dependabot[bot]'
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }} # required
# - name: mypy checks
# shell: bash -l {0}
# run: |
# python -m mypy --config-file=$(pwd)/pyproject.toml $(pwd)
- name: Gui tests
run: |
python -m pip install -e . # install the application in editable mode
env=tests/resources/headcheck.yml xvfb-run --server-args="-screen 0 1280x1024x16" --auto-servernum snapred --headcheck
integration-tests:
runs-on: snapred-builder
defaults:
run:
shell: bash -l {0}
steps:
- name: Cleanup MicroMamba
run: |
sudo rm -rf /home/cloud/micromamba-bin/micromamba
- uses: actions/checkout@v4
with:
submodules: true
lfs: true
- name: Set up MicroMamaba
uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: '1.5.10-0'
environment-file: environment.yml
condarc: |
channels:
- conda-forge
- default
- mantid/label/nightly
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
post-cleanup: all
- name: DNF install deps
run: |
sudo dnf makecache --refresh
sudo yum -y install xorg-x11-server-Xvfb
- name: Test with pytest
run: |
env=tests/resources/integration_test xvfb-run --server-args="-screen 0 1280x1024x16" -a python -m pytest -m "datarepo and integration" --cov=src --cov-report=xml --cov-report=term
- name: Upload coverage reports
uses: codecov/codecov-action@v5
if:
github.actor != 'dependabot[bot]'
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }} # required
conda-build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8"]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Set up MicroMamaba
uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: '1.5.10-0'
environment-file: environment.yml
condarc: |
channels:
- conda-forge
- default
- mantid/label/nightly
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/environment.yml') }}
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/environment.yml') }}
- name: Build conda libraray
shell: bash -l {0}
run: |
# set up environment
cd conda.recipe
echo "versioningit $(versioningit ../)"
# build the package
VERSION=$(versioningit ../) conda mambabuild --channel conda-forge --output-folder . .
conda verify noarch/snapred*.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/snapred*.tar.bz2
trigger-deploy:
runs-on: ubuntu-latest
needs: [tests, conda-build]
# only trigger deploys from protected branches and tags
if: ${{github.ref_protected || github.ref_type == 'tag' }}
steps:
- name: Determine Environment
uses: neutrons/branch-mapper@v2
id: conda_env_name
with:
prefix: snapred
- name: Trigger deploy
id: trigger
uses: eic/trigger-gitlab-ci@v3
with:
url: https://code.ornl.gov
token: ${{ secrets.GITLAB_TRIGGER_TOKEN }}
ref_name: main
project_id: 7835
variables: |
PLAY="update"
CONDA_ENV="${{ steps.conda_env_name.outputs.name }}"