|
| 1 | +name: Tests and Codecov |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + BuildAndTest: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + |
| 10 | + defaults: |
| 11 | + run: |
| 12 | + shell: bash -l {0} |
| 13 | + |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v3 |
| 16 | + |
| 17 | + - uses: conda-incubator/setup-miniconda@v2 |
| 18 | + with: |
| 19 | + # Specify python version your environment will have. Remember to quote this, or |
| 20 | + # YAML will think you want python 3.1 not 3.10 |
| 21 | + python-version: "3.11" |
| 22 | + # This uses *miniforge*, rather than *minicond*. The primary difference is that |
| 23 | + # the defaults channel is not enabled at all |
| 24 | + miniforge-version: latest |
| 25 | + # These properties enable the use of mamba, which is much faster and far less error |
| 26 | + # prone than conda while being completely compatible with the conda CLI |
| 27 | + use-mamba: true |
| 28 | + mamba-version: "*" |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + shell: bash -l {0} |
| 32 | + run: | |
| 33 | + mamba install _openmp_mutex=*=*_llvm cmake make boost git compilers numpy mkl mkl-include mkl-service pybind11 libblas=*=*mkl beartype |
| 34 | + mamba install gcovr gtest |
| 35 | +
|
| 36 | + - name: CPU info |
| 37 | + shell: bash -l {0} |
| 38 | + run: lscpu |
| 39 | + |
| 40 | + - name: Configure CMake |
| 41 | + shell: bash -l {0} |
| 42 | + run: cmake -S ${{github.workspace}} -B ${{github.workspace}}/build -DCMAKE_INSTALL_PREFIX=/home/runner/work/Cytnx_lib -DUSE_MKL=on -DUSE_HPTT=on -DHPTT_ENABLE_FINE_TUNE=on -DHPTT_ENABLE_AVX=off -DBUILD_PYTHON=on -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DRUN_TESTS=on |
| 43 | + |
| 44 | + - name: Build |
| 45 | + shell: bash -l {0} |
| 46 | + working-directory: ${{github.workspace}}/build |
| 47 | + run: | |
| 48 | + cmake --version |
| 49 | + cmake --build . -j `nproc` |
| 50 | +
|
| 51 | + - name: Install |
| 52 | + shell: bash -l {0} |
| 53 | + working-directory: ${{github.workspace}}/build |
| 54 | + run: | |
| 55 | + make install |
| 56 | +
|
| 57 | + - name: Set python path |
| 58 | + run: | |
| 59 | + echo "PYTHONPATH=/home/runner/work/Cytnx_lib" >> $GITHUB_ENV |
| 60 | +
|
| 61 | + - name: Test with pytest |
| 62 | + shell: bash -l {0} |
| 63 | + run: | |
| 64 | + pip install pytest pytest-cov |
| 65 | + pytest pytests/ --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html |
| 66 | +
|
| 67 | + # - name: Run CTest |
| 68 | + # shell: bash -l {0} |
| 69 | + # working-directory: ${{github.workspace}}/build |
| 70 | + # run: GTEST_COLOR=1 ctest --output-on-failure --output-junit junit.xml |
| 71 | + |
| 72 | + # - name: Run gcovr |
| 73 | + # shell: bash -l {0} |
| 74 | + # working-directory: ${{github.workspace}}/build |
| 75 | + # run: | |
| 76 | + # gcovr -r .. . --xml gcovr.xml -e ".*_deps.*$" |
| 77 | + |
| 78 | + # - name: Upload coverage to Codecov |
| 79 | + # uses: codecov/codecov-action@v3 |
| 80 | + # with: |
| 81 | + # #token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos |
| 82 | + # #directory: ${{runner.workspace}}/build |
| 83 | + # files: ${{github.workspace}}/build/gcovr.xml # optional |
| 84 | + # #working-directory: ${{runner.workspace}}/build |
| 85 | + # #root_dir: ${{runner.workspace}} |
| 86 | + # fail_ci_if_error: true # optional (default = false) |
| 87 | + # verbose: true # optional (default = false) |
| 88 | + # #version: "v0.1.15" |
| 89 | + |
| 90 | + #- name: Upload gcovr files |
| 91 | + # uses: actions/upload-artifact@v3 |
| 92 | + # with: |
| 93 | + # name: CMakeError.log |
| 94 | + # path: /home/runner/work/Cytnx/Cytnx/build/CMakeFiles/CMakeError.log |
| 95 | + |
| 96 | + #- name: Upload junit files |
| 97 | + # uses: actions/upload-artifact@v3 |
| 98 | + # with: |
| 99 | + # name: junit_xml |
| 100 | + # path: ${{github.workspace}}/build/junit.xml |
0 commit comments