Skip to content

Commit

Permalink
Add license headers validation (#458)
Browse files Browse the repository at this point in the history
* Add .licenserc.yaml file

* Fix license headers

* Add github action to check license headers

* Fix workflow

* Fix checkout path

* Rename workflow

* Add debug info

* Disable workflows

* Try fix

* Split check workflow in two jobs

* Try invalid license header

* Comment of failure

* Disable cppcheck job

* Fix licenserc file

* Enable debug logging

* Prevent comments from licence-eye

* Revert "Disable cppcheck job"

This reverts commit 10f5537.

* Revert "Disable workflows"

This reverts commit 2e2ead2.

* Fix typo

* Revert "Try invalid license header"

This reverts commit 0cc0c88.

* Update year in license headers

* Cleanup

* Fix indention in license header
  • Loading branch information
artemgavrilov authored Apr 26, 2024
1 parent 61256fa commit 288ec63
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 20 deletions.
29 changes: 22 additions & 7 deletions .github/workflows/cppcheck.yml → .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,49 @@
name: cppcheck-action-test
name: Checks
on:
pull_request:

jobs:
build:
name: cppcheck-test
cppcheck:
name: Cppcheck
runs-on: ubuntu-22.04
steps:

steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
path: src/pg_stat_monitor

- name: Checkout cppcheck sources
uses: actions/checkout@v4
with:
repository: 'danmar/cppcheck'
ref: '2.13.4'
repository: "danmar/cppcheck"
ref: "2.13.4"
path: src/cppcheck

- name: Build and install cppcheck
working-directory: src/cppcheck
run: |
mkdir build
cd build
cmake ..
cmake --build .
sudo cmake --install .
working-directory: src/cppcheck
- name: Execute linter check with cppcheck
working-directory: src/pg_stat_monitor
run: |
set -x
cppcheck --enable=all --inline-suppr --template='{file}:{line},{severity},{id},{message}' --error-exitcode=1 --suppress=missingIncludeSystem --suppress=missingInclude --suppress=unmatchedSuppression:pg_stat_monitor.c --check-config .
license:
name: License
runs-on: ubuntu-22.04

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Check license headers
uses: apache/skywalking-eyes/header@v0.6.0
with:
token: "" # Prevent comments
19 changes: 19 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
header:
paths:
- "**/*.c"
- "**/*.h"
license:
pattern: |
.*\.(c|h)
.*
Portions Copyright © 2018-2024, Percona LLC and/or its affiliates
Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
Portions Copyright (c) 1994, The Regents of the University of California
IDENTIFICATION
contrib/pg_stat_monitor/.*\.(c|h)
comment: never
8 changes: 4 additions & 4 deletions guc.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*-------------------------------------------------------------------------
*
* guc.c: guc variable handling of pg_stat_monitor
* guc.c
* guc variable handling of pg_stat_monitor
*
* Portions Copyright © 2018-2020, Percona LLC and/or its affiliates
* Portions Copyright © 2018-2024, Percona LLC and/or its affiliates
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
*
* Portions Copyright (c) 1994, The Regents of the University of California
*
*
* IDENTIFICATION
* contrib/pg_stat_monitor/guc.c
*
Expand Down
6 changes: 3 additions & 3 deletions hash_query.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*-------------------------------------------------------------------------
*
* hash_query.c
* Track statement execution times across a whole database cluster.
* Track statement execution times across a whole database cluster.
*
* Portions Copyright © 2018-2020, Percona LLC and/or its affiliates
* Portions Copyright © 2018-2024, Percona LLC and/or its affiliates
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
*
* Portions Copyright (c) 1994, The Regents of the University of California
*
Expand Down
6 changes: 3 additions & 3 deletions pg_stat_monitor.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*-------------------------------------------------------------------------
*
* pg_stat_monitor.c
* Track statement execution times across a whole database cluster.
* Track statement execution times across a whole database cluster.
*
* Portions Copyright © 2018-2020, Percona LLC and/or its affiliates
* Portions Copyright © 2018-2024, Percona LLC and/or its affiliates
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
*
* Portions Copyright (c) 1994, The Regents of the University of California
*
Expand Down
6 changes: 3 additions & 3 deletions pg_stat_monitor.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*-------------------------------------------------------------------------
*
* pg_stat_monitor.h
* Track statement execution times across a whole database cluster.
* Track statement execution times across a whole database cluster.
*
* Portions Copyright © 2018-2020, Percona LLC and/or its affiliates
* Portions Copyright © 2018-2024, Percona LLC and/or its affiliates
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
*
* Portions Copyright (c) 1994, The Regents of the University of California
*
Expand Down

0 comments on commit 288ec63

Please sign in to comment.