<commit_before>name: Build with Clang/LLVM

on: pull_request_target

jobs:
  clang-build-prep:
    runs-on: ubuntu-latest
    steps:
      - name: Cancel Previous Runs
        uses: styfle/cancel-workflow-action@0.6.0
        with:
          access_token: ${{ github.token }}
  clang-build:
    runs-on: zephyr_runner
    needs: clang-build-prep
    container:
      image: zephyrprojectrtos/ci:v0.18.4
      options: '--entrypoint /bin/bash'
    strategy:
      fail-fast: false
      matrix:
        platform: ["native_posix"]
    env:
      ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.13.1
      CLANG_ROOT_DIR: /usr/lib/llvm-12
      COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
    outputs:
      report_needed: ${{ steps.twister.outputs.report_needed }}
    steps:
      - name: Cancel Previous Runs
        uses: styfle/cancel-workflow-action@0.6.0
        with:
          access_token: ${{ github.token }}
      - name: Update PATH for west
        run: |
          echo "$HOME/.local/bin" >> $GITHUB_PATH

      - name: checkout
        uses: actions/checkout@v2
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 0

      - name: west setup
        run: |
          west init -l . || true
          # In some cases modules are left in a state where they can't be
          # updated (i.e. when we cancel a job and the builder is killed),
          # So first retry to update, if that does not work, remove all modules
          # and start over. (Workaround until we implement more robust module
          # west caching).
          west update 2>&1 1> west.log || west update 2>&1 1> west2.log || ( rm -rf ../modules && west update)

      - name: Check Environment
        run: |
          cmake --version
          ${CLANG_ROOT_DIR}/bin/clang --version
          gcc --version
          ls -la
      - name: Prepare ccache timestamp/data
        id: ccache_cache_timestamp
        shell: cmake -P {0}
        run: |
          string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
          string(REPLACE "/" "_" repo ${{github.repository}})
          string(REPLACE "-" "_" repo2 ${repo})
          message("::set-output name=repo::${repo2}")
      - name: use cache
        id: cache-ccache
        uses: nashif/action-s3-cache@master
        with:
          key: ${{ steps.ccache_cache_timestamp.outputs.repo }}-clang-${{ matrix.platform }}-ccache
          path: /github/home/.ccache
          aws-s3-bucket: ccache.zephyrproject.org
          aws-access-key-id: ${{ secrets.CCACHE_S3_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.CCACHE_S3_SECRET_ACCESS_KEY }}
          aws-region: us-east-2

      - name: ccache stats initial
        run: |
          test -d github/home/.ccache && mv github/home/.ccache /github/home/.ccache
          ccache -M 10G -s

      - name: Run Tests with Twister
        id: twister
        run: |
          git config --global user.email "<EMAIL>"
          git config --global user.name "<NAME>"
          export ZEPHYR_BASE=${PWD}<commit_msg>actions: clang: add branch name to ccache key<commit_after>name: Build with Clang/LLVM

on: pull_request_target

jobs:
  clang-build-prep:
    runs-on: ubuntu-latest
    steps:
      - name: Cancel Previous Runs
        uses: styfle/cancel-workflow-action@0.6.0
        with:
          access_token: ${{ github.token }}
  clang-build:
    runs-on: zephyr_runner
    needs: clang-build-prep
    container:
      image: zephyrprojectrtos/ci:v0.18.4
      options: '--entrypoint /bin/bash'
    strategy:
      fail-fast: false
      matrix:
        platform: ["native_posix"]
    env:
      ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.13.1
      CLANG_ROOT_DIR: /usr/lib/llvm-12
      COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
    outputs:
      report_needed: ${{ steps.twister.outputs.report_needed }}
    steps:
      - name: Cancel Previous Runs
        uses: styfle/cancel-workflow-action@0.6.0
        with:
          access_token: ${{ github.token }}
      - name: Update PATH for west
        run: |
          echo "$HOME/.local/bin" >> $GITHUB_PATH

      - name: checkout
        uses: actions/checkout@v2
        with:
          ref: ${{ github.event.pull_request.head.sha }}
          fetch-depth: 0

      - name: west setup
        run: |
          west init -l . || true
          # In some cases modules are left in a state where they can't be
          # updated (i.e. when we cancel a job and the builder is killed),
          # So first retry to update, if that does not work, remove all modules
          # and start over. (Workaround until we implement more robust module
          # west caching).
          west update 2>&1 1> west.log || west update 2>&1 1> west2.log || ( rm -rf ../modules && west update)

      - name: Check Environment
        run: |
          cmake --version
          ${CLANG_ROOT_DIR}/bin/clang --version
          gcc --version
          ls -la
      - name: Prepare ccache timestamp/data
        id: ccache_cache_timestamp
        shell: cmake -P {0}
        run: |
          string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
          string(REPLACE "/" "_" repo ${{github.repository}})
          string(REPLACE "-" "_" repo2 ${repo})
          message("::set-output name=repo::${repo2}")
      - name: use cache
        id: cache-ccache
        uses: nashif/action-s3-cache@master
        with:
          key: ${{ steps.ccache_cache_timestamp.outputs.repo }}-${{ github.ref_name }}-clang-${{ matrix.platform }}-ccache
          path: /github/home/.ccache
          aws-s3-bucket: ccache.zephyrproject.org
          aws-access-key-id: ${{ secrets.CCACHE_S3_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.CCACHE_S3_SECRET_ACCESS_KEY }}
          aws-region: us-east-2

      - name: ccache stats initial
        run: |
          test -d github/home/.ccache && mv github/home/.ccache /github/home/.ccache
          ccache -M 10G -s

      - name: Run Tests with Twister
        id: twister
        run: |
          git config --global user.email "<EMAIL>"
          git config --global user.name "<NAME>"
          export ZEPHYR_BASE=${PWD}
{'fraction_non_alphanumeric': 0.12227699157258706, 'fraction_numerical': 0.01113054539672444, 'mean_word_length': 1.955827067669173, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 19, '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': '5973791', 'n_tokens_mistral': 2080, 'n_tokens_neox': 1982, 'n_words': 491}