From 333317cf5ff44941fce6df24002d05ffda46c3f5 Mon Sep 17 00:00:00 2001 From: Preshanth Jagannathan Date: Tue, 10 Jun 2025 07:51:36 -0600 Subject: [PATCH 1/9] spack package for parafeed --- spack/parafeed/package.py | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 spack/parafeed/package.py diff --git a/spack/parafeed/package.py b/spack/parafeed/package.py new file mode 100644 index 0000000..6a4a6d9 --- /dev/null +++ b/spack/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 From 8e64659feb9605be52aaaab0b600a413c18f4f83 Mon Sep 17 00:00:00 2001 From: Preshanth Jagannathan Date: Wed, 11 Jun 2025 22:52:22 -0600 Subject: [PATCH 2/9] Trying to update CI to build with spack and check --- .github/workflows/parafeed_CI.yml | 28 +++++++++++++++++++++++++++- spack/repo.yml | 2 ++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 spack/repo.yml diff --git a/.github/workflows/parafeed_CI.yml b/.github/workflows/parafeed_CI.yml index 8ba5dbd..f97bbec 100644 --- a/.github/workflows/parafeed_CI.yml +++ b/.github/workflows/parafeed_CI.yml @@ -39,4 +39,30 @@ jobs: uses: actions/upload-artifact@v4 with: name: parafeed-artifacts-cxx${{ matrix.cxx_std }} - path: build/ \ No newline at end of file + path: build/ + + - name: Cache Spack clone + 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.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 + run: | + ./spack/bin/spack repo add ./spack + + - name: Create and activate Spack environment + run: | + ./spack/bin/spack env create parafeed-env + ./spack/bin/spack env activate parafeed-env + + - name: Install parafeed with Spack + run: | + ./spack/bin/spack install parafeed/parafeed diff --git a/spack/repo.yml b/spack/repo.yml new file mode 100644 index 0000000..ff752dd --- /dev/null +++ b/spack/repo.yml @@ -0,0 +1,2 @@ +repo: + namespace: parafeed \ No newline at end of file From 9a382f4be3f3157c3b8c5578a787acd6738ceb44 Mon Sep 17 00:00:00 2001 From: Preshanth Jagannathan Date: Wed, 11 Jun 2025 22:55:26 -0600 Subject: [PATCH 3/9] Updating the path to spack repo --- .github/workflows/parafeed_CI.yml | 2 +- {spack => spack_package}/parafeed/package.py | 0 {spack => spack_package}/repo.yml | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename {spack => spack_package}/parafeed/package.py (100%) rename {spack => spack_package}/repo.yml (100%) diff --git a/.github/workflows/parafeed_CI.yml b/.github/workflows/parafeed_CI.yml index f97bbec..eb863b8 100644 --- a/.github/workflows/parafeed_CI.yml +++ b/.github/workflows/parafeed_CI.yml @@ -56,7 +56,7 @@ jobs: - name: Register local parafeed repo with Spack run: | - ./spack/bin/spack repo add ./spack + ./spack/bin/spack repo add ./spack_package - name: Create and activate Spack environment run: | diff --git a/spack/parafeed/package.py b/spack_package/parafeed/package.py similarity index 100% rename from spack/parafeed/package.py rename to spack_package/parafeed/package.py diff --git a/spack/repo.yml b/spack_package/repo.yml similarity index 100% rename from spack/repo.yml rename to spack_package/repo.yml From 84141a4f86ab6d80b04e93b0e39664ec7ada609d Mon Sep 17 00:00:00 2001 From: Preshanth Jagannathan Date: Wed, 11 Jun 2025 22:57:45 -0600 Subject: [PATCH 4/9] Renaming yaml extensions correctly --- .github/workflows/{parafeed_CI.yml => parafeed_CI.yaml} | 0 spack_package/{repo.yml => repo.yaml} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{parafeed_CI.yml => parafeed_CI.yaml} (100%) rename spack_package/{repo.yml => repo.yaml} (100%) diff --git a/.github/workflows/parafeed_CI.yml b/.github/workflows/parafeed_CI.yaml similarity index 100% rename from .github/workflows/parafeed_CI.yml rename to .github/workflows/parafeed_CI.yaml diff --git a/spack_package/repo.yml b/spack_package/repo.yaml similarity index 100% rename from spack_package/repo.yml rename to spack_package/repo.yaml From e94add2fd02291e27d8be59dab1e5b8909c801d2 Mon Sep 17 00:00:00 2001 From: Preshanth Jagannathan Date: Wed, 11 Jun 2025 23:02:15 -0600 Subject: [PATCH 5/9] Moving to make the spack_package a repo --- spack_package/{ => packages}/parafeed/package.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename spack_package/{ => packages}/parafeed/package.py (100%) diff --git a/spack_package/parafeed/package.py b/spack_package/packages/parafeed/package.py similarity index 100% rename from spack_package/parafeed/package.py rename to spack_package/packages/parafeed/package.py From a70e5e3e283ea9be5170e65e7887ea504d504bcd Mon Sep 17 00:00:00 2001 From: Preshanth Jagannathan Date: Wed, 11 Jun 2025 23:06:23 -0600 Subject: [PATCH 6/9] activating spack shell --- .github/workflows/parafeed_CI.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/parafeed_CI.yaml b/.github/workflows/parafeed_CI.yaml index eb863b8..080ed49 100644 --- a/.github/workflows/parafeed_CI.yaml +++ b/.github/workflows/parafeed_CI.yaml @@ -61,7 +61,8 @@ jobs: - name: Create and activate Spack environment run: | ./spack/bin/spack env create parafeed-env - ./spack/bin/spack env activate parafeed-env + . ./spack/share/spack/setup-env.sh + spack env activate parafeed-env - name: Install parafeed with Spack run: | From 62089815d43f01c461073f530c7d0f40f32f52e8 Mon Sep 17 00:00:00 2001 From: Preshanth Jagannathan Date: Wed, 11 Jun 2025 23:07:44 -0600 Subject: [PATCH 7/9] Fixing spack install --- .github/workflows/parafeed_CI.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/parafeed_CI.yaml b/.github/workflows/parafeed_CI.yaml index 080ed49..430a7f1 100644 --- a/.github/workflows/parafeed_CI.yaml +++ b/.github/workflows/parafeed_CI.yaml @@ -66,4 +66,6 @@ jobs: - name: Install parafeed with Spack run: | - ./spack/bin/spack install parafeed/parafeed + spack add parafeed + spack concretize + spack install --jobs $(nproc) From 4a4a4312f78a29738c9490367e1e11bdca0e3c4d Mon Sep 17 00:00:00 2001 From: Preshanth Jagannathan Date: Wed, 11 Jun 2025 23:11:45 -0600 Subject: [PATCH 8/9] Fixing spack install to be in the same step as env creation --- .github/workflows/parafeed_CI.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/parafeed_CI.yaml b/.github/workflows/parafeed_CI.yaml index 430a7f1..2429b56 100644 --- a/.github/workflows/parafeed_CI.yaml +++ b/.github/workflows/parafeed_CI.yaml @@ -58,14 +58,12 @@ jobs: run: | ./spack/bin/spack repo add ./spack_package - - name: Create and activate Spack environment + - name: Create and activate and install Spack environment run: | ./spack/bin/spack env create parafeed-env . ./spack/share/spack/setup-env.sh spack env activate parafeed-env - - - name: Install parafeed with Spack - run: | spack add parafeed - spack concretize + spack concretize spack install --jobs $(nproc) + spack env deactivate From 0298d372a440f4c93ab744498348c7fc890e710e Mon Sep 17 00:00:00 2001 From: Preshanth Jagannathan Date: Wed, 11 Jun 2025 23:22:32 -0600 Subject: [PATCH 9/9] Conditional running of spack only when spack_packages changes. --- .github/workflows/parafeed_CI.yaml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/parafeed_CI.yaml b/.github/workflows/parafeed_CI.yaml index 2429b56..f2c4dde 100644 --- a/.github/workflows/parafeed_CI.yaml +++ b/.github/workflows/parafeed_CI.yaml @@ -41,7 +41,17 @@ jobs: 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 @@ -50,15 +60,17 @@ jobs: spack-v0.23.1- - name: Clone Spack v0.23.1 - if: steps.cache-spack.outputs.cache-hit != 'true' + 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 @@ -67,3 +79,7 @@ jobs: 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."