|
| 1 | +name: fpm-deployment |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + test: |
| 7 | + runs-on: ${{ matrix.os }} |
| 8 | + strategy: |
| 9 | + fail-fast: false |
| 10 | + matrix: |
| 11 | + include: |
| 12 | + - os: ubuntu-latest |
| 13 | + toolchain: {compiler: gcc, version: 14} |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout code |
| 17 | + |
| 18 | + |
| 19 | + - name: Set up Python 3.x |
| 20 | + uses: actions/setup-python@v1 |
| 21 | + with: |
| 22 | + python-version: 3.x |
| 23 | + |
| 24 | + - name: Install requirements |
| 25 | + run: pip install --upgrade -r config/requirements.txt |
| 26 | + |
| 27 | + - uses: fortran-lang/setup-fortran@main |
| 28 | + id: setup-fortran |
| 29 | + with: |
| 30 | + compiler: ${{ matrix.toolchain.compiler }} |
| 31 | + version: ${{ matrix.toolchain.version }} |
| 32 | + |
| 33 | + - name: Setup Fortran Package Manager |
| 34 | + uses: fortran-lang/setup-fpm@v5 |
| 35 | + with: |
| 36 | + fpm-version: 'v0.10.0' |
| 37 | + |
| 38 | + - name: Prepare for code coverage |
| 39 | + if: contains( matrix.os, 'ubuntu') |
| 40 | + run: | |
| 41 | + sudo apt-get install lcov |
| 42 | + sudo add-apt-repository ppa:ubuntu-toolchain-r/test |
| 43 | + sudo apt-get update |
| 44 | + sudo apt-get install -y gcc-14 gfortran-14 |
| 45 | + sudo update-alternatives \ |
| 46 | + --install /usr/bin/gcc gcc /usr/bin/gcc-14 100 \ |
| 47 | + --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-14 \ |
| 48 | + --slave /usr/bin/gcov gcov /usr/bin/gcov-14 |
| 49 | +
|
| 50 | + - name: Run test to generate the coverage. |
| 51 | + run: | # Use fpm gnu ci to check xdp and qp |
| 52 | + python config/fypp_deployment.py #--with_xdp --with_qp |
| 53 | + fpm test --profile debug --flag '-coverage' |
| 54 | +
|
| 55 | + - name: Create coverage report |
| 56 | + run: | |
| 57 | + mkdir -p ${{ env.COV_DIR }} |
| 58 | + mv ./build/gfortran_*/*/* ${{ env.COV_DIR }} |
| 59 | + lcov --capture --initial --base-directory . --directory ${{ env.COV_DIR }} --output-file ${{ env.COV_DIR }}/coverage.base |
| 60 | + lcov --capture --base-directory . --directory ${{ env.COV_DIR }} --output-file ${{ env.COV_DIR }}/coverage.capture |
| 61 | + lcov --add-tracefile ${{ env.COV_DIR }}/coverage.base --add-tracefile ${{ env.COV_DIR }}/coverage.capture --output-file ${{ env.COV_DIR }}/coverage.info |
| 62 | + env: |
| 63 | + COV_DIR: build/coverage |
| 64 | + |
| 65 | + - name: Upload coverage report |
| 66 | + uses: codecov/codecov-action@v4 |
| 67 | + with: |
| 68 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 69 | + files: build/coverage/coverage.info |
0 commit comments