|
| 1 | +name: conda |
| 2 | +on: |
| 3 | + push: |
| 4 | + pull_request: |
| 5 | + schedule: |
| 6 | + - cron: '30 18 * * 0' # 18:30 every Sunday |
| 7 | + |
| 8 | +jobs: |
| 9 | + precheck: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Checkout |
| 13 | + uses: actions/checkout@v4 |
| 14 | + with: |
| 15 | + path: src |
| 16 | + - name: Pip install deps |
| 17 | + run: pip install ruff |
| 18 | + - name: mcplg4devtool checks |
| 19 | + run: ./src/devel/bin/mcplg4devtool --check |
| 20 | + |
| 21 | + build: |
| 22 | + needs: [ precheck ] |
| 23 | + strategy: |
| 24 | + #fail-fast: false |
| 25 | + matrix: |
| 26 | + include: |
| 27 | + #NB: Due to cache size limitations we should have at most 3 or 4 platforms here!! |
| 28 | + #NB: No Geant4 conda pkgs on windows |
| 29 | + #NB: No linux-aarch64 geant4 pkg: - { os: ubuntu-24.04-arm, g4spec: 'geant4' } |
| 30 | + - { os: ubuntu-latest, g4spec: 'geant4==11.1.3' } |
| 31 | + - { os: ubuntu-latest, g4spec: 'geant4' } |
| 32 | + - { os: macos-latest, g4spec: 'geant4==11.1.3' } |
| 33 | + - { os: macos-13, g4spec: 'geant4' } |
| 34 | + name: ${{ matrix.os }}-${{ matrix.g4spec }} |
| 35 | + runs-on: ${{ matrix.os }} |
| 36 | + defaults: |
| 37 | + run: |
| 38 | + shell: bash -el {0} |
| 39 | + env: |
| 40 | + CONDA_SOLVER: libmamba |
| 41 | + |
| 42 | + steps: |
| 43 | + - name: Checkout |
| 44 | + uses: actions/checkout@v4 |
| 45 | + with: |
| 46 | + path: ./src |
| 47 | + |
| 48 | + - name: Setup Miniforge |
| 49 | + uses: conda-incubator/setup-miniconda@v3 |
| 50 | + with: |
| 51 | + miniforge-version: latest |
| 52 | + activate-environment: anaconda-client-env |
| 53 | + |
| 54 | + - name: Get Date |
| 55 | + id: get-date |
| 56 | + run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT |
| 57 | + shell: bash |
| 58 | + |
| 59 | + - name: Cache Conda env |
| 60 | + id: cache |
| 61 | + uses: actions/cache@v4 |
| 62 | + with: |
| 63 | + path: ${{ env.CONDA }}/envs |
| 64 | + key: |
| 65 | + conda-${{ runner.os }}--${{ runner.arch }}--${{ |
| 66 | + steps.get-date.outputs.today }}-${{ matrix.g4spec }}-${{ |
| 67 | + hashFiles('./src/.github/resources/condamcplg4.yml') }} |
| 68 | + |
| 69 | + - name: Update environment |
| 70 | + if: steps.cache.outputs.cache-hit != 'true' |
| 71 | + run: | |
| 72 | + mamba env update -n anaconda-client-env -f ./src/.github/resources/condamcplg4.yml |
| 73 | + mamba install -n anaconda-client-env "${{ matrix.g4spec }}" |
| 74 | +
|
| 75 | + - name: Inspect environment |
| 76 | + run: | |
| 77 | + conda info |
| 78 | + conda list |
| 79 | + set -x |
| 80 | + cmake --version |
| 81 | + pip list |
| 82 | +
|
| 83 | + ############################################# |
| 84 | + #TEMPORARY: |
| 85 | + - name: TEMPORARY install MCPL2 from development branch |
| 86 | + run: pip install "git+https://github.com/mctools/mcpl@path_to_mcpl2#subdirectory=mcpl_core" |
| 87 | + ################################## |
| 88 | + |
| 89 | + - name: Install source |
| 90 | + run: pip install ./src |
| 91 | + |
| 92 | + |
| 93 | + - name: Cfg example_write |
| 94 | + run: cmake -S ./src/example_write -B ./bldexample_write -DCMAKE_INSTALL_PREFIX=./instexample_write |
| 95 | + |
| 96 | + - name: Build example_write |
| 97 | + run: cmake --build ./bldexample_write |
| 98 | + |
| 99 | + - name: Install example_write |
| 100 | + run: cmake --install ./bldexample_write |
| 101 | + |
| 102 | + - name: Run example_write |
| 103 | + run: ./instexample_write/bin/myapp |
| 104 | + |
| 105 | + - run: mcpltool myoutput.mcpl.gz |
| 106 | + |
| 107 | + - name: Cfg example_read |
| 108 | + run: cmake -S ./src/example_read -B ./bldexample_read -DCMAKE_INSTALL_PREFIX=./instexample_read |
| 109 | + |
| 110 | + - name: Build example_read |
| 111 | + run: cmake --build ./bldexample_read |
| 112 | + |
| 113 | + - name: Install example_read |
| 114 | + run: cmake --install ./bldexample_read |
| 115 | + |
| 116 | + - name: Run example_read |
| 117 | + run: ./instexample_read/bin/myapp myoutput.mcpl.gz |
0 commit comments