|
| 1 | +--- |
| 2 | +# |
| 3 | +# ========== SCORPIO testing workflow ============ |
| 4 | +# The current workflow, |
| 5 | +# 1) Checks out SCORPIO source |
| 6 | +# 2) Installs dependencies using conda : CMake, MPICH & PnetCDF |
| 7 | +# 3) Configures, builds and tests SCORPIO |
| 8 | +# The tests are run on a single node (with PnetCDF) |
| 9 | +# |
| 10 | +name: SCORPIO + PnetCDF - build and test |
| 11 | + |
| 12 | +on: # yamllint disable-line rule:truthy |
| 13 | + workflow_dispatch: |
| 14 | + inputs: |
| 15 | + branch_name: |
| 16 | + description: 'Branch to run the SCORPIO + PnetCDF tests' |
| 17 | + required: true |
| 18 | + default: 'main' |
| 19 | + push: |
| 20 | + branches: |
| 21 | + - main |
| 22 | + pull_request: |
| 23 | + branches: |
| 24 | + - main |
| 25 | + |
| 26 | +jobs: |
| 27 | + build_and_test: |
| 28 | + runs-on: ubuntu-latest # Or other suitable runner |
| 29 | + |
| 30 | + steps: |
| 31 | + - name: Checkout repository |
| 32 | + uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: Setup Miniconda |
| 35 | + uses: conda-incubator/setup-miniconda@v3 |
| 36 | + with: |
| 37 | + python-version: 3.9 # Specify your desired Python version |
| 38 | + channels: conda-forge,defaults # Specify your desired channels |
| 39 | + auto-activate-base: false # Prevent auto-activation of base env |
| 40 | + |
| 41 | + - name: Create and activate Conda environment |
| 42 | + shell: bash -l {0} # Use bash -l to ensure conda commands are available |
| 43 | + run: | |
| 44 | + conda create -n scorpio_env # Create environment |
| 45 | + conda activate scorpio_env # Activate environment |
| 46 | + conda install conda-forge::cmake |
| 47 | + conda install conda-forge::mpich \ |
| 48 | + conda-forge::mpich-mpicc conda-forge::mpich-mpicxx \ |
| 49 | + conda-forge::mpich-mpifort |
| 50 | + conda-forge::libpnetcdf |
| 51 | +
|
| 52 | + - name: Configure SCORPIO |
| 53 | + shell: bash -l {0} # Ensure environment is active for configure cmds |
| 54 | + run: | |
| 55 | + conda activate scorpio_env # Activate environment |
| 56 | + CC=mpicc CXX=mpicxx FC=mpif90 F77=mpif90 \ |
| 57 | + cmake -DWITH_PNETCDF:BOOL=TRUE \ |
| 58 | + -DCMAKE_BUILD_TYPE=Debug -DPIO_USE_MALLOC:BOOL=ON \ |
| 59 | + -DPIO_BUILD_TESTS:BOOL=ON -DPIO_ENABLE_EXAMPLES:BOOL=ON \ |
| 60 | + -DPIO_ENABLE_TESTS:BOOL=ON -DPLATFORM:STRING=linux-gnu \ |
| 61 | + -S . -B scorpio_build_dir -LH |
| 62 | +
|
| 63 | + - name: Build SCORPIO |
| 64 | + shell: bash -l {0} # Ensure environment is active for build cmds |
| 65 | + run: | |
| 66 | + conda activate scorpio_env # Activate environment |
| 67 | + cmake --build scorpio_build_dir |
| 68 | +
|
| 69 | + - name: Run SCORPIO tests |
| 70 | + shell: bash -l {0} # Ensure environment is active for test cmds |
| 71 | + run: | |
| 72 | + conda activate scorpio_env # Activate environment |
| 73 | + cd scorpio_build_dir |
| 74 | + make test |
0 commit comments