From 4acef346c2ce8a0dadd2edba48e36d8daae511f5 Mon Sep 17 00:00:00 2001 From: Ihor Dutchak Date: Mon, 1 May 2023 13:10:32 +0300 Subject: [PATCH] ci: Docker build for Archlinux (#536) Use GithubActions Docker build for Archlinux builds. To avoid using `builds.sr.ht`. Related: #476 --- .builds/archlinux.yml | 35 ----------------- .github/workflows/builds.yml | 74 ++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 35 deletions(-) delete mode 100644 .builds/archlinux.yml diff --git a/.builds/archlinux.yml b/.builds/archlinux.yml deleted file mode 100644 index 704ebbc..0000000 --- a/.builds/archlinux.yml +++ /dev/null @@ -1,35 +0,0 @@ -image: archlinux -packages: -- autoconf -- automake -- libtool -- libusb -- libudev0 -- cmake -- ninja -sources: -- https://github.com/libusb/hidapi -tasks: -- configure: | - cd hidapi - echo Configure Autotools build - ./bootstrap - ./configure - echo Configure CMake build - mkdir -p build install_cmake - cmake -GNinja -B build -S . -DCMAKE_INSTALL_PREFIX=install_cmake -- build-autotools: | - cd hidapi - make - make DESTDIR=$PWD/root install - make clean -- build-cmake: | - cd hidapi/build - ninja - ninja install - ninja clean -- build-manual: | - cd hidapi/linux - make -f Makefile-manual - cd ../libusb - make -f Makefile-manual diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 601d1f3..1bcb0b1 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -382,3 +382,77 @@ jobs: "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}" cd build/static_test ninja install + + + archlinux: + + runs-on: ubuntu-latest + container: archlinux:latest + steps: + - uses: actions/checkout@v3 + with: + path: hidapisrc + - name: Install dependencies + run: | + pacman -Sy + pacman -S --noconfirm gcc pkg-config autoconf automake libtool libusb libudev0 cmake make + - name: Configure CMake + run: | + rm -rf build install + cmake -B build/shared-cmake -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/shared-cmake -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}" + cmake -B build/static-cmake -S hidapisrc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=install/static-cmake -DBUILD_SHARED_LIBS=FALSE -DHIDAPI_BUILD_HIDTEST=ON "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}" + - name: Configure Automake + working-directory: hidapisrc + run: | + ./bootstrap + ./configure + - name: Build CMake Shared + working-directory: build/shared-cmake + run: make install + - name: Build CMake Static + working-directory: build/static-cmake + run: make install + - name: Build Automake + working-directory: hidapisrc + run: | + make + make DESTDIR=$PWD/../install/automake install + make clean + - name: Build manual Makefile + run: | + cd hidapisrc/linux + make -f Makefile-manual + cd ../libusb + make -f Makefile-manual + - name: Check artifacts + uses: andstor/file-existence-action@v2 + with: + files: "install/shared-cmake/lib/libhidapi-libusb.so, \ + install/shared-cmake/lib/libhidapi-hidraw.so, \ + install/shared-cmake/include/hidapi/hidapi.h, \ + install/shared-cmake/include/hidapi/hidapi_libusb.h, \ + install/static-cmake/lib/libhidapi-libusb.a, \ + install/static-cmake/lib/libhidapi-hidraw.a, \ + install/static-cmake/include/hidapi/hidapi.h, \ + install/static-cmake/include/hidapi/hidapi_libusb.h" + fail: true + - name: Check CMake Export Package Shared + run: | + cmake \ + -B build/shared_test \ + -S hidapisrc/hidtest \ + -Dhidapi_ROOT=install/shared-cmake \ + -DCMAKE_INSTALL_PREFIX=install/shared_test \ + "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}" + cd build/shared_test + make install + - name: Check CMake Export Package Static + run: | + cmake \ + -B build/static_test \ + -S hidapisrc/hidtest \ + -Dhidapi_ROOT=install/static-cmake \ + -DCMAKE_INSTALL_PREFIX=install/static_test \ + "-DCMAKE_C_FLAGS=${NIX_COMPILE_FLAGS}" + cd build/static_test + make install