Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Licenses and Intel Copyrights + add verification #230

Merged
merged 9 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .checkpatch.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
--ignore PREFER_DEFINED_ATTRIBUTE_MACRO
--ignore COMPLEX_MACRO
--ignore LONG_LINE_STRING
--ignore EMBEDDED_FILENAME
File renamed without changes.
5 changes: 0 additions & 5 deletions tests/install_ubuntu_packages.sh → .github/configure_apt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,3 @@ echo "Detected VERSION_CODENAME: $VERSION_CODENAME"
# Add ubuntu repository
sudo add-apt-repository "deb [arch=amd64] http://archive.ubuntu.com/ubuntu $VERSION_CODENAME \
main universe"
# Install gcc
sudo apt-get update && sudo apt-get install gcc-$1 g++-$1
# Install dependencies
sudo apt-get install pkg-config automake autoconf autoconf-archive make libsgutils2-dev \
libudev-dev libpci-dev check devscripts
9 changes: 9 additions & 0 deletions .github/install_debs_compilation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/bash

# Install gcc
if [ -z "$1" ]; then
sudo apt-get update && sudo apt-get install gcc-$1 g++-$1
fi
# Install dependencies
sudo apt-get install pkg-config automake autoconf autoconf-archive make libsgutils2-dev \
libudev-dev libpci-dev check devscripts
106 changes: 28 additions & 78 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: review
on: [pull_request]
env:
cflags: -Werror
cflags: -Werror
permissions: read-all
jobs:
checkpatch:
name: checkpatch review
commits_review:
name: Commits review
runs-on: ubuntu-latest
steps:
- name: 'Calculate PR commits + 1'
Expand All @@ -16,78 +16,28 @@ jobs:
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
- name: Run checkpatch review
uses: webispy/checkpatch-action@v9
make:
name: Compilation test with gcc
strategy:
matrix:
gcc-version: [7, 8, 9, 10, 11, 12, 13]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Add ubuntu repository and install dependencies'
run: tests/install_ubuntu_packages.sh ${{ matrix.gcc-version }}
- name: 'Generate compiling configurations with library disabled'
run: . ./autogen.sh && ./configure CFLAGS=${{ env.cflags }}
- name: 'Make'
run: CC=gcc-${{ matrix.gcc-version }} CXX=g++-${{ matrix.gcc-version }} && V=1 make -j$(nproc)
- name: 'Hardening check: ledmon'
run: hardening-check src/ledmon/ledmon
- name: 'Hardening check: ledctl'
run: hardening-check src/ledctl/ledctl
- name: 'Check public symbol visibility'
run: tests/check_symbol_visibility.sh
- name: "Clean before retest with library enabled"
run: make clean
- name: 'Generate compiling configurations with library enabled'
run: . tests/build_configure.sh ${{ env.cflags }}
- name: 'Make'
run: CC=gcc-${{ matrix.gcc-version }} CXX=g++-${{ matrix.gcc-version }} && V=1 make -j$(nproc)
- name: 'Hardening check: ledmon'
run: hardening-check src/ledmon/ledmon
- name: 'Hardening check: ledctl'
run: hardening-check src/ledctl/ledctl
- name: 'Check public symbol visibility'
run: tests/check_symbol_visibility.sh
clangcompile:
name: Compilation test with clang
strategy:
matrix:
gcc-version: [12]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Add ubuntu repository and install dependencies'
run: tests/install_ubuntu_packages.sh ${{ matrix.gcc-version }}
- name: 'Install clang'
run: sudo apt-get install clang
- name: 'Generate compiling configurations'
run: . tests/build_configure.sh ${{ env.cflags }} clang
- name: 'Make'
run: V=1 make -j$(nproc)
tests:
name: Run tests
strategy:
matrix:
gcc-version: [12]
python-version: ["3.7"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Add ubuntu repository and install dependencies'
run: tests/install_ubuntu_packages.sh ${{ matrix.gcc-version }}
- name: 'Generate compiling configurations'
run: . tests/build_configure.sh ${{ env.cflags }}
- name: 'Make'
run: CC=gcc-${{ matrix.gcc-version }} CXX=g++-${{ matrix.gcc-version }} && V=1 make -j$(nproc)
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
- name: Run tests using pytest
run: |
# Run only non-hardware dependent tests
pytest --ledctl-binary=src/ledctl/ledctl
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Get modified files
id: changed-files
uses: tj-actions/changed-files@v44
with:
files_ignore: |
.checkpatch.conf
.github/**
LICENSES/**
.gitignore
*.md
autogen.sh
pytest.ini
*.yapf
COPYING*
- name: Run license review
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for FILE in ${ALL_CHANGED_FILES}; do
python3.11 ./tests/licensing.py --file ${FILE} --log-level=INFO
done
84 changes: 84 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: test
on: [pull_request]
env:
cflags: -Werror
permissions: read-all
jobs:
make:
name: Compilation test with gcc
strategy:
matrix:
gcc-version: [7, 8, 9, 10, 11, 12, 13]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Add ubuntu repositories'
run: .github/configure_apt.sh
- name: 'Install building dependencies'
run: .github/install_debs_compilation.sh ${{ matrix.gcc-version }}
- name: 'Generate compiling configurations with library disabled'
run: . ./autogen.sh && ./configure CFLAGS=${{ env.cflags }}
- name: 'Make'
run: CC=gcc-${{ matrix.gcc-version }} CXX=g++-${{ matrix.gcc-version }} && V=1 make -j$(nproc)
- name: 'Hardening check: ledmon'
run: hardening-check src/ledmon/ledmon
- name: 'Hardening check: ledctl'
run: hardening-check src/ledctl/ledctl
- name: 'Check public symbol visibility'
run: tests/check_symbol_visibility.sh
- name: "Clean before retest with library enabled"
run: make clean
- name: 'Generate compiling configurations with library enabled'
run: . .github/build_configure.sh ${{ env.cflags }}
- name: 'Make'
run: CC=gcc-${{ matrix.gcc-version }} CXX=g++-${{ matrix.gcc-version }} && V=1 make -j$(nproc)
- name: 'Hardening check: ledmon'
run: hardening-check src/ledmon/ledmon
- name: 'Hardening check: ledctl'
run: hardening-check src/ledctl/ledctl
- name: 'Check public symbol visibility'
run: tests/check_symbol_visibility.sh
clangcompile:
name: Compilation test with clang
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Add ubuntu repositories'
run: .github/configure_apt.sh
- name: 'Install building dependencies'
run: .github/install_debs_compilation.sh
- name: 'Install clang'
run: sudo apt-get install clang
- name: 'Generate compiling configurations'
run: .github/build_configure.sh ${{ env.cflags }} clang
- name: 'Make'
run: V=1 make -j$(nproc)
tests:
name: Run tests
strategy:
matrix:
gcc-version: [12]
python-version: ["3.7"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Add ubuntu repositories'
run: .github/configure_apt.sh
- name: 'Install building dependencies'
run: .github/install_debs_compilation.sh ${{ matrix.gcc-version }}
- name: 'Generate compiling configurations'
run: .github/build_configure.sh ${{ env.cflags }}
- name: 'Make'
run: CC=gcc-${{ matrix.gcc-version }} CXX=g++-${{ matrix.gcc-version }} && V=1 make -j$(nproc)
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
- name: Run tests using pytest
run: |
# Run only non-hardware dependent tests
pytest --ledctl-binary=src/ledctl/ledctl
21 changes: 21 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Header and Copyrights

Verification of License and Copyrights is automated on Github by
[Licensing test](https://github.com/intel/ledmon/blob/main/tests/licensing.py).

The rules for Licenses and Copyrights:
- Preferred comment mark should be used for file type. Please prefer to test or other files for
examples. For `.c` and `.h` files, it is `//`.
- [SPDX Licenses](https://spdx.org/licenses/) must be used:
- It must be on first or in third line (only if interpreter is defined);
- Verification script contains set of allowed licenses for directories to avoid legal issues.
If you need to honour other license type, test must be extended.
- Immediately after SPDX header Copyright lines may come. There are multiple Copyrights lines
allowed.
- Only Intel copyright must follow strict style check.
- The block must be ended by empty line.

# Coding

Commits must pass kernel [Checkpatch](https://docs.kernel.org/dev-tools/checkpatch.html). There are
some excludes and it is automatically tested on Github.
Loading