<commit_before>name: Test

on: [push]

jobs:
  test:
    name: Test (${{ matrix.os }} / node ${{ matrix.node }})
    runs-on: ${{ matrix.os }}
    continue-on-error: ${{ matrix.experimental }}

    strategy:
      matrix:
        os: [ubuntu-latest]
        node: [12, 14, 16]
        experimental: [false]
        include:
          - os: windows-latest
            node: 16
            experimental: true

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Cache node modules
        uses: actions/cache@v2
        env:
          # added -vX just to reset the cache, feel free to up it if you need
          # to reset the cache again
          cache-name: cache-node-modules-v4
        with:
          path: ~/.npm
          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-build-${{ env.cache-name }}-

      - name: Install npm dependencies
        env:
          CYPRESS_INSTALL_BINARY: '0'
        run: npm install

      - name: Test individual modules
        run: npx jest && lerna run --scope groq --scope '@sanity/{client,generate-help-url,plugin-loader}' test

      - name: Build modules
        run: npm run build

      - name: Build CLI
        run: |
          # Build CLI to a single file
          cd packages/@sanity/cli
          npm run pack

          # Remove source and dependencies from CLI to ensure it works standalone
          rm -rf packages/@sanity/cli/node_modules
          rm -rf packages/@sanity/cli/src && rm -rf packages/@sanity/cli/lib

          # Allow running the Sanity CLI tool without specifying absolute path
          echo "${GITHUB_WORKSPACE}/packages/@sanity/cli/bin" >> $GITHUB_PATH

      - name: Test sanity build command
        run: |
          # Test building the test studio with all customizations
          cd $GITHUB_WORKSPACE/examples/test-studio
          sanity build -y

      - name: Test sanity init command
        run: |
          # Test initializing a project in unattended mode
          cd /tmp
          sanity init -y --project=ppsg7ml5 --dataset=test --output-path=/tmp/test-project

      - name: Test build with new code
        run: |
          # Use the newly commited changes instead of the latest dependencies from NPM
          cd /tmp/test-project
          $GITHUB_WORKSPACE/scripts/symlinkDependencies.js .

          # Test building the project with latest dependencies
          sanity build --skip-minify

      - name: Notify Slack about build failure
        if: failure() && github.ref == 'refs/heads/ui/main'
        env:
          SLACK_BOT_TOKEN: ${{ secrets.ACTIONS_SLACK_BOT_TOKEN }}
        uses: voxmedia/github-action-slack-notify-build@v1
        with:
          channel: studio-internal
          status: FAILED
          color: danger<commit_msg>ci(github): attempt using bash shell for cli build<commit_after>name: Test

on: [push]

jobs:
  test:
    name: Test (${{ matrix.os }} / node ${{ matrix.node }})
    runs-on: ${{ matrix.os }}
    continue-on-error: ${{ matrix.experimental }}

    strategy:
      matrix:
        os: [ubuntu-latest]
        node: [12, 14, 16]
        experimental: [false]
        include:
          - os: windows-latest
            node: 16
            experimental: true

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Cache node modules
        uses: actions/cache@v2
        env:
          # added -vX just to reset the cache, feel free to up it if you need
          # to reset the cache again
          cache-name: cache-node-modules-v4
        with:
          path: ~/.npm
          key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-build-${{ env.cache-name }}-

      - name: Install npm dependencies
        env:
          CYPRESS_INSTALL_BINARY: '0'
        run: npm install

      - name: Test individual modules
        run: npx jest && lerna run --scope groq --scope '@sanity/{client,generate-help-url,plugin-loader}' test

      - name: Build modules
        run: npm run build

      - name: Build CLI
        shell: bash
        run: |
          # Build CLI to a single file
          cd packages/@sanity/cli
          npm run pack

          # Remove source and dependencies from CLI to ensure it works standalone
          npx rimraf packages/@sanity/cli/node_modules
          npx rimraf packages/@sanity/cli/src && npx rimraf packages/@sanity/cli/lib

          # Allow running the Sanity CLI tool without specifying absolute path
          echo "${GITHUB_WORKSPACE}/packages/@sanity/cli/bin" >> $GITHUB_PATH

      - name: Test sanity build command
        shell: bash
        run: |
          # Test building the test studio with all customizations
          cd $GITHUB_WORKSPACE/examples/test-studio
          sanity build -y

      - name: Test sanity init command
        shell: bash
        run: |
          # Test initializing a project in unattended mode
          cd $RUNNER_TEMP
          sanity init -y --project=ppsg7ml5 --dataset=test --output-path=$RUNNER_TEMP/test-project

      - name: Test build with new code
        shell: bash
        run: |
          # Use the newly commited changes instead of the latest dependencies from NPM
          cd $RUNNER_TEMP/test-project
          $GITHUB_WORKSPACE/scripts/symlinkDependencies.js .

          # Test building the project with latest dependencies
          sanity build --skip-minify

      - name: Notify Slack about build failure
        if: failure() && github.ref == 'refs/heads/ui/main'
        env:
          SLACK_BOT_TOKEN: ${{ secrets.ACTIONS_SLACK_BOT_TOKEN }}
        uses: voxmedia/github-action-slack-notify-build@v1
        with:
          channel: studio-internal
          status: FAILED
          color: danger
{'fraction_non_alphanumeric': 0.09889923793395428, 'fraction_numerical': 0.005080440304826418, 'mean_word_length': 1.8476374156219866, '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': '2612838', 'n_tokens_mistral': 1748, 'n_tokens_neox': 1642, 'n_words': 516}