-
Notifications
You must be signed in to change notification settings - Fork 18
127 lines (110 loc) · 4.12 KB
/
condatest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: condatest
on:
push:
pull_request:
schedule:
- cron: '30 18 * * 0' # 18:30 every Sunday
workflow_dispatch:
inputs:
manual-debugging:
type: boolean
description: Launch manual debugging tmate session on failure
default: false
# Workflow which pip installs and tests the source code in a conda environment
jobs:
build:
strategy:
#fail-fast: false
matrix:
include:
- { os: ubuntu-20.04 }
- { os: ubuntu-22.04 }
- { os: ubuntu-latest }
- { os: macos-latest }
- { os: macos-12 }
# - { os: macos-13 }
# - { os: macos-14 }
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -el {0}
env:
CONDA_SOLVER: libmamba
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: ./src_co
- name: Set up conda env
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: ncrystaltestenv
environment-file: ./src_co/.github/resources/conda_ncrystaltestenv.yml
auto-activate-base: false
- name: Inspect environment
run: |
conda info
conda list
set -x
cmake --version
#Ensure our environment did not get NCrystal installed by accident:
set +e
( python3 -c 'import NCrystal'; if [ $? == 0 ]; then exit 1; else exit 0; fi )
( which nctool >/dev/null; if [ $? == 0 ]; then exit 1; else exit 0; fi )
( which ncrystal-config >/dev/null; if [ $? == 0 ]; then exit 1; else exit 0; fi )
- name: Install NCrystal
run: |
#python3 -m pip install ncrystal --no-deps
#FIXME: Add --no-deps and add deps in ./src_co/.github/resources/conda_ncrystaltestenv.yml !!
python3 -m pip install ./src_co/ncrystal_core -vv
python3 -m pip install ./src_co/ncrystal_python -vv
#Cheating:
#conda install -c conda-forge ncrystal
- name: Basic NCrystal tests
run: |
set -eux
ncrystal-config --summary
nctool --test
python3 -c 'import NCrystal'
- name: Simple downstream compilation
run: |
set -eux
ncrystal-config --show libpath
ncrystal-config --show includedir
cc -std=c11 ${LDFLAGS} ${CFLAGS} ./src_co/examples/ncrystal_example_c.c -o ncex_c -Wl,-rpath,$(ncrystal-config --show libdir) $(ncrystal-config --show libpath) -I$(ncrystal-config --show includedir)
./ncex_c
c++ -std=c++17 ${LDFLAGS} ${CXXFLAGS} ./src_co/examples/ncrystal_example_cpp.cc -o ncex_cpp -Wl,-rpath,$(ncrystal-config --show libdir) $(ncrystal-config --show libpath) -I$(ncrystal-config --show includedir)
./ncex_cpp
- name: conda install mcstas-core
run: |
conda install -c conda-forge mcstas-core
- name: Run McStas NCrystal_example.instr
run: |
set -eux
mkdir mcstasrun
cd mcstasrun
cp "${CONDA_PREFIX}/share/mcstas/resources/examples/NCrystal/NCrystal_example/NCrystal_example.instr" .
mcrun NCrystal_example.instr sample_cfg=Al_sg225.ncmat -s1000 -n1e5
- name: Uninstall NCrystal and install conda-forge NCrystal
run: |
python3 -m pip uninstall --yes ncrystal
conda install -c conda-forge ncrystal
- name: Rerun McStas NCrystal_example.instr
run: |
set -eux
mkdir mcstasrun2
cd mcstasrun2
cp "${CONDA_PREFIX}/share/mcstas/resources/examples/NCrystal/NCrystal_example/NCrystal_example.instr" .
mcrun NCrystal_example.instr sample_cfg=Al_sg225.ncmat -s1000 -n1e5
#Final step, so tmate step can check if we got this far.
- name: Final
id: final-step
run: |
echo "All steps fine"
true
- name: Setup tmate session for manual debugging
uses: mxschmitt/action-tmate@v3
if: always() && inputs.manual-debugging == true && steps.final-step != 'success'
with:
limit-access-to-actor: true