diff --git a/.github/workflows/parafeed_CI.yaml b/.github/workflows/parafeed_CI.yaml new file mode 100644 index 0000000..f2c4dde --- /dev/null +++ b/.github/workflows/parafeed_CI.yaml @@ -0,0 +1,85 @@ +name: CI + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build-and-test: + runs-on: ubuntu-24.04 + strategy: + matrix: + cxx_std: [11, 17] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y build-essential cmake pkg-config bison flex libreadline-dev + + - name: Configure CMake + run: | + cmake -S . -B build -DENABLE_TESTING=ON -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} + + - name: Build + run: | + cmake --build build -- -j$(nproc) + + - name: Run tests + run: | + cd build + ctest --output-on-failure + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: parafeed-artifacts-cxx${{ matrix.cxx_std }} + path: build/ + + - name: Check for changes in spack_package + id: spack_changes + run: | + if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '^spack_package/'; then + echo "changed=true" >> $GITHUB_OUTPUT + else + echo "changed=false" >> $GITHUB_OUTPUT + fi + + - name: Cache Spack clone + if: steps.spack_changes.outputs.changed == 'true' + uses: actions/cache@v4 + with: + path: spack + key: spack-v0.23.1-${{ runner.os }} + restore-keys: | + spack-v0.23.1- + + - name: Clone Spack v0.23.1 + if: steps.spack_changes.outputs.changed == 'true' && steps.cache-spack.outputs.cache-hit != 'true' + run: | + git clone --branch v0.23.1 https://github.com/spack/spack.git + + - name: Register local parafeed repo with Spack + if: steps.spack_changes.outputs.changed == 'true' + run: | + ./spack/bin/spack repo add ./spack_package + + - name: Create and activate and install Spack environment + if: steps.spack_changes.outputs.changed == 'true' + run: | + ./spack/bin/spack env create parafeed-env + . ./spack/share/spack/setup-env.sh + spack env activate parafeed-env + spack add parafeed + spack concretize + spack install --jobs $(nproc) + spack env deactivate + + - name: Skip Spack steps (no changes in spack_package) + if: steps.spack_changes.outputs.changed != 'true' + run: echo "No changes in spack_package, skipping Spack steps." diff --git a/.github/workflows/parafeed_CI.yml b/.github/workflows/parafeed_CI.yml deleted file mode 100644 index 8ba5dbd..0000000 --- a/.github/workflows/parafeed_CI.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: CI - -on: - push: - branches: [ main, master ] - pull_request: - branches: [ main, master ] - -jobs: - build-and-test: - runs-on: ubuntu-24.04 - strategy: - matrix: - cxx_std: [11, 17] - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y build-essential cmake pkg-config bison flex libreadline-dev - - - name: Configure CMake - run: | - cmake -S . -B build -DENABLE_TESTING=ON -DCMAKE_CXX_STANDARD=${{ matrix.cxx_std }} - - - name: Build - run: | - cmake --build build -- -j$(nproc) - - - name: Run tests - run: | - cd build - ctest --output-on-failure - - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: parafeed-artifacts-cxx${{ matrix.cxx_std }} - path: build/ \ No newline at end of file diff --git a/spack_package/packages/parafeed/package.py b/spack_package/packages/parafeed/package.py new file mode 100644 index 0000000..6a4a6d9 --- /dev/null +++ b/spack_package/packages/parafeed/package.py @@ -0,0 +1,45 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * +from spack.build_systems.cmake import CMakePackage + +class Parafeed(CMakePackage): + """Parafeed is a C++ library to parse and interact with the commandline.""" + + homepage = "https://github.com/sanbee/parafeed" + url = "https://github.com/sanbee/parafeed/archive/refs/tags/v1.1.41.tar.gz" + + maintainers("preshanth", "sanbee", "sanbw") + + # TODO: Check actual license in project. Replace "UNKNOWN" with actual SPDX identifier. + license("UNKNOWN", checked_by="sanbee") + + version("1.1.41", sha256="a5cb034914cab8b661469f2f1aae6af7d88045d54f3535da8ff004a04cd8abd3") + version("1.1.4", sha256="9ca767aa1139516926456fff14fec466890caba5646e46f0553c7b648bb5510e") + version("1.1.2", sha256="74eb62034b0c4cbfd9a4a05872c10d568b184e8cf7543405d460fc0c52001139") + version("1.1.1", sha256="757290ec76b3762febbaadca4c597f9d668be55767dbcfdba305ddc48cb07689") + + # Build-time and run-time dependencies + depends_on("readline") + depends_on("bison") + depends_on("flex") + depends_on("pkgconfig", type="build") + depends_on("cmake@3.1:", type="build") + + # C++ standard variant + variant( + "cxxstd", + default="11", + values=("11", "14", "17", "20", "23"), + description="C++ standard to use" + ) + + def cmake_args(self): + args = [ + self.define("CMAKE_CXX_STANDARD", self.spec.variants["cxxstd"].value), + self.define("CMAKE_CXX_STANDARD_REQUIRED", "ON"), + self.define("CMAKE_CXX_EXTENSIONS", "OFF") + ] + return args diff --git a/spack_package/repo.yaml b/spack_package/repo.yaml new file mode 100644 index 0000000..ff752dd --- /dev/null +++ b/spack_package/repo.yaml @@ -0,0 +1,2 @@ +repo: + namespace: parafeed \ No newline at end of file