|
1 | | -name: Build and Deploy Jupyter Book |
| 1 | +name: Build IGA-Python Jupyter Book |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: |
6 | | - - master |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
7 | 8 |
|
8 | 9 | jobs: |
9 | 10 | deploy-book: |
10 | | - runs-on: ubuntu-latest |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + fail-fast: true |
| 14 | + matrix: |
| 15 | + include: |
| 16 | + - os: ubuntu-24.04 |
| 17 | + python-version: '3.12' |
| 18 | + |
| 19 | + - os: macos-15 |
| 20 | + python-version: '3.12' |
| 21 | + |
| 22 | + env: |
| 23 | + FC: gfortran-14 |
| 24 | + |
| 25 | + name: ${{ matrix.os }} / Python ${{ matrix.python-version }} |
| 26 | + |
11 | 27 | steps: |
12 | | - - uses: actions/checkout@v2 |
| 28 | + - uses: actions/checkout@v4 |
13 | 29 |
|
14 | | - - name: Set up Python |
15 | | - uses: actions/setup-python@v2 |
| 30 | + - name: Set up Python ${{ matrix.python-version }} |
| 31 | + uses: actions/setup-python@v5 |
16 | 32 | with: |
17 | | - python-version: '3.9' |
| 33 | + python-version: ${{ matrix.python-version }} |
| 34 | + cache: 'pip' |
| 35 | + cache-dependency-path: requirements.txt |
18 | 36 |
|
19 | | - - name: Install dependencies |
| 37 | + - name: Install non-Python dependencies on Ubuntu |
| 38 | + if: startsWith(matrix.os, 'ubuntu') |
| 39 | + uses: awalsh128/cache-apt-pkgs-action@latest |
| 40 | + with: |
| 41 | + packages: gfortran openmpi-bin libopenmpi-dev libhdf5-openmpi-dev |
| 42 | + version: 1.0 |
| 43 | + execute_install_scripts: true |
| 44 | + |
| 45 | + # When loading cached apt packages, the default MPI compiler isn't set. |
| 46 | + # Workaround is to 'reinstall' openmpi-bin, which doesn't actually perform |
| 47 | + # installation (since openmpi-bin already exists), but instead reruns |
| 48 | + # `update-alternatives` which fixes the symlinks to mpicc/mpif90. |
| 49 | + - name: Reconfigure non-Python dependencies on Ubuntu |
| 50 | + if: startsWith(matrix.os, 'ubuntu') |
20 | 51 | run: | |
21 | | - python -m pip install --upgrade pip |
22 | 52 | sudo apt-get update |
23 | | - sudo apt-get install gfortran |
24 | | - sudo apt-get install openmpi-bin libopenmpi-dev |
25 | | - sudo apt-get install libhdf5-openmpi-dev |
26 | | - git clone https://github.com/pyccel/psydac.git |
27 | | - cd psydac |
28 | | - python -m pip install -r requirements.txt |
29 | | - python -m pip install -r requirements_extra.txt --no-build-isolation |
30 | | - pip install . |
31 | | - pip install jupyter-book ghp-import sphinx_proof |
32 | | - python -m ipykernel install --user --name .iga-python --display-name "IGA-Python" |
33 | | - python -m ipykernel install --user --name v_psydac --display-name "Python (v_psydac)" |
| 53 | + sudo apt-get install --reinstall openmpi-bin libhdf5-openmpi-dev |
| 54 | +
|
| 55 | + - name: Install non-Python dependencies on macOS |
| 56 | + if: startsWith(matrix.os, 'macos') |
| 57 | + run: | |
| 58 | + brew install open-mpi hdf5-mpi libomp |
| 59 | +
|
| 60 | + - name: Check gfortran version |
| 61 | + run: | |
| 62 | + if [[ "${{ matrix.os }}" == *"macos"* ]]; then |
| 63 | + # pyccel searches for a Fortran compiler exactly named 'gfortran' |
| 64 | + # which the macos runner doesn't have. A simple workaround is to |
| 65 | + # create a symlink named 'gfortran'. |
| 66 | + FC_path=$(which $FC) |
| 67 | + FC_dir=$(dirname ${FC_path}) |
| 68 | + ln -sv ${FC_path} ${FC_dir}/gfortran |
| 69 | + fi |
| 70 | + gfortran --version |
| 71 | +
|
| 72 | + - name: Install Jupyter Book and Psydac |
| 73 | + run: | |
| 74 | + pip install --upgrade pip |
| 75 | + pip install -r requirements.txt |
34 | 76 |
|
35 | 77 | - name: Build Jupyter Book |
36 | | - run: jupyter-book build . |
| 78 | + run: make docs |
37 | 79 |
|
38 | 80 | - name: Deploy to GitHub Pages |
| 81 | + if: ${{ (github.ref == 'refs/heads/master') && startsWith(matrix.os, 'ubuntu') }} |
39 | 82 | run: ghp-import -n -p -f _build/html |
40 | 83 | env: |
41 | 84 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 85 | + |
0 commit comments