From 607400a6afc0156d0f025f87e4af7a7a41d93077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sat, 13 Jan 2024 22:43:46 -0500 Subject: [PATCH 1/4] r.unpack: Rename folder `test_suite` to `testsuite` to discover tests (#3358) --- scripts/r.unpack/{test_suite => testsuite}/test.r.unpack.sh | 0 scripts/r.unpack/{test_suite => testsuite}/test_double.ref | 0 .../{test_suite => testsuite}/test_double_uncompressed.ref | 0 scripts/r.unpack/{test_suite => testsuite}/test_float.ref | 0 .../{test_suite => testsuite}/test_float_uncompressed.ref | 0 scripts/r.unpack/{test_suite => testsuite}/test_int.ref | 0 .../r.unpack/{test_suite => testsuite}/test_int_uncompressed.ref | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename scripts/r.unpack/{test_suite => testsuite}/test.r.unpack.sh (100%) rename scripts/r.unpack/{test_suite => testsuite}/test_double.ref (100%) rename scripts/r.unpack/{test_suite => testsuite}/test_double_uncompressed.ref (100%) rename scripts/r.unpack/{test_suite => testsuite}/test_float.ref (100%) rename scripts/r.unpack/{test_suite => testsuite}/test_float_uncompressed.ref (100%) rename scripts/r.unpack/{test_suite => testsuite}/test_int.ref (100%) rename scripts/r.unpack/{test_suite => testsuite}/test_int_uncompressed.ref (100%) diff --git a/scripts/r.unpack/test_suite/test.r.unpack.sh b/scripts/r.unpack/testsuite/test.r.unpack.sh similarity index 100% rename from scripts/r.unpack/test_suite/test.r.unpack.sh rename to scripts/r.unpack/testsuite/test.r.unpack.sh diff --git a/scripts/r.unpack/test_suite/test_double.ref b/scripts/r.unpack/testsuite/test_double.ref similarity index 100% rename from scripts/r.unpack/test_suite/test_double.ref rename to scripts/r.unpack/testsuite/test_double.ref diff --git a/scripts/r.unpack/test_suite/test_double_uncompressed.ref b/scripts/r.unpack/testsuite/test_double_uncompressed.ref similarity index 100% rename from scripts/r.unpack/test_suite/test_double_uncompressed.ref rename to scripts/r.unpack/testsuite/test_double_uncompressed.ref diff --git a/scripts/r.unpack/test_suite/test_float.ref b/scripts/r.unpack/testsuite/test_float.ref similarity index 100% rename from scripts/r.unpack/test_suite/test_float.ref rename to scripts/r.unpack/testsuite/test_float.ref diff --git a/scripts/r.unpack/test_suite/test_float_uncompressed.ref b/scripts/r.unpack/testsuite/test_float_uncompressed.ref similarity index 100% rename from scripts/r.unpack/test_suite/test_float_uncompressed.ref rename to scripts/r.unpack/testsuite/test_float_uncompressed.ref diff --git a/scripts/r.unpack/test_suite/test_int.ref b/scripts/r.unpack/testsuite/test_int.ref similarity index 100% rename from scripts/r.unpack/test_suite/test_int.ref rename to scripts/r.unpack/testsuite/test_int.ref diff --git a/scripts/r.unpack/test_suite/test_int_uncompressed.ref b/scripts/r.unpack/testsuite/test_int_uncompressed.ref similarity index 100% rename from scripts/r.unpack/test_suite/test_int_uncompressed.ref rename to scripts/r.unpack/testsuite/test_int_uncompressed.ref From 206b69e2a1f5afc4820ccb82fc7bc50f9668334e Mon Sep 17 00:00:00 2001 From: Sharan Jamanani <54804304+Sharansrj567@users.noreply.github.com> Date: Sun, 14 Jan 2024 03:49:34 -0500 Subject: [PATCH 2/4] Imagery library: resolve cppcheck warnings (#3356) * fix: correct copy/paste error in color assignment logic of imagery library * refactor: add limits for fscanf to avoid crashing for large string inputs * refactor: reduce varible scope to address scope warning --- lib/imagery/group.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/imagery/group.c b/lib/imagery/group.c index 492ccc333d1..f7984884e01 100644 --- a/lib/imagery/group.c +++ b/lib/imagery/group.c @@ -45,7 +45,7 @@ int I_get_group(char *group) G_suppress_warnings(0); if (fd == NULL) return 0; - stat = (fscanf(fd, "%s", group) == 1); + stat = (fscanf(fd, "%255s", group) == 1); fclose(fd); return stat; } @@ -77,7 +77,7 @@ int I_get_subgroup(const char *group, char *subgroup) G_suppress_warnings(0); if (fd == NULL) return 0; - stat = (fscanf(fd, "%s", subgroup) == 1); + stat = (fscanf(fd, "%255s", subgroup) == 1); fclose(fd); return stat; } @@ -174,7 +174,6 @@ int I_get_subgroup_ref2(const char *group, const char *subgroup, static int get_ref(const char *group, const char *subgroup, const char *gmapset, struct Ref *ref) { - int n; char buf[1024]; char name[INAME_LEN], mapset[INAME_LEN]; char xname[GNAME_MAX], xmapset[GMAPSET_MAX]; @@ -200,8 +199,8 @@ static int get_ref(const char *group, const char *subgroup, const char *gmapset, return 0; while (G_getl2(buf, sizeof buf, fd)) { - n = sscanf(buf, "%255s %255s %15s", name, mapset, - color); /* better use INAME_LEN */ + int n = sscanf(buf, "%255s %255s %15s", name, mapset, + color); /* better use INAME_LEN */ if (n == 2 || n == 3) { I_add_file_to_group_ref(name, mapset, ref); if (n == 3) @@ -262,7 +261,7 @@ int I_init_ref_color_nums(struct Ref *ref) ref->blu.index = NULL; if (ref->nfiles <= 0 || ref->red.n >= 0 || ref->blu.n >= 0 || - ref->blu.n >= 0) + ref->grn.n >= 0) return 1; switch (ref->nfiles) { case 1: From ddf374e23b8be28f4c4cccf8b85876da9b8d11e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Sun, 14 Jan 2024 11:48:19 -0500 Subject: [PATCH 3/4] CI(labeler): Fix RFC exclusion from docs, adjust other globs (#3360) * CI(labeler): Fix RFC exclusion from docs * CI(labeler): Simplify double star globs when appropriate * CI(labeler): Add database to `**.sql` files --- .github/labeler.yml | 90 ++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 46 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index 1b91a8d6527..d69558da359 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -2,89 +2,89 @@ libraries: - changed-files: - any-glob-to-any-file: - - lib/**/* - - include/grass/* - - include/grass/**/* - - python/**/* + - lib/** + - include/grass/** + - python/** module: - changed-files: - any-glob-to-any-file: - - db/**/* - - display/**/* - - general/**/* - - imagery/**/* - - misc/**/* - - ps/**/* - - raster/**/* - - raster3d/**/* - - scripts/**/* - - temporal/**/* - - vector/**/* + - db/** + - display/** + - general/** + - imagery/** + - misc/** + - ps/** + - raster/** + - raster3d/** + - scripts/** + - temporal/** + - vector/** # Module categories database: - changed-files: - any-glob-to-any-file: - - db/**/* - - lib/db/**/* + - db/** + - lib/db/** - scripts/db.*/** + - '**.sql' display: - changed-files: - any-glob-to-any-file: - - display/**/* - - lib/display/**/* + - display/** + - lib/display/** - scripts/d.*/** general: - changed-files: - any-glob-to-any-file: - - general/**/* + - general/** - scripts/g.*/** GUI: - changed-files: - any-glob-to-any-file: - - gui/**/* + - gui/** imagery: - changed-files: - any-glob-to-any-file: - - imagery/**/* - - lib/imagery/**/* + - imagery/** + - lib/imagery/** - scripts/i.*/** misc: - changed-files: - any-glob-to-any-file: - - misc/**/* + - misc/** - scripts/m.*/** raster: - changed-files: - any-glob-to-any-file: - - raster/**/* - - lib/raster/**/* + - raster/** + - lib/raster/** - scripts/r.*/** raster3d: - changed-files: - any-glob-to-any-file: - - raster3d/**/* - - lib/raster3d/**/* + - raster3d/** + - lib/raster3d/** - scripts/r3.*/** temporal: - changed-files: - any-glob-to-any-file: - - temporal/**/* - - lib/temporal/**/* + - temporal/** + - lib/temporal/** - scripts/t.*/** vector: - changed-files: - any-glob-to-any-file: - - vector/**/* - - lib/vector/**/* + - vector/** + - lib/vector/** - scripts/v.*/** # Build, packaging, or OS related CI: - changed-files: - any-glob-to-any-file: - - .github/**/* - - .travis/**/* + - .github/** + - .travis/** - binder/** - .travis.yml - renovate.json @@ -92,31 +92,30 @@ CI: Windows: - changed-files: - any-glob-to-any-file: - - mswindows/**/* + - mswindows/** macOS: - changed-files: - any-glob-to-any-file: - - macosx/**/* + - macosx/** Linux: - changed-files: - any-glob-to-any-file: - - singularity/**/* + - singularity/** - rpm/** docker: - changed-files: - any-glob-to-any-file: - - docker/**/* + - docker/** - '**/*Dockerfile*' - '**/*dockerfile*' - - '*Dockerfile*' - - '*dockerfile*' - .dockerignore docs: +- all: - changed-files: - any-glob-to-any-file: - - doc/**/* - - man/**/* + - doc/** + - man/** - '**/*.md' - '**/*.rst' - '**/*.html' @@ -129,14 +128,14 @@ docs: - NEWS - TODO - all-globs-to-all-files: - - '!doc/development/rfc/*' + - '!doc/development/rfc/**' RFC: - changed-files: - any-glob-to-any-file: - - doc/development/rfc/* + - doc/development/rfc/** translation: - changed-files: - - any-glob-to-any-file: locale/**/* + - any-glob-to-any-file: locale/** # based on file types Python: @@ -144,7 +143,6 @@ Python: - any-glob-to-any-file: - '**/*.py' - '**/pyproject.toml' - - 'pyproject.toml' C: - changed-files: - any-glob-to-any-file: '**/*.c' From 4c6be3ee077ab954aa5c0c8bd1438b8f168e67f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Mon, 15 Jan 2024 07:07:11 -0500 Subject: [PATCH 4/4] CI(CodeQL): Improve run times and add concurrency groups (#3361) --- .github/workflows/codeql-analysis.yml | 49 ++++++++++++++++++++------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 97908f62fa1..76d4f3ceb02 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -16,49 +16,72 @@ on: # Check every Saturday at 18:36 - cron: 36 18 * * 6 +permissions: {} + jobs: analyze: - name: ${{ matrix.language }} + name: Analyze runs-on: ubuntu-22.04 + permissions: + security-events: write + actions: read + contents: read strategy: fail-fast: false matrix: - # C is included in cpp, no separate C language available on CodeQL language: - - cpp + - c-cpp - python + concurrency: + group: ${{ github.workflow }}-${{ + github.event_name == 'pull_request' && + github.head_ref || github.sha }}-${{ matrix.language }} + cancel-in-progress: true + steps: - name: Checkout repository uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + - name: Set up Python + uses: actions/setup-python@v5 with: - languages: ${{ matrix.language }} - config-file: ./.github/codeql/codeql-config.yml - - - name: Get dependencies + python-version: '3.x' + - name: Install non-Python dependencies + if: ${{ matrix.language == 'c-cpp' }} run: | sudo apt-get update -y sudo apt-get install -y wget git gawk findutils xargs -a <(awk '! /^ *(#|$)/' ".github/workflows/apt.txt") -r -- \ sudo apt-get install -y --no-install-recommends --no-install-suggests + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + config-file: ./.github/codeql/codeql-config.yml + setup-python-dependencies: false + - name: Create installation directory run: | - mkdir $HOME/install + mkdir "${HOME}/install" - name: Set LD_LIBRARY_PATH for compilation run: | - echo "LD_LIBRARY_PATH=$HOME/install/lib" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=${HOME}/install/lib" >> $GITHUB_ENV + + - name: Set number of cores for compilation + run: | + echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV - name: Build + if: ${{ matrix.language == 'c-cpp' }} env: CFLAGS: -std=gnu11 CXXFLAGS: -std=c++11 - run: .github/workflows/build_ubuntu-22.04.sh $HOME/install + run: .github/workflows/build_ubuntu-22.04.sh "${HOME}/install" - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}"