[pull] master from OSGeo:master #2723
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code Checks | |
on: | |
push: | |
paths-ignore: | |
- 'doc/**' | |
branches-ignore: | |
- 'backport**' | |
pull_request: | |
paths-ignore: | |
- 'doc/**' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
jobs: | |
cppcheck_2004: | |
runs-on: ubuntu-20.04 | |
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Requirements | |
run: | | |
sudo apt update | |
sudo apt install -y cppcheck libsqlite3-dev ccache sqlite3 libproj-dev cmake | |
- name: Run cmake | |
run: | | |
mkdir build | |
cd build | |
cmake .. | |
- name: Run cppcheck test | |
run: | | |
cd build | |
../scripts/cppcheck.sh | |
code_quality_checks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Detect tabulations | |
run: ./scripts/detect_tabulations.sh | |
- name: Detect printf | |
run: ./scripts/detect_printf.sh | |
- name: Detect self assignments | |
run: ./scripts/detect_self_assignment.sh | |
- name: Detect suspicious char digit zero | |
run: ./scripts/detect_suspicious_char_digit_zero.sh | |
- name: Detect missing includes | |
run: ./scripts/detect_missing_include.sh | |
# Helps detecting updates of internal libjson-c where replacement | |
# of strtod() -> CPLStrtod() is missing. The later function is not | |
# locale sensitive. An alternative would be to make sure that HAVE_USELOCALE | |
# or HAVE_SETLOCALE are passed on Windows, but avoiding to mess with | |
# locale seems to be a better option | |
- name: Detect invalid use of atof() or strtod() in internal libjson | |
run: | | |
grep -e "CPLStrtod(" ../ogr/ogrsf_frmts/geojson/libjson/*.c >/dev/null && echo "CPLStrtod() found as expected" | |
if grep -e "strtod(" ogr/ogrsf_frmts/geojson/libjson/*.c; then echo "Unexpected use of strtod(). Use CPLStrtod() instead"; /bin/false; fi | |
if grep -e "atof(" ogr/ogrsf_frmts/geojson/libjson/*.c; then echo "Unexpected use of atof()."; /bin/false; fi | |
- name: Shellcheck | |
run: shellcheck -e SC2086,SC2046,SC2164,SC2054 $(find . -name '*.sh' -a -not -name ltmain.sh -a -not -wholename "./autotest/*" -a -not -wholename "./.github/*") | |
linting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
- uses: pre-commit/[email protected] | |
doxygen: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Requirements | |
run: | | |
sudo apt update | |
sudo apt install doxygen texlive-latex-base | |
- name: Run doxygen | |
run: | | |
cd doc | |
make .doxygen_up_to_date >log.txt 2>&1 | |
if grep -i warning log.txt | grep -v -e russian -e brazilian; then echo "Doxygen warnings found" && cat log.txt && /bin/false; else echo "No Doxygen warnings found"; fi | |
formatting-check: | |
name: Formatting Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout GDAL | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 100 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- name: Install Run clang-format style check for C/C++ programs. | |
run: pip install clang-format==15.0.4 | |
- name: Check new code with clang-format | |
run: ./scripts/clang-format.sh | |
other_checks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Requirements | |
run: | | |
sudo apt install python3-pip wget | |
sudo pip3 install cffconvert | |
- name: Validate citation file | |
run: | | |
cffconvert --validate | |
cffconvert -f bibtex | |
cffconvert -f apalike | |
cmake-lint: | |
# Disabled because of https://github.com/OSGeo/gdal/pull/5326#issuecomment-1042617407 | |
if: false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install lint tool | |
run: | | |
python -m pip install --upgrade pip | |
pip install cmake-format pyyaml | |
- name: Check cmakelist | |
run: find . -name CMakeLists.txt |xargs cmake-format --check | |
validate_xml: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install requirements | |
run: | | |
sudo apt update | |
sudo apt install -y libxml2-utils | |
- name: Run xmllint checks | |
run: | | |
xmllint --schema ./data/nitf_spec.xsd ./data/nitf_spec.xml --noout | |
xmllint --schema ./data/vdv452.xsd ./data/vdv452.xml --noout | |
xmllint --schema ./data/gmlasconf.xsd ./data/gmlasconf.xml --noout |