Merge pull request #260 from sayanbhowmik/master #179
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build SPARC using conda-build toolchains and perform quick test (no upload) | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| jobs: | |
| # Check if initialization.c is up-to-date with Changelog | |
| package-date-check: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| python-version: "3.12" | |
| activate-environment: sparc-test | |
| miniforge-version: latest # Fix according to https://github.com/conda-incubator/setup-miniconda?tab=readme-ov-file#example-10-miniforge | |
| channels: conda-forge,defaults | |
| channel-priority: true | |
| - name: Install SPARC-X-API stable version for docparser | |
| run: | | |
| mamba install -c conda-forge pip setuptools | |
| pip install git+https://github.com/SPARC-X/SPARC-X-API.git@v1.1.0 | |
| - name: Convert parameters.json | |
| run: | | |
| python -m sparc.docparser --include-subdirs doc/.LaTeX | |
| - name: Check package version and ChangeLog date | |
| run: | | |
| # Usage: | |
| # python test-outdated-package.py <parameters.json> <changelog> | |
| python .github/workflows/test-outdated-package.py \ | |
| ./parameters.json ChangeLog | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| needs: package-date-check | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| python-version: "3.12" | |
| activate-environment: sparc-test | |
| miniforge-version: latest # Fix according to https://github.com/conda-incubator/setup-miniconda?tab=readme-ov-file#example-10-miniforge | |
| channels: conda-forge,defaults | |
| channel-priority: true | |
| - name: Install lasted conda build | |
| # Conda build seems much stable now to be used without boa | |
| run: | | |
| mamba install -c conda-forge conda-build | |
| - name: Build with mambabuild | |
| run: | | |
| echo $CONDA_PREFIX | |
| conda info | |
| CPU_COUNT=2 conda build .conda/ | |
| - name: Install local build | |
| run: | | |
| # Change from version 2.3 | |
| mamba install -c local sparc | |
| which sparc | |
| ldd $(which sparc) | |
| ldd $(which mpirun) | |
| - name: Test simple sparc run | |
| run: | | |
| cd tests/Cu_FCC/standard/ | |
| mpirun -n 2 sparc -name Cu_FCC | |
| - name: Perform comprehensive tests using `quick_run` | |
| run: | | |
| cp $(which sparc) lib/ | |
| cd tests | |
| export LD_LIBRARY_PATH=${CONDA_PREFIX}/lib:${LD_LIBRARY_PATH} | |
| python SPARC_testing_script.py quick_run | tee output | |
| n_failed=$(grep -o 'Tests failed: [0-9]\+' output | grep -o '[0-9]\+$') | |
| # Force fail, see what happens | |
| unset LD_LIBRARY_PATH | |
| python -c "import os, re; match = re.findall(r'Tests failed: (\d+)', open('output').read()); [print('All pass'), os._exit(0)] if int(match[0]) == 0 else [print('Failed'), os._exit(1)]" | |
| rm -rf output | |
| - name: Test socket compatibility | |
| run: | | |
| mpirun -n 1 sparc | tee command-socket.out || true | |
| # Output from the sparc test command | |
| # should contain the -socket subcommand (use regex) | |
| grep "\\-socket" command-socket.out | |