Skip to content

Commit

Permalink
Revert "Temporarily remove some CI workflows"
Browse files Browse the repository at this point in the history
This reverts commit 47cd2c9.
  • Loading branch information
tkittel committed Aug 14, 2024
1 parent 2c51d59 commit 76791b5
Show file tree
Hide file tree
Showing 4 changed files with 395 additions and 0 deletions.
120 changes: 120 additions & 0 deletions .github/workflows/basictest_intel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: basictest_intel

on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: src

- name: add oneAPI to apt
run: |
cd /tmp
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
- name: apt update
run: sudo apt update

- name: install oneAPI dpcpp compiler
run: sudo apt install intel-oneapi-compiler-dpcpp-cpp

- name: Configure CMake
run: |
source /opt/intel/oneapi/setvars.sh
#NB: We could use
# -DCMAKE_CXX_COMPILER=icpx
# -DCMAKE_C_COMPILER=icx
#But just because it seems to be something that might be useful. we do:
export CC=$(which icx)
export CXX=$(which icpx)
cmake \
-S ${{github.workspace}}/src \
-B ${{github.workspace}}/build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \
-DNCRYSTAL_ENABLE_EXAMPLES=ON \
-DNCRYSTAL_BUILD_STRICT=ON
#Flags that we didn't need:
# -DIntelDPCPP_DIR="/opt/intel/oneapi/compiler/latest/linux/cmake/SYCL"
# -DNCRYSTAL_ENABLE_SETUPSH=ON
# -DMKL_ROOT="/opt/intel/oneapi/mkl/latest"
# -DTBB_ROOT="/opt/intel/oneapi/tbb/latest"

- name: Build
run: >
source /opt/intel/oneapi/setvars.sh &&
cmake
--build ${{github.workspace}}/build
--config Release
- name: Install
run: source /opt/intel/oneapi/setvars.sh && cmake --install ${{github.workspace}}/build

- name: install other python packages
run: sudo apt install python3-numpy

- name: Tests with eval ncrystal-config setup
run: |
source /opt/intel/oneapi/setvars.sh
set -eux
eval $(${{github.workspace}}/install/bin/ncrystal-config --setup)
ncrystal-config --summary
nctool --test
ncrystal-config --help
ncrystal_example_c
ncrystal_example_cpp
ncrystal_example_py
nctool --help
nctool --dump 'Al_sg225.ncmat;dcutoff=1.5'
python3 -c 'import NCrystal; NCrystal.test()'
ncrystal_vdos2ncmat --help
ncrystal_cif2ncmat --help
ncrystal_ncmat2cpp --help
ncrystal_hfg2ncmat --help
ncrystal_verifyatompos --help
#needs gemmi: ncrystal_cif2ncmat codid::9008460
ncrystal_ncmat2hkl --help
ncrystal_ncmat2hkl --format=laz 'Al_sg225.ncmat;temp=250K;dcutoff=0.75' -o test_Al.laz
ncrystal_ncmat2hkl --format=lau 'Al_sg225.ncmat;temp=250K;dcutoff=0.75' -o test_Al.lau
nctool -d ./test_Al.laz
nctool -d ./test_Al.lau
ncrystal_ncmat2cpp $(ncrystal-config --show=datadir)/Al_sg225.ncmat -o test.cpp
cat test.cpp
#NEEDS MATPLOTLIB: nctool --pdf Al_sg225.ncmat
#Examples from README:
cp ./src/examples/ncrystal_example_cpp.cc ./my_cpp_code.cpp
cp ./src/examples/ncrystal_example_c.c ./my_c_code.c
export LDFLAGS="${LDFLAGS:-} -Wl,-rpath,$(ncrystal-config --show libdir) $(ncrystal-config --show libpath)" &&
export CFLAGS="${CFLAGS:-} -I$(ncrystal-config --show includedir)" &&
export CXXFLAGS="${CXXFLAGS:-} -I$(ncrystal-config --show includedir)" &&
cc -std=c11 ${LDFLAGS} ${CFLAGS} my_c_code.c -o my_c_app &&
./my_c_app &&
c++ -std=c++17 ${LDFLAGS} ${CXXFLAGS} my_cpp_code.cpp -o my_cpp_app &&
./my_cpp_app &&
echo "Custom compilation of downstream C/C++ code succeeded"
eval $(ncrystal-config --unsetup)
# - name: install oneAPI MKL library
# run: |
# sudo apt install intel-oneapi-mkl-devel

#TK - name: Add Intel package sources
#TK run: |
#TK wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
#TK echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
#TK sudo apt update
#TK
#TK - name: Install Intel OneAPI Base Toolkit
#TK run: |
#TK sudo apt install intel-basekit
120 changes: 120 additions & 0 deletions .github/workflows/basictest_intelclassic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: basictest_intelclassic

on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: src

- name: add oneAPI to apt
run: |
cd /tmp
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
- name: apt update
run: sudo apt update

- name: install oneAPI dpcpp compiler
run: sudo apt install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic

- name: Configure CMake
run: |
source /opt/intel/oneapi/setvars.sh
#NB: We could use
# -DCMAKE_CXX_COMPILER=icpx
# -DCMAKE_C_COMPILER=icx
#But just because it seems to be something that might be useful. we do:
export CC=$(which icc)
export CXX=$(which icpc)
cmake \
-S ${{github.workspace}}/src \
-B ${{github.workspace}}/build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install \
-DNCRYSTAL_ENABLE_EXAMPLES=ON \
-DNCRYSTAL_BUILD_STRICT=ON
#Flags that we didn't need:
# -DIntelDPCPP_DIR="/opt/intel/oneapi/compiler/latest/linux/cmake/SYCL"
# -DNCRYSTAL_ENABLE_SETUPSH=ON
# -DMKL_ROOT="/opt/intel/oneapi/mkl/latest"
# -DTBB_ROOT="/opt/intel/oneapi/tbb/latest"

- name: Build
run: >
source /opt/intel/oneapi/setvars.sh &&
cmake
--build ${{github.workspace}}/build
--config Release
- name: Install
run: source /opt/intel/oneapi/setvars.sh && cmake --install ${{github.workspace}}/build

- name: install other python packages
run: sudo apt install python3-numpy

- name: Tests with eval ncrystal-config setup
run: |
source /opt/intel/oneapi/setvars.sh
set -eux
eval $(${{github.workspace}}/install/bin/ncrystal-config --setup)
ncrystal-config --summary
nctool --test
ncrystal-config --help
ncrystal_example_c
ncrystal_example_cpp
ncrystal_example_py
nctool --help
nctool --dump 'Al_sg225.ncmat;dcutoff=1.5'
python3 -c 'import NCrystal; NCrystal.test()'
ncrystal_vdos2ncmat --help
ncrystal_cif2ncmat --help
ncrystal_ncmat2cpp --help
ncrystal_hfg2ncmat --help
ncrystal_verifyatompos --help
#needs gemmi: ncrystal_cif2ncmat codid::9008460
ncrystal_ncmat2hkl --help
ncrystal_ncmat2hkl --format=laz 'Al_sg225.ncmat;temp=250K;dcutoff=0.75' -o test_Al.laz
ncrystal_ncmat2hkl --format=lau 'Al_sg225.ncmat;temp=250K;dcutoff=0.75' -o test_Al.lau
nctool -d ./test_Al.laz
nctool -d ./test_Al.lau
ncrystal_ncmat2cpp $(ncrystal-config --show=datadir)/Al_sg225.ncmat -o test.cpp
cat test.cpp
#NEEDS MATPLOTLIB: nctool --pdf Al_sg225.ncmat
#Examples from README:
cp ./src/examples/ncrystal_example_cpp.cc ./my_cpp_code.cpp
cp ./src/examples/ncrystal_example_c.c ./my_c_code.c
export LDFLAGS="${LDFLAGS:-} -Wl,-rpath,$(ncrystal-config --show libdir) $(ncrystal-config --show libpath)" &&
export CFLAGS="${CFLAGS:-} -I$(ncrystal-config --show includedir)" &&
export CXXFLAGS="${CXXFLAGS:-} -I$(ncrystal-config --show includedir)" &&
cc -std=c11 ${LDFLAGS} ${CFLAGS} my_c_code.c -o my_c_app &&
./my_c_app &&
c++ -std=c++17 ${LDFLAGS} ${CXXFLAGS} my_cpp_code.cpp -o my_cpp_app &&
./my_cpp_app &&
echo "Custom compilation of downstream C/C++ code succeeded"
eval $(ncrystal-config --unsetup)
# - name: install oneAPI MKL library
# run: |
# sudo apt install intel-oneapi-mkl-devel

#TK - name: Add Intel package sources
#TK run: |
#TK wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
#TK echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
#TK sudo apt update
#TK
#TK - name: Install Intel OneAPI Base Toolkit
#TK run: |
#TK sudo apt install intel-basekit
125 changes: 125 additions & 0 deletions .github/workflows/condatest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
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
python3 -m pip install ./src_co --no-deps -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
30 changes: 30 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish to PyPI
run-name: Publish to ${{inputs.ENVIRONMENT=='testpypi' && 'Test' || ''}}PyPI ${{ inputs.REF && format('({0})', inputs.REF) }}

on:
push:
tags:
- 'v[0-9].*' #pattern match
workflow_dispatch:
inputs:
REF:
type: string
description: Repository ref (tag/branch/SHA) to use. Use tags for uploading. (Defaults to the branch to use the workflow from)
BUILD_ONLY:
type: boolean
description: Build distributions without uploading.
default: false
ENVIRONMENT:
type: environment


jobs:
use-pypi_deploy-workflow:
uses: mctools/mctools_actions/.github/workflows/pypi_deploy.yml@main
with:
REPOSITORY: ${{ github.repository }}
REF: ${{ inputs.REF || github.ref_name }}
DO_DEPLOY: ${{ !inputs.BUILD_ONLY }}
ENVIRONMENT: ${{ inputs.ENVIRONMENT || 'pypi' }}
secrets:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit 76791b5

Please sign in to comment.