Skip to content

Commit

Permalink
Merge pull request #195 from evelikov/ci
Browse files Browse the repository at this point in the history
Remove .in files, enable more warnings, add build/codeql CI
  • Loading branch information
gregkh authored Sep 21, 2024
2 parents ca7855e + 15f33f0 commit b52b8e9
Show file tree
Hide file tree
Showing 23 changed files with 325 additions and 146 deletions.
16 changes: 16 additions & 0 deletions .github/actions/setup-alpine/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'setup Alpine'
description: 'Setup an Alpine container for running CI'
runs:
using: 'composite'
steps:
- name: Install dependencies
shell: sh
run: |
apk update
apk add \
build-base \
eudev-dev \
git \
libusb-dev \
linux-headers \
meson
28 changes: 28 additions & 0 deletions .github/actions/setup-archlinux/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'setup Archlinux'
description: 'Setup an Archlinux container for running CI'
runs:
using: 'composite'
steps:
- name: Install dependencies
shell: bash
run: |
# Enable multilib, for building 32bit binaries
echo -e '[multilib]\nInclude = /etc/pacman.d/mirrorlist' >> /etc/pacman.conf
# Semi-regularly the packager key may have (temporarily) expired.
# Somewhat robust solution is to wipe the local keyring and
# regenerate/reinstall it prior to any other packages on the system.
rm -rf /etc/pacman.d/gnupg
pacman-key --init
pacman-key --populate
pacman --noconfirm -Sy archlinux-keyring
pacman --noconfirm -Su \
base-devel \
git \
lib32-libusb \
lib32-systemd \
libusb \
linux-headers \
multilib-devel \
meson \
systemd
23 changes: 23 additions & 0 deletions .github/actions/setup-debian/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'setup Debian'
description: 'Setup a Debian container for running CI'
runs:
using: 'composite'
steps:
- name: Install dependencies
shell: bash
run: |
dpkg --add-architecture i386
apt-get update
apt-get install --yes \
build-essential \
crossbuild-essential-i386 \
gcc \
git \
libudev-dev \
libudev-dev:i386 \
libusb-1.0-0-dev \
libusb-1.0-0-dev:i386 \
linux-libc-dev \
meson \
pkgconf \
pkgconf:i386
16 changes: 16 additions & 0 deletions .github/actions/setup-fedora/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'setup Fedora'
description: 'Setup a Fedora container for running CI'
runs:
using: 'composite'
steps:
- name: Install dependencies
shell: bash
run: |
dnf update -y
dnf install -y \
gcc \
git \
kernel-devel \
libudev-devel \
libusb1-devel \
meson
23 changes: 23 additions & 0 deletions .github/actions/setup-ubuntu/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'setup Ubuntu'
description: 'Setup an Ubuntu container for running CI'
runs:
using: 'composite'
steps:
- name: Install dependencies
shell: bash
run: |
dpkg --add-architecture i386
apt-get update
apt-get install --yes \
build-essential \
crossbuild-essential-i386 \
gcc \
git \
libudev-dev \
libudev-dev:i386 \
libusb-1.0-0-dev \
libusb-1.0-0-dev:i386 \
linux-libc-dev \
meson \
pkgconf \
pkgconf:i386
9 changes: 9 additions & 0 deletions .github/cross-files/arch-cross.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[binaries]
c = ['gcc', '-m32']
pkgconfig = 'i686-pc-linux-gnu-pkg-config'

[host_machine]
system = 'linux'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'
9 changes: 9 additions & 0 deletions .github/cross-files/debian-cross.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[binaries]
c = 'i686-linux-gnu-gcc'
pkgconfig = 'i686-linux-gnu-pkg-config'

[host_machine]
system = 'linux'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'
9 changes: 9 additions & 0 deletions .github/cross-files/ubuntu-cross.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[binaries]
c = 'i686-linux-gnu-gcc'
pkgconfig = 'i686-linux-gnu-pkg-config'

[host_machine]
system = 'linux'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "ci"
groups:
all-actions:
patterns:
- "*"
64 changes: 64 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CodeQL

on:
push:
branches: [master, ci-test]
pull_request:
branches: [master]
schedule:
- cron: "30 2 * * 0"

permissions:
contents: read

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
security-events: write

strategy:
fail-fast: false
matrix:
include:
- container: 'ubuntu:24.04'

container:
image: ${{ matrix.container }}

steps:
- name: Sparse checkout the local actions
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
sparse-checkout: .github

- uses: ./.github/actions/setup-ubuntu
if: ${{ startsWith(matrix.container, 'ubuntu') }}

- name: Checkout the whole project
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set the environment
run: |
# The second checkout above claims to set safe.directory, yet it
# doesn't quite work. Perhaps our double/sparse checkout is to blame?
git config --global --add safe.directory '*'
- name: Initialize CodeQL
uses: github/codeql-action/init@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7
with:
languages: cpp
queries: +security-and-quality

- name: Build
run: |
mkdir build && cd build
meson setup --native-file ../build-dev.ini . ..
meson compile
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@8214744c546c1e5c8f03dde8fab3a7353211988d # v3.26.7
with:
category: "/language:cpp"
82 changes: 82 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Build and Test

on:
push:
branches: [master, ci-test]
pull_request:
branches: [master]
schedule:
- cron: "30 2 * * 0"

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- container: 'alpine:latest'
- container: 'archlinux:base-devel'
crossfile: 'arch-cross.ini'
- container: 'debian:unstable'
crossfile: 'debian-cross.ini'
- container: 'fedora:latest'
- container: 'ubuntu:24.04'
crossfile: 'ubuntu-cross.ini'

container:
image: ${{ matrix.container }}

steps:
- name: Sparse checkout the local actions
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
sparse-checkout: .github

- uses: ./.github/actions/setup-alpine
if: ${{ startsWith(matrix.container, 'alpine') }}
- uses: ./.github/actions/setup-archlinux
if: ${{ startsWith(matrix.container, 'archlinux') }}
- uses: ./.github/actions/setup-debian
if: ${{ startsWith(matrix.container, 'debian') }}
- uses: ./.github/actions/setup-fedora
if: ${{ startsWith(matrix.container, 'fedora') }}
- uses: ./.github/actions/setup-ubuntu
if: ${{ startsWith(matrix.container, 'ubuntu') }}

- name: Checkout the whole project
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set the environment
run: |
# The second checkout above claims to set safe.directory, yet it
# doesn't quite work. Perhaps our double/sparse checkout is to blame?
git config --global --add safe.directory '*'
- name: configure
run: |
mkdir build && cd build
meson setup --native-file ../build-dev.ini . ..
- name: build
run: meson compile -C build

- name: install
run: meson install -C build --destdir $PWD/inst

- name: distcheck
run: meson dist -C build

- name: configure (32bit)
if: ${{ matrix.crossfile != '' }}
run: |
cp .github/cross-files/${{ matrix.crossfile }} cross.ini
mkdir build32 && cd build32
meson setup --native-file ../build-dev.ini --cross-file ../cross.ini . ..
- name: build (32bit)
if: ${{ matrix.crossfile != '' }}
run: meson compile -C build32
27 changes: 3 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2014-2021 Greg Kroah-Hartman <[email protected]>
# Copyright (c) 2009 Greg Kroah-Hartman <[email protected]>
*.o

*~
*.swp
.deps/
Makefile
Makefile.in
config.h
config.h.in
config.log
config.status
configure
stamp-h1
aclocal.m4
autom4te.cache/
depcomp
install-sh
missing
compile
lsusb
lsusb.py
lsusb.8
usb-devices.1
usbreset
usbhid-dump.8
*.gz
*.bz2
build*
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions build-dev.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[project options]
werror = true

[built-in options]
buildtype = 'debugoptimized'
File renamed without changes.
4 changes: 2 additions & 2 deletions lsusb.py.in → lsusb.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def myenum(*args):
return type('MyEnum', (), enums)

def parse_usb_ids():
"Parse /usr/share/usb.ids and fill usbvendors, usbproducts, usbclasses"
"Parse /usr/share/{hwdata/,}usb.ids and fill usbvendors, usbproducts, usbclasses"
vid = 0
did = 0
modes = myenum('Vendor', 'Class', 'Misc')
Expand Down Expand Up @@ -467,7 +467,7 @@ def usage():
print(" -C, --no-color disable colors")
print(" -e, --endpoints display endpoint info")
print(" -f FILE, --usbids-path FILE")
print(" override filename for /usr/share/usb.ids")
print(" override filename for /usr/share/{hwdata/,}usb.ids")
print(" -w, --wakeup display power wakeup setting")
print()
print("Use lsusb.py -ciu to get a nice overview of your USB devices.")
Expand Down
File renamed without changes.
Loading

0 comments on commit b52b8e9

Please sign in to comment.