mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-02-19 12:38:42 +01:00
Dev/automate tests using data (#267)
- automatically run python tests - automatically run test using data files on local runner from gitea - fixed some of the workflows --------- Co-authored-by: Erik Fröjdh <erik.frojdh@psi.ch>
This commit is contained in:
@@ -32,21 +32,22 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install cmake gcc g++
|
||||
|
||||
- name: Get conda
|
||||
uses: conda-incubator/setup-miniconda@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
environment-file: etc/dev-env.yml
|
||||
miniforge-version: latest
|
||||
channels: conda-forge
|
||||
conda-remove-defaults: "true"
|
||||
sudo apt-get -y install python3.12 python3.12-dev python3.12-venv python3-pip
|
||||
sudo apt-get -y install doxygen
|
||||
python3.12 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip install breathe
|
||||
pip install sphinx_rtd_theme sphinx
|
||||
pip install numpy
|
||||
pip install furo
|
||||
|
||||
- name: Build library
|
||||
run: |
|
||||
source venv/bin/activate
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DAARE_SYSTEM_LIBRARIES=ON -DAARE_DOCS=ON
|
||||
cmake .. -DAARE_PYTHON_BINDINGS=ON -DAARE_DOCS=ON
|
||||
make -j 2
|
||||
make docs
|
||||
|
||||
|
||||
47
.gitea/workflows/rh8-data-tests-local.yml
Normal file
47
.gitea/workflows/rh8-data-tests-local.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
name: Run tests using data on local RHEL8
|
||||
|
||||
on:
|
||||
push: # pull_request only works if pull_request in gitea
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: "detectors-software-RH8"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Clone aare-test-data repository
|
||||
run: |
|
||||
git lfs install
|
||||
git clone https://gitea.psi.ch/detectors/aare-test-data.git ../aare-test-data
|
||||
cd ../aare-test-data
|
||||
git lfs pull
|
||||
|
||||
- name: Build library
|
||||
run: |
|
||||
source /home/gitea_runner/.bashrc
|
||||
conda activate aare_test
|
||||
mkdir build && cd build
|
||||
cmake .. -DAARE_PYTHON_BINDINGS=ON -DAARE_TESTS=ON
|
||||
make -j 4
|
||||
|
||||
- name: C++ unit tests
|
||||
working-directory: ${{github.workspace}}/build
|
||||
env:
|
||||
AARE_TEST_DATA: ${{github.workspace}}/../aare-test-data
|
||||
run: ./run_tests [.with-data] # TODO: should we run all tests?
|
||||
|
||||
- name: Python unit tests
|
||||
working-directory: ${{github.workspace}}/build
|
||||
env:
|
||||
AARE_TEST_DATA: ${{github.workspace}}/../aare-test-data
|
||||
run: |
|
||||
source /home/gitea_runner/.bashrc
|
||||
conda activate aare_test
|
||||
python -m pytest ${{github.workspace}}/python/tests/ --with-data # runs all tests
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
build:
|
||||
runs-on: "ubuntu-latest"
|
||||
container:
|
||||
image: gitea.psi.ch/images/rhel8-developer-gitea-actions
|
||||
image: gitea.psi.ch/detectors/rhel8-detectors-dev
|
||||
steps:
|
||||
# workaround until actions/checkout@v4 is available for RH8
|
||||
# - uses: actions/checkout@v4
|
||||
@@ -21,9 +21,15 @@ jobs:
|
||||
git clone https://${{secrets.GITHUB_TOKEN}}@gitea.psi.ch/${{ github.repository }}.git --branch=${{ github.ref_name }} .
|
||||
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
dnf install -y cmake python3.12 python3.12-devel python3.12-pip
|
||||
python3.12 -m pip install --upgrade pip
|
||||
python3.12 -m pip install pytest
|
||||
python3.12 -m pip install numpy
|
||||
python3.12 -m pip install pytest-check
|
||||
python3.12 -m pip install matplotlib
|
||||
python3.12 -m pip install boost-histogram
|
||||
|
||||
|
||||
- name: Build library
|
||||
run: |
|
||||
@@ -33,4 +39,9 @@ jobs:
|
||||
|
||||
- name: C++ unit tests
|
||||
working-directory: ${{gitea.workspace}}/build
|
||||
run: ctest
|
||||
run: ctest
|
||||
|
||||
- name: Python unit tests
|
||||
working-directory: ${{gitea.workspace}}/build
|
||||
run: |
|
||||
python3.12 -m pytest ${{gitea.workspace}}/python/tests/
|
||||
@@ -11,14 +11,19 @@ jobs:
|
||||
build:
|
||||
runs-on: "ubuntu-latest"
|
||||
container:
|
||||
image: gitea.psi.ch/images/rhel9-developer-gitea-actions
|
||||
image: gitea.psi.ch/detectors/rhel9-detectors-dev
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
dnf install -y cmake python3.12 python3.12-devel python3.12-pip
|
||||
python3.12 -m pip install --upgrade pip
|
||||
python3.12 -m pip install pytest
|
||||
python3.12 -m pip install numpy
|
||||
python3.12 -m pip install pytest-check
|
||||
python3.12 -m pip install matplotlib
|
||||
python3.12 -m pip install boost-histogram
|
||||
|
||||
- name: Build library
|
||||
run: |
|
||||
@@ -28,4 +33,9 @@ jobs:
|
||||
|
||||
- name: C++ unit tests
|
||||
working-directory: ${{gitea.workspace}}/build
|
||||
run: ctest
|
||||
run: ctest
|
||||
|
||||
- name: Python unit tests
|
||||
working-directory: ${{gitea.workspace}}/build
|
||||
run: |
|
||||
python3.12 -m pytest ${{gitea.workspace}}/python/tests/
|
||||
Reference in New Issue
Block a user