Skip to content

Commit

Permalink
github: add license review
Browse files Browse the repository at this point in the history
Test each updated file. There are some files and directories excluded
from testing. It is specified in review job.

Update workflow to install required packages separatelly. Move github
scripts to .github directory (to avoid unlicensed files in other
locations).
Fix requiring gcc when clang is in use (discovered after updating clang
review flow).

Signed-off-by: Mariusz Tkaczyk <[email protected]>
  • Loading branch information
mtkaczyk committed May 23, 2024
1 parent 6409088 commit 695030f
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 85 deletions.
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
105 changes: 27 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,27 @@ 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/**
.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
3 changes: 1 addition & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ AM_PROG_AR
LT_INIT

# Checks for programs.

AX_CHECK_PROG([gcc])
AC_PROG_CC[gcc clang]
AX_CHECK_PROG([make])


Expand Down

0 comments on commit 695030f

Please sign in to comment.