LCOV - code coverage report
Current view: top level - include/esys/repo - cienv.h (source / functions) Hit Total Coverage
Test: esysrepo_coverage.info Lines: 0 1 0.0 %
Date: 2026-08-12 14:26:50 Functions: 0 0 -

          Line data    Source code
       1             : /*!
       2             :  * \file esys/repo/cienv.h
       3             :  * \brief Detect CI engine identity and revision (ADR-0021 ``pin --ci``)
       4             :  *
       5             :  * \cond
       6             :  * __legal_b__
       7             :  *
       8             :  * Copyright (c) 2026 Michel Gillet
       9             :  * Distributed under the MIT License.
      10             :  * (See accompanying file LICENSE.txt or
      11             :  * copy at https://opensource.org/licenses/MIT)
      12             :  *
      13             :  * __legal_e__
      14             :  * \endcond
      15             :  *
      16             :  */
      17             : 
      18             : #pragma once
      19             : 
      20             : #include "esys/repo/esysrepo_defs.h"
      21             : #include "esys/repo/result.h"
      22             : 
      23             : #include <string>
      24             : 
      25             : namespace esys::repo
      26             : {
      27             : 
      28             : /*! \brief Known CI engines for ``pin --ci`` V1 */
      29             : enum class CIEngine
      30             : {
      31             :     NONE = 0,
      32             :     GITLAB,
      33             :     GITHUB,
      34             : };
      35             : 
      36             : /*! \class CIEnv esys/repo/cienv.h "esys/repo/cienv.h"
      37             :  * \brief Snapshot of identity + SHA from the process environment
      38             :  */
      39             : class ESYSREPO_API CIEnv
      40             : {
      41             : public:
      42           0 :     CIEnv() = default;
      43             : 
      44             :     CIEngine get_engine() const;
      45             :     const std::string &get_project() const;
      46             :     const std::string &get_url() const;
      47             :     const std::string &get_rev() const;
      48             : 
      49             :     //! Detect GitLab or GitHub Actions from the environment
      50             :     static Result detect(CIEnv &out);
      51             : 
      52             : private:
      53             :     CIEngine m_engine = CIEngine::NONE;
      54             :     std::string m_project;
      55             :     std::string m_url;
      56             :     std::string m_rev;
      57             : };
      58             : 
      59             : } // namespace esys::repo

Generated by: LCOV version 1.14