stamd

Static Markdown Page Generator
git clone git://git.dimitrijedobrota.com/stamd.git
Log | Files | Refs | README | LICENSE

ci.yml (4702B)


      1 name: Continuous Integration
      2 
      3 on:
      4   push:
      5     branches:
      6     - master
      7 
      8   pull_request:
      9     branches:
     10     - master
     11 
     12 jobs:
     13   lint:
     14     runs-on: ubuntu-22.04
     15 
     16     steps:
     17     - uses: actions/checkout@v4
     18 
     19     - uses: actions/setup-python@v5
     20       with: { python-version: "3.12" }
     21 
     22     - name: Install codespell
     23       run: pip3 install codespell
     24 
     25     - name: Lint
     26       run: cmake -D FORMAT_COMMAND=clang-format-14 -P cmake/lint.cmake
     27 
     28     - name: Spell check
     29       if: always()
     30       run: cmake -P cmake/spell.cmake
     31 
     32   coverage:
     33     needs: [lint]
     34 
     35     runs-on: ubuntu-22.04
     36 
     37     # To enable coverage, delete the last line from the conditional below and
     38     # edit the "<name>" placeholder to your GitHub name.
     39     # If you do not wish to use codecov, then simply delete this job from the
     40     # workflow.
     41     if: github.repository_owner == '<name>'
     42       && false
     43 
     44     steps:
     45     - uses: actions/checkout@v4
     46 
     47     - name: Install LCov
     48       run: sudo apt-get update -q
     49         && sudo apt-get install lcov -q -y
     50 
     51     - name: Configure
     52       run: cmake --preset=ci-coverage
     53 
     54     - name: Build
     55       run: cmake --build build/coverage -j 2
     56 
     57     - name: Test
     58       working-directory: build/coverage
     59       run: ctest --output-on-failure --no-tests=error -j 2
     60 
     61     - name: Process coverage info
     62       run: cmake --build build/coverage -t coverage
     63 
     64     - name: Submit to codecov.io
     65       uses: codecov/codecov-action@v4
     66       with:
     67         file: build/coverage/coverage.info
     68         token: ${{ secrets.CODECOV_TOKEN }}
     69 
     70   sanitize:
     71     needs: [lint]
     72 
     73     runs-on: ubuntu-22.04
     74 
     75     env: { CXX: clang++-14 }
     76 
     77     steps:
     78     - uses: actions/checkout@v4
     79 
     80     - name: Configure
     81       run: cmake --preset=ci-sanitize
     82 
     83     - name: Build
     84       run: cmake --build build/sanitize -j 2
     85 
     86     - name: Test
     87       working-directory: build/sanitize
     88       env:
     89         ASAN_OPTIONS: "strict_string_checks=1:\
     90           detect_stack_use_after_return=1:\
     91           check_initialization_order=1:\
     92           strict_init_order=1:\
     93           detect_leaks=1:\
     94           halt_on_error=1"
     95         UBSAN_OPTIONS: "print_stacktrace=1:\
     96           halt_on_error=1"
     97       run: ctest --output-on-failure --no-tests=error -j 2
     98 
     99   test:
    100     needs: [lint]
    101 
    102     strategy:
    103       matrix:
    104         os: [macos-14, ubuntu-22.04, windows-2022]
    105 
    106     runs-on: ${{ matrix.os }}
    107 
    108     steps:
    109     - uses: actions/checkout@v4
    110 
    111     - name: Install static analyzers
    112       if: matrix.os == 'ubuntu-22.04'
    113       run: >-
    114         sudo apt-get install clang-tidy-14 cppcheck -y -q
    115 
    116         sudo update-alternatives --install
    117         /usr/bin/clang-tidy clang-tidy
    118         /usr/bin/clang-tidy-14 140
    119 
    120     - name: Setup MultiToolTask
    121       if: matrix.os == 'windows-2022'
    122       run: |
    123         Add-Content "$env:GITHUB_ENV" 'UseMultiToolTask=true'
    124         Add-Content "$env:GITHUB_ENV" 'EnforceProcessCountAcrossBuilds=true'
    125 
    126     - name: Configure
    127       shell: pwsh
    128       run: cmake "--preset=ci-$("${{ matrix.os }}".split("-")[0])"
    129 
    130     - name: Build
    131       run: cmake --build build --config Release -j 2
    132 
    133     - name: Install
    134       run: cmake --install build --config Release --prefix prefix
    135 
    136     - name: Test
    137       working-directory: build
    138       run: ctest --output-on-failure --no-tests=error -C Release -j 2
    139 
    140   docs:
    141     # Deploy docs only when builds succeed
    142     needs: [sanitize, test]
    143 
    144     runs-on: ubuntu-22.04
    145 
    146     # To enable, first you have to create an orphaned gh-pages branch:
    147     #
    148     #    git switch --orphan gh-pages
    149     #    git commit --allow-empty -m "Initial commit"
    150     #    git push -u origin gh-pages
    151     #
    152     # Edit the <name> placeholder below to your GitHub name, so this action
    153     # runs only in your repository and no one else's fork. After these, delete
    154     # this comment and the last line in the conditional below.
    155     # If you do not wish to use GitHub Pages for deploying documentation, then
    156     # simply delete this job similarly to the coverage one.
    157     if: github.ref == 'refs/heads/master'
    158       && github.event_name == 'push'
    159       && github.repository_owner == '<name>'
    160       && false
    161 
    162     permissions:
    163       contents: write
    164 
    165     steps:
    166     - uses: actions/checkout@v4
    167 
    168     - uses: actions/setup-python@v5
    169       with: { python-version: "3.12" }
    170 
    171     - name: Install m.css dependencies
    172       run: pip3 install jinja2 Pygments
    173 
    174     - name: Install Doxygen
    175       run: sudo apt-get update -q
    176         && sudo apt-get install doxygen -q -y
    177 
    178     - name: Build docs
    179       run: cmake "-DPROJECT_SOURCE_DIR=$PWD" "-DPROJECT_BINARY_DIR=$PWD/build"
    180         -P cmake/docs-ci.cmake
    181 
    182     - name: Deploy docs
    183       uses: peaceiris/actions-gh-pages@v4
    184       with:
    185         github_token: ${{ secrets.GITHUB_TOKEN }}
    186         publish_dir: build/docs/html