<commit_before>image: dock0/arch
variables:
      GIT_SUBMODULE_STRATEGY: recursive

stages:
    - prepare
    - build
    - verify
    - upload

.enable_sudo_nobody: &enable_sudo_nobody
        echo "nobody ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers                  # Enable sudo to work without prompting a password

############################################################################### PKGBUILD #############################################################

.pkgbuild:prepare: &pkgbuild_prepare
    stage: prepare
    variables:
        MAKE_TARGETS: prepare
    script:
        - pacman -Sy --noconfirm --needed make sed lsb-release sudo git python-pip base-devel
        - exec-helper/gitlab/install-aur.sh microsoft-gsl-git         # AUR dependencies are not installed automatically by makepkg and must be installed beforehand. AUR helpers like yaourt on the other hand should be able to install it automagically
        - pip install gitchangelog
        - *enable_sudo_nobody
        - echo Making targets= ${MAKE_TARGETS}
        - sudo -u nobody make ${MAKE_TARGETS}
    artifacts:
        expire_in: 1 day
        paths:
            - pkgbuild/build_package/*

.pkgbuild:build: &pkgbuild_build
    stage: build
    variables:
        BUILD_DIR: pkgbuild/build_package
    script: 
        - pacman -Sy --noconfirm --needed base-devel sudo lsb-release
        - exec-helper/gitlab/install-aur.sh microsoft-gsl-git         # AUR dependencies are not installed automatically by makepkg and must be installed beforehand. AUR helpers like yaourt on the other hand should be able to install it automagically
        - *enable_sudo_nobody
        - cd $BUILD_DIR
        - sudo -u nobody makepkg --noconfirm --needed --syncdeps --force
    artifacts:
        expire_in: 1 day
        paths:
            - $BUILD_DIR/PKGBUILD
            - $BUILD_DIR/*.tar.xz

.pkgbuild:build-test: &pkgbuild_build_test
    stage: build
    variables:
        BUILD_DIR: pkgbuild/build_test
    script: 
        - pacman -Sy --noconfirm --needed sudo base-devel
        - exec-helper/gitlab/install-aur.sh libcatch-cpp-headers         # AUR dependencies are not installed automatically by makepkg and must be installed beforehand. AUR helpers like yaourt on the other hand should be able to install it automagically
        - exec-helper/gitlab/install-aur.sh microsoft-gsl-git            # AUR dependencies are not installed automatically by makepkg and must be installed beforehand. AUR helpers like yaourt on the other hand should be able to install it automagically
        - pacman -S --noconfirm --needed lsb-release namcap
        - *enable_sudo_nobody
        - sudo -u nobody make build-test
        - namcap $BUILD_DIR/PKGBUILD
        - namcap $BUILD_DIR/*.tar.xz
    artifacts:
        expire_in: 1 day
        paths:
            - $BUILD_DIR/*.tar.xz

.pkgbuild:analyze: &pkgbuild_analyze
    stage: verify
    variables:
        GIT_STRATEGY: none                          # Disable git and only rely on the artifacts
        BUILD_DIR: pkgbuild/build_package
        PACKAGE_DIR: package
    script:
        - pacman -Sy --noconfirm --needed yaml-cpp boost-libs gcc-libs namcap make
        - make PREFIX=$(pwd)/${PACKAGE_DIR} install
        - namcap ${PACKAGE_DIR}/PKGBUILD
        - namcap ${PACKAGE_DIR}/.SRCINFO
        - namcap ${BUILD_DIR}/*.tar.xz

.pkgbuild:verify: &pkgbuild_verify
    stage: verify
    variables:
        BUILD_DIR: pkgbuild/build_package
        TEST_BUILD_DIR: pkgbuild/build_test
    script:
        - pacman -Sy
        - pacman --needed --noconfirm -U $BUILD_DIR/*.tar.xz $TEST_BUILD_DIR/*.tar.xz
        - pacman -Sy --noconfirm --needed base-devel curl gcc clang make scons clang-tools-extra cppcheck git java-environment unzip wget valgrind
        - exec-helper-integration-test
        - verification/run-examples.sh
<commit_msg>Fix: Dev: Fixed pkgbuild:analyze step. !minor<commit_after>image: dock0/arch
variables:
      GIT_SUBMODULE_STRATEGY: recursive

stages:
    - prepare
    - build
    - verify
    - upload

.enable_sudo_nobody: &enable_sudo_nobody
        echo "nobody ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers                  # Enable sudo to work without prompting a password

############################################################################### PKGBUILD #############################################################

.pkgbuild:prepare: &pkgbuild_prepare
    stage: prepare
    variables:
        MAKE_TARGETS: prepare
    script:
        - pacman -Sy --noconfirm --needed make sed lsb-release sudo git python-pip base-devel
        - exec-helper/gitlab/install-aur.sh microsoft-gsl-git         # AUR dependencies are not installed automatically by makepkg and must be installed beforehand. AUR helpers like yaourt on the other hand should be able to install it automagically
        - pip install gitchangelog
        - *enable_sudo_nobody
        - echo Making targets= ${MAKE_TARGETS}
        - sudo -u nobody make ${MAKE_TARGETS}
    artifacts:
        expire_in: 1 day
        paths:
            - pkgbuild/build_package/*

.pkgbuild:build: &pkgbuild_build
    stage: build
    variables:
        BUILD_DIR: pkgbuild/build_package
    script: 
        - pacman -Sy --noconfirm --needed base-devel sudo lsb-release
        - exec-helper/gitlab/install-aur.sh microsoft-gsl-git         # AUR dependencies are not installed automatically by makepkg and must be installed beforehand. AUR helpers like yaourt on the other hand should be able to install it automagically
        - *enable_sudo_nobody
        - cd $BUILD_DIR
        - sudo -u nobody makepkg --noconfirm --needed --syncdeps --force
    artifacts:
        expire_in: 1 day
        paths:
            - $BUILD_DIR/PKGBUILD
            - $BUILD_DIR/*.tar.xz

.pkgbuild:build-test: &pkgbuild_build_test
    stage: build
    variables:
        BUILD_DIR: pkgbuild/build_test
    script: 
        - pacman -Sy --noconfirm --needed sudo base-devel
        - exec-helper/gitlab/install-aur.sh libcatch-cpp-headers         # AUR dependencies are not installed automatically by makepkg and must be installed beforehand. AUR helpers like yaourt on the other hand should be able to install it automagically
        - exec-helper/gitlab/install-aur.sh microsoft-gsl-git            # AUR dependencies are not installed automatically by makepkg and must be installed beforehand. AUR helpers like yaourt on the other hand should be able to install it automagically
        - pacman -S --noconfirm --needed lsb-release namcap
        - *enable_sudo_nobody
        - sudo -u nobody make build-test
        - namcap $BUILD_DIR/PKGBUILD
        - namcap $BUILD_DIR/*.tar.xz
    artifacts:
        expire_in: 1 day
        paths:
            - $BUILD_DIR/*.tar.xz

.pkgbuild:analyze: &pkgbuild_analyze
    stage: verify
    variables:
        BUILD_DIR: pkgbuild/build_package
        PACKAGE_DIR: package
    script:
        - pacman -Sy --noconfirm --needed yaml-cpp boost-libs gcc-libs namcap make
        - make PREFIX=$(pwd)/${PACKAGE_DIR} install
        - namcap ${PACKAGE_DIR}/PKGBUILD
        - namcap ${PACKAGE_DIR}/.SRCINFO
        - namcap ${BUILD_DIR}/*.tar.xz

.pkgbuild:verify: &pkgbuild_verify
    stage: verify
    variables:
        BUILD_DIR: pkgbuild/build_package
        TEST_BUILD_DIR: pkgbuild/build_test
    script:
        - pacman -Sy
        - pacman --needed --noconfirm -U $BUILD_DIR/*.tar.xz $TEST_BUILD_DIR/*.tar.xz
        - pacman -Sy --noconfirm --needed base-devel curl gcc clang make scons clang-tools-extra cppcheck git java-environment unzip wget valgrind
        - exec-helper-integration-test
        - verification/run-examples.sh

{'fraction_non_alphanumeric': 0.11197815060476005, 'fraction_numerical': 0.001040447392378723, 'mean_word_length': 2.44997756841633, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '293329', 'n_tokens_mistral': 2345, 'n_tokens_neox': 2193, 'n_words': 651}