diff --git a/CMakeLists.txt b/CMakeLists.txt index e905e4bc..2cfc7749 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,9 @@ include(infra/cmake/beman-install-library-config.cmake) add_subdirectory(src/beman/exemplar) +find_package(beman-install-library REQUIRED) +beman_install_library(beman.exemplar) + if(BEMAN_EXEMPLAR_BUILD_TESTS) enable_testing() add_subdirectory(tests/beman/exemplar) diff --git a/src/beman/exemplar/beman.exemplar-config.cmake.in b/cmake/beman.exemplar-config.cmake.in similarity index 100% rename from src/beman/exemplar/beman.exemplar-config.cmake.in rename to cmake/beman.exemplar-config.cmake.in diff --git a/cookiecutter/{{cookiecutter.project_name}}/CMakeLists.txt b/cookiecutter/{{cookiecutter.project_name}}/CMakeLists.txt index 830c85f9..3e992ae2 100644 --- a/cookiecutter/{{cookiecutter.project_name}}/CMakeLists.txt +++ b/cookiecutter/{{cookiecutter.project_name}}/CMakeLists.txt @@ -29,6 +29,9 @@ include(infra/cmake/beman-install-library-config.cmake) add_subdirectory(src/beman/{{cookiecutter.project_name}}) +find_package(beman-install-library REQUIRED) +beman_install_library(beman.{{cookiecutter.project_name}}) + if(BEMAN_{{cookiecutter.project_name.upper()}}_BUILD_TESTS) enable_testing() add_subdirectory(tests/beman/{{cookiecutter.project_name}}) diff --git a/cookiecutter/{{cookiecutter.project_name}}/src/beman/{{cookiecutter.project_name}}/beman.{{cookiecutter.project_name}}-config.cmake.in b/cookiecutter/{{cookiecutter.project_name}}/cmake/beman.{{cookiecutter.project_name}}-config.cmake.in similarity index 100% rename from cookiecutter/{{cookiecutter.project_name}}/src/beman/{{cookiecutter.project_name}}/beman.{{cookiecutter.project_name}}-config.cmake.in rename to cookiecutter/{{cookiecutter.project_name}}/cmake/beman.{{cookiecutter.project_name}}-config.cmake.in diff --git a/cookiecutter/{{cookiecutter.project_name}}/infra/.beman_submodule b/cookiecutter/{{cookiecutter.project_name}}/infra/.beman_submodule index e9e49f5c..fd26db25 100644 --- a/cookiecutter/{{cookiecutter.project_name}}/infra/.beman_submodule +++ b/cookiecutter/{{cookiecutter.project_name}}/infra/.beman_submodule @@ -1,3 +1,3 @@ [beman_submodule] remote=https://github.com/bemanproject/infra.git -commit_hash=ec701785a8106c2b7088c7928d6fe861e27d67bc +commit_hash=9f89e813b844915267b783289d386a09c69560d1 diff --git a/cookiecutter/{{cookiecutter.project_name}}/infra/.github/workflows/beman-tidy.yml b/cookiecutter/{{cookiecutter.project_name}}/infra/.github/workflows/beman-tidy.yml deleted file mode 100644 index 46221e6d..00000000 --- a/cookiecutter/{{cookiecutter.project_name}}/infra/.github/workflows/beman-tidy.yml +++ /dev/null @@ -1,111 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -name: beman-tidy tests - -on: - push: - branches: - - main - pull_request: - workflow_call: - workflow_dispatch: - schedule: - - cron: '0 6 * * *' # 09:00AM EEST (@neatudarius' timezone) - -jobs: - run_linter: - runs-on: ubuntu-latest - defaults: - run: - working-directory: tools/beman-tidy - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install uv - uses: astral-sh/setup-uv@v5 - - - name: Sync environment - run: | - uv sync - - - name: Run linter - run: | - uv run ruff check --diff - - run_tests: - runs-on: ubuntu-latest - defaults: - run: - working-directory: tools/beman-tidy - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install uv - uses: astral-sh/setup-uv@v5 - - - name: Sync environment - run: | - uv sync - - - name: Run tests - run: | - uv run pytest tests/ -v - - build_and_install: - runs-on: ubuntu-latest - defaults: - run: - working-directory: tools/beman-tidy - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install uv - uses: astral-sh/setup-uv@v5 - - - name: Sync environment - run: | - uv sync - - - name: Build and install beman-tidy - run: | - uv clean - uv build - python3 -m pip install dist/beman_tidy-0.1.0-py3-none-any.whl --force-reinstall - beman-tidy --help - - run_on_exemplar: - runs-on: ubuntu-latest - defaults: - run: - working-directory: tools/beman-tidy - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install uv - uses: astral-sh/setup-uv@v5 - - - name: Sync environment - run: | - uv sync - - - name: Build and install beman-tidy - run: | - uv clean - uv build - python3 -m pip install dist/beman_tidy-0.1.0-py3-none-any.whl --force-reinstall - beman-tidy --help - - - name: Run installed beman-tidy on exemplar repo - run: | - git clone https://github.com/bemanproject/exemplar.git - cd exemplar/ # Testing that beman-tidy can be run from any path, e.g. from the exemplar repo. - beman-tidy --verbose --require-all . - - create-issue-when-fault: - needs: [run_linter, run_tests, build_and_install, run_on_exemplar] - if: failure() && (github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') - uses: ./.github/workflows/reusable-beman-create-issue-when-fault.yml diff --git a/cookiecutter/{{cookiecutter.project_name}}/infra/.pre-commit-config.yaml b/cookiecutter/{{cookiecutter.project_name}}/infra/.pre-commit-config.yaml index e806e59b..bc4dd844 100644 --- a/cookiecutter/{{cookiecutter.project_name}}/infra/.pre-commit-config.yaml +++ b/cookiecutter/{{cookiecutter.project_name}}/infra/.pre-commit-config.yaml @@ -19,14 +19,3 @@ repos: - id: gersemi name: CMake linting exclude: ^.*/tests/.*/data/ # Exclude test data directories - - # Python linting and formatting - # config file: ruff.toml (not currently present but add if needed) - # https://docs.astral.sh/ruff/configuration/ - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.13.2 - hooks: - - id: ruff-check - files: ^tools/beman-tidy/ - - id: ruff-format - files: ^tools/beman-tidy/ diff --git a/cookiecutter/{{cookiecutter.project_name}}/infra/.pre-commit-hooks.yaml b/cookiecutter/{{cookiecutter.project_name}}/infra/.pre-commit-hooks.yaml deleted file mode 100644 index d327587c..00000000 --- a/cookiecutter/{{cookiecutter.project_name}}/infra/.pre-commit-hooks.yaml +++ /dev/null @@ -1,7 +0,0 @@ -- id: beman-tidy - name: "beman-tidy: bemanification your repo" - entry: ./tools/beman-tidy/beman-tidy - language: script - pass_filenames: false - always_run: true - args: [".", "--verbose"] diff --git a/cookiecutter/{{cookiecutter.project_name}}/infra/README.md b/cookiecutter/{{cookiecutter.project_name}}/infra/README.md index c2739688..16b26726 100644 --- a/cookiecutter/{{cookiecutter.project_name}}/infra/README.md +++ b/cookiecutter/{{cookiecutter.project_name}}/infra/README.md @@ -2,8 +2,6 @@ -[![beman-tidy tests](https://github.com/bemanproject/infra/actions/workflows/beman-tidy.yml/badge.svg)](https://github.com/bemanproject/infra/actions/workflows/beman-tidy.yml) - This repository contains the infrastructure for The Beman Project. This is NOT a library repository, so it does not respect the usual structure of a Beman library repository nor The Beman Standard! diff --git a/cookiecutter/{{cookiecutter.project_name}}/infra/cmake/beman-install-library-config.cmake b/cookiecutter/{{cookiecutter.project_name}}/infra/cmake/beman-install-library-config.cmake index e7fd0ad3..6fa4fa87 100644 --- a/cookiecutter/{{cookiecutter.project_name}}/infra/cmake/beman-install-library-config.cmake +++ b/cookiecutter/{{cookiecutter.project_name}}/infra/cmake/beman-install-library-config.cmake @@ -121,7 +121,7 @@ function(beman_install_library name) find_file( config_file_template NAMES "${package_name}-config.cmake.in" - PATHS "${CMAKE_CURRENT_SOURCE_DIR}" + PATHS "${PROJECT_SOURCE_DIR}/cmake" NO_DEFAULT_PATH NO_CACHE REQUIRED diff --git a/cookiecutter/{{cookiecutter.project_name}}/src/beman/{{cookiecutter.project_name}}/CMakeLists.txt b/cookiecutter/{{cookiecutter.project_name}}/src/beman/{{cookiecutter.project_name}}/CMakeLists.txt index ba64430a..c1100030 100644 --- a/cookiecutter/{{cookiecutter.project_name}}/src/beman/{{cookiecutter.project_name}}/CMakeLists.txt +++ b/cookiecutter/{{cookiecutter.project_name}}/src/beman/{{cookiecutter.project_name}}/CMakeLists.txt @@ -15,6 +15,3 @@ target_sources( ) set_target_properties(beman.{{cookiecutter.project_name}} PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON) - -find_package(beman-install-library REQUIRED) -beman_install_library(beman.{{cookiecutter.project_name}}) diff --git a/infra/.beman_submodule b/infra/.beman_submodule index e9e49f5c..fd26db25 100644 --- a/infra/.beman_submodule +++ b/infra/.beman_submodule @@ -1,3 +1,3 @@ [beman_submodule] remote=https://github.com/bemanproject/infra.git -commit_hash=ec701785a8106c2b7088c7928d6fe861e27d67bc +commit_hash=9f89e813b844915267b783289d386a09c69560d1 diff --git a/infra/.github/workflows/beman-tidy.yml b/infra/.github/workflows/beman-tidy.yml deleted file mode 100644 index 46221e6d..00000000 --- a/infra/.github/workflows/beman-tidy.yml +++ /dev/null @@ -1,111 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -name: beman-tidy tests - -on: - push: - branches: - - main - pull_request: - workflow_call: - workflow_dispatch: - schedule: - - cron: '0 6 * * *' # 09:00AM EEST (@neatudarius' timezone) - -jobs: - run_linter: - runs-on: ubuntu-latest - defaults: - run: - working-directory: tools/beman-tidy - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install uv - uses: astral-sh/setup-uv@v5 - - - name: Sync environment - run: | - uv sync - - - name: Run linter - run: | - uv run ruff check --diff - - run_tests: - runs-on: ubuntu-latest - defaults: - run: - working-directory: tools/beman-tidy - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install uv - uses: astral-sh/setup-uv@v5 - - - name: Sync environment - run: | - uv sync - - - name: Run tests - run: | - uv run pytest tests/ -v - - build_and_install: - runs-on: ubuntu-latest - defaults: - run: - working-directory: tools/beman-tidy - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install uv - uses: astral-sh/setup-uv@v5 - - - name: Sync environment - run: | - uv sync - - - name: Build and install beman-tidy - run: | - uv clean - uv build - python3 -m pip install dist/beman_tidy-0.1.0-py3-none-any.whl --force-reinstall - beman-tidy --help - - run_on_exemplar: - runs-on: ubuntu-latest - defaults: - run: - working-directory: tools/beman-tidy - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install uv - uses: astral-sh/setup-uv@v5 - - - name: Sync environment - run: | - uv sync - - - name: Build and install beman-tidy - run: | - uv clean - uv build - python3 -m pip install dist/beman_tidy-0.1.0-py3-none-any.whl --force-reinstall - beman-tidy --help - - - name: Run installed beman-tidy on exemplar repo - run: | - git clone https://github.com/bemanproject/exemplar.git - cd exemplar/ # Testing that beman-tidy can be run from any path, e.g. from the exemplar repo. - beman-tidy --verbose --require-all . - - create-issue-when-fault: - needs: [run_linter, run_tests, build_and_install, run_on_exemplar] - if: failure() && (github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') - uses: ./.github/workflows/reusable-beman-create-issue-when-fault.yml diff --git a/infra/.pre-commit-config.yaml b/infra/.pre-commit-config.yaml index e806e59b..bc4dd844 100644 --- a/infra/.pre-commit-config.yaml +++ b/infra/.pre-commit-config.yaml @@ -19,14 +19,3 @@ repos: - id: gersemi name: CMake linting exclude: ^.*/tests/.*/data/ # Exclude test data directories - - # Python linting and formatting - # config file: ruff.toml (not currently present but add if needed) - # https://docs.astral.sh/ruff/configuration/ - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.13.2 - hooks: - - id: ruff-check - files: ^tools/beman-tidy/ - - id: ruff-format - files: ^tools/beman-tidy/ diff --git a/infra/.pre-commit-hooks.yaml b/infra/.pre-commit-hooks.yaml deleted file mode 100644 index d327587c..00000000 --- a/infra/.pre-commit-hooks.yaml +++ /dev/null @@ -1,7 +0,0 @@ -- id: beman-tidy - name: "beman-tidy: bemanification your repo" - entry: ./tools/beman-tidy/beman-tidy - language: script - pass_filenames: false - always_run: true - args: [".", "--verbose"] diff --git a/infra/README.md b/infra/README.md index c2739688..16b26726 100644 --- a/infra/README.md +++ b/infra/README.md @@ -2,8 +2,6 @@ -[![beman-tidy tests](https://github.com/bemanproject/infra/actions/workflows/beman-tidy.yml/badge.svg)](https://github.com/bemanproject/infra/actions/workflows/beman-tidy.yml) - This repository contains the infrastructure for The Beman Project. This is NOT a library repository, so it does not respect the usual structure of a Beman library repository nor The Beman Standard! diff --git a/infra/cmake/beman-install-library-config.cmake b/infra/cmake/beman-install-library-config.cmake index e7fd0ad3..6fa4fa87 100644 --- a/infra/cmake/beman-install-library-config.cmake +++ b/infra/cmake/beman-install-library-config.cmake @@ -121,7 +121,7 @@ function(beman_install_library name) find_file( config_file_template NAMES "${package_name}-config.cmake.in" - PATHS "${CMAKE_CURRENT_SOURCE_DIR}" + PATHS "${PROJECT_SOURCE_DIR}/cmake" NO_DEFAULT_PATH NO_CACHE REQUIRED diff --git a/src/beman/exemplar/CMakeLists.txt b/src/beman/exemplar/CMakeLists.txt index 14d9f70e..2ce8c18b 100644 --- a/src/beman/exemplar/CMakeLists.txt +++ b/src/beman/exemplar/CMakeLists.txt @@ -15,6 +15,3 @@ target_sources( ) set_target_properties(beman.exemplar PROPERTIES VERIFY_INTERFACE_HEADER_SETS ON) - -find_package(beman-install-library REQUIRED) -beman_install_library(beman.exemplar)