<commit_before>dependencies:
  pre:
    - sudo apt-get update; sudo apt-get install fftw3-dev libtiff5-dev libjpeg-dev

defaults: &steps
  steps:
    - checkout

    ## setup -------------------------------

    - run:
        name: Set environmental variables
        command: |
          Rscript --vanilla \
            -e 'dsc <- read.dcf("DESCRIPTION")' \
            -e 'cat(sprintf("export PKG_TARBALL=%s_%s.tar.gz\n", dsc[,"Package"], dsc[,"Version"]))' \
            -e 'cat(sprintf("export RCHECK_DIR=%s.Rcheck\n", dsc[,"Package"]))' \
            >> ${BASH_ENV}

    ## install dependencies ------------------
    
    - restore_cache:
          keys:
            - deps1-{{ .Branch }}-{{ checksum "DESCRIPTION" }}
            - deps1-{{ .Branch }}
            - deps1-

    - run:
        name: Install devtools and dependencies
        command: |
          Rscript \
            -e 'if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools")' \
            -e 'devtools::install_deps(dependencies = TRUE)'
            
    - save_cache:
          key: deps1-{{ .Branch }}-{{ checksum "DESCRIPTION" }}
          paths:
            - "/usr/local/lib/R/site-library"

    ## build and test -----------------

    - run:
        name: Build package
        command: R CMD build .

    - run:
        name: Check package
        command: R CMD check "${PKG_TARBALL}" --as-cran --no-manual
    - run:
        name: Check failures
        command: |
          Rscript -e "message(devtools::check_failures(path = '${RCHECK_DIR}'))"
          # warnings are errors
          # - run: if grep -q -R "WARNING" "${RCHECK_DIR}/00check.log"; then exit 1; fi

    ## store artifacts -----------------

    - run:
        command: mv ${RCHECK_DIR} /tmp/Rcheck
        when: always
    - store_test_results:
        path: /tmp/Rcheck/tests/
        when: always
    - store_artifacts:
        path: /tmp/Rcheck
        when: always

version: 2
jobs:
  "r-release":
     docker:
       - image: rocker/tidyverse:latest
     <<: *steps

  "r-devel":
     docker:
       - image: rocker/tidyverse:devel
     <<: *steps

workflows:
  version: 2
  build_and_test:
    jobs:
      - "r-release"
      - "r-devel"
<commit_msg>adding unix deps, fixing config<commit_after>defaults: &steps
  steps:
    - checkout

    ## setup -------------------------------

    - run:
        name: Set environmental variables
        command: |
          Rscript --vanilla \
            -e 'dsc <- read.dcf("DESCRIPTION")' \
            -e 'cat(sprintf("export PKG_TARBALL=%s_%s.tar.gz\n", dsc[,"Package"], dsc[,"Version"]))' \
            -e 'cat(sprintf("export RCHECK_DIR=%s.Rcheck\n", dsc[,"Package"]))' \
            >> ${BASH_ENV}

    - run:
        name: Unix deps
        command: |
          sudo apt-get update; sudo apt-get install fftw3-dev libtiff5-dev libjpeg-dev

    ## install dependencies ------------------
    - restore_cache:
          keys:
            - deps1-{{ .Branch }}-{{ checksum "DESCRIPTION" }}
            - deps1-{{ .Branch }}
            - deps1-

    - run:
        name: Install devtools and dependencies
        command: |
          Rscript \
            -e 'if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools")' \
            -e 'devtools::install_deps(dependencies = TRUE)'
            
    - save_cache:
          key: deps1-{{ .Branch }}-{{ checksum "DESCRIPTION" }}
          paths:
            - "/usr/local/lib/R/site-library"

    ## build and test -----------------

    - run:
        name: Build package
        command: R CMD build .

    - run:
        name: Check package
        command: R CMD check "${PKG_TARBALL}" --as-cran --no-manual
    - run:
        name: Check failures
        command: |
          Rscript -e "message(devtools::check_failures(path = '${RCHECK_DIR}'))"
          # warnings are errors
          # - run: if grep -q -R "WARNING" "${RCHECK_DIR}/00check.log"; then exit 1; fi

    ## store artifacts -----------------

    - run:
        command: mv ${RCHECK_DIR} /tmp/Rcheck
        when: always
    - store_test_results:
        path: /tmp/Rcheck/tests/
        when: always
    - store_artifacts:
        path: /tmp/Rcheck
        when: always

version: 2
jobs:
  "r-release":
     docker:
       - image: rocker/tidyverse:latest
     <<: *steps

  "r-devel":
     docker:
       - image: rocker/tidyverse:devel
     <<: *steps

workflows:
  version: 2
  build_and_test:
    jobs:
      - "r-release"
      - "r-devel"

{'fraction_non_alphanumeric': 0.17013274336283185, 'fraction_numerical': 0.0048672566371681415, 'mean_word_length': 1.56875, 'pattern_counts': {'":': 4, '<': 13, '<?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': '767478', 'n_tokens_mistral': 1467, 'n_tokens_neox': 1415, 'n_words': 321}