|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: [push] |
| 4 | + |
| 5 | +jobs: |
| 6 | + |
| 7 | + Build: |
| 8 | + runs-on: ${{ matrix.os }} |
| 9 | + strategy: |
| 10 | + fail-fast: false |
| 11 | + matrix: |
| 12 | + os: [ubuntu-latest] |
| 13 | + gcc_v: [7,8,9,10] # Version of GFortran we want to use. |
| 14 | + python-version: [3.7] |
| 15 | + env: |
| 16 | + FC: gfortran-${{matrix.gcc_v}} |
| 17 | + GCC_V: ${{matrix.gcc_v}} |
| 18 | + |
| 19 | + steps: |
| 20 | + |
| 21 | + - name: Set vars |
| 22 | + id: vars |
| 23 | + run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} |
| 24 | + |
| 25 | + - name: Checkout code |
| 26 | + uses: actions/checkout@v2 |
| 27 | + with: |
| 28 | + submodules: recursive |
| 29 | + |
| 30 | + - name: Setup cmake |
| 31 | + if: contains( matrix.gcc_v, 9 ) |
| 32 | + uses: jwlawson/actions-setup-cmake@v1.8 |
| 33 | + with: |
| 34 | + cmake-version: '3.19.x' |
| 35 | + |
| 36 | + - name: Install Python |
| 37 | + uses: actions/setup-python@v1 # Use pip to install latest CMake, & FORD/Jin2For, etc. |
| 38 | + with: |
| 39 | + python-version: ${{ matrix.python-version }} |
| 40 | + |
| 41 | + - name: Setup Graphviz |
| 42 | + uses: ts-graphviz/setup-graphviz@v1 |
| 43 | + |
| 44 | + - name: Install Python dependencies |
| 45 | + if: contains( matrix.os, 'ubuntu') |
| 46 | + run: | |
| 47 | + python -m pip install --upgrade pip |
| 48 | + pip install ford FoBiS.py pygooglechart |
| 49 | + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 50 | +
|
| 51 | + - name: Install GFortran Linux |
| 52 | + if: contains( matrix.os, 'ubuntu') |
| 53 | + run: | |
| 54 | + sudo add-apt-repository ppa:ubuntu-toolchain-r/test |
| 55 | + sudo apt-get update |
| 56 | + sudo apt-get install -y gcc-${GCC_V} gfortran-${GCC_V} |
| 57 | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_V} 100 \ |
| 58 | + --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_V} \ |
| 59 | + --slave /usr/bin/gcov gcov /usr/bin/gcov-${GCC_V} |
| 60 | +
|
| 61 | + - name: Compile_with_build |
| 62 | + if: matrix.gcc_v != 7 |
| 63 | + run: | |
| 64 | + GFORTRAN=gfortran-${{matrix.gcc_v}} |
| 65 | + GCOV=gcov-${{matrix.gcc_v}} |
| 66 | + # build with build.sh, run unit tests |
| 67 | + ./build.sh --skip-documentation |
| 68 | + ./build.sh --skip-documentation --enable-unicode |
| 69 | +
|
| 70 | + - name: Compile_with_cmake |
| 71 | + # CMake build with unit tests, no documentation, with coverage analysis |
| 72 | + # No unicode so that coverage combined with the build script will cover unicode |
| 73 | + # and non-unicode code paths |
| 74 | + if: matrix.gcc_v == 9 |
| 75 | + run: | |
| 76 | + GFORTRAN=gfortran-${{matrix.gcc_v}} |
| 77 | + GCOV=gcov-${{matrix.gcc_v}} |
| 78 | + mkdir cmake-build |
| 79 | + cd cmake-build |
| 80 | + cmake .. |
| 81 | + make -j 4 check |
| 82 | +
|
| 83 | + - name: Compile_with_build_mkdocs |
| 84 | + # build with build.sh, make documentation, run unit tests |
| 85 | + # and perform coverage analysis - used for doc deployment |
| 86 | + if: matrix.gcc_v == 7 |
| 87 | + run: | |
| 88 | + GFORTRAN=gfortran-${{matrix.gcc_v}} |
| 89 | + GCOV=gcov-${{matrix.gcc_v}} |
| 90 | + ./build.sh --coverage --skip-documentation |
| 91 | + ./build.sh --coverage --enable-unicode |
| 92 | +
|
| 93 | + - name: Deploy Documentation for master |
| 94 | + if: matrix.gcc_v == 7 && github.ref == 'refs/heads/master' |
| 95 | + uses: JamesIves/github-pages-deploy-action@4.1.3 |
| 96 | + with: |
| 97 | + branch: gh-pages # The branch the action should deploy to. |
| 98 | + folder: doc # The folder the action should deploy. |
| 99 | + clean: true |
| 100 | + clean-exclude: | |
| 101 | + prev |
| 102 | +
|
| 103 | + - name: Rebuild documentation for tagged release |
| 104 | + env: |
| 105 | + TAGNAME: ${{ steps.vars.outputs.tag }} |
| 106 | + if: matrix.gcc_v == 7 && startsWith(github.ref, 'refs/tags/') |
| 107 | + run: | |
| 108 | + echo ${TAGNAME} |
| 109 | + rm -rf doc |
| 110 | + sed "2 s/^/version: ${TAGNAME}\n/" json-fortran.md > json-fortran.tagged.md |
| 111 | + ford --debug json-fortran.tagged.md |
| 112 | +
|
| 113 | + - name: Deploy documentation for tagged release |
| 114 | + env: |
| 115 | + TAGNAME: ${{ steps.vars.outputs.tag }} |
| 116 | + if: matrix.gcc_v == 7 && startsWith(github.ref, 'refs/tags/') |
| 117 | + uses: JamesIves/github-pages-deploy-action@4.1.3 |
| 118 | + with: |
| 119 | + branch: gh-pages # The branch the action should deploy to. |
| 120 | + folder: doc # The folder the action should deploy. |
| 121 | + target-folder: prev/$TAGNAME # deploy to a version-specific folder |
| 122 | + |
| 123 | + - name: Upload coverage |
| 124 | + if: matrix.gcc_v == 7 |
| 125 | + run: | |
| 126 | + rm json_*.F90-*unicode.gcov || true |
| 127 | + mv json_*.F90.gcov src/ |
| 128 | + mv jf_test*.[fF]90.gcov src/tests/ |
| 129 | + bash <(curl -s https://codecov.io/bash) -v -X $GCOV |
0 commit comments