<commit_before>name: Main

on:
  workflow_dispatch:
  push:
    paths-ignore:
      - '*.md'
    branches:
      - main
      - master
  pull_request:
    paths-ignore:
      - '*.md'
    branches:
      - main
      - master

env:
  CARGO_TERM_COLOR:  always

jobs:
  codestyle:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-nightly-cargo-${{ hashFiles('Cargo.lock') }}
      - name: Set up Rust
        uses: hecrj/setup-rust-action@v1
        with:
          components: rustfmt
          rust-version: nightly
      - run: cargo fmt --all -- --check

  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-stable-cargo-${{ hashFiles('Cargo.lock') }}
      - name: Set up Rust
        uses: hecrj/setup-rust-action@v1
        with:
          components: clippy
      - run: cargo clippy --all-targets --all-features -- -D clippy::all

  compile:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-stable-cargo-${{ hashFiles('Cargo.lock') }}
      - name: Set up Rust
        uses: hecrj/setup-rust-action@v1
      - run: cargo check --all

  test:
    needs: [codestyle, lint, compile]
    strategy:
      matrix:
        os: [ubuntu-latest, macOS-latest]
        rust: [stable]
    runs-on: ${{ matrix.os }}

    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: Setup Rust
      uses: hecrj/setup-rust-action@v1
      with:
        rust-version: ${{ matrix.rust }}
    - name: Test
      run: cargo test

  publish-crate:
    if: startsWith(github.ref, 'refs/tags/')
    needs: [test]
    runs-on: ubuntu-latest
    steps:
      - name: Set up Rust
        uses: hecrj/setup-rust-action@v1
      - uses: actions/checkout@v1
      - name: Publish
        if: startsWith(github.ref, 'refs/tags/') && env.CRATES_TOKEN
        shell: bash
        run: cargo publish --token ${{ env.CRATES_TOKEN }}
        env:
          CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}<commit_msg>publish docs<commit_after>name: Main

on:
  workflow_dispatch:
  push:
    paths-ignore:
      - '*.md'
    branches:
      - main
      - master
  pull_request:
    paths-ignore:
      - '*.md'
    branches:
      - main
      - master

env:
  CARGO_TERM_COLOR:  always

jobs:
  codestyle:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-nightly-cargo-${{ hashFiles('Cargo.lock') }}
      - name: Set up Rust
        uses: hecrj/setup-rust-action@v1
        with:
          components: rustfmt
          rust-version: nightly
      - run: cargo fmt --all -- --check

  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-stable-cargo-${{ hashFiles('Cargo.lock') }}
      - name: Set up Rust
        uses: hecrj/setup-rust-action@v1
        with:
          components: clippy
      - run: cargo clippy --all-targets --all-features -- -D clippy::all

  compile:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-stable-cargo-${{ hashFiles('Cargo.lock') }}
      - name: Set up Rust
        uses: hecrj/setup-rust-action@v1
      - run: cargo check --all

  test:
    needs: [codestyle, lint, compile]
    strategy:
      matrix:
        os: [ubuntu-latest, macOS-latest]
        rust: [stable]
    runs-on: ${{ matrix.os }}

    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: Setup Rust
      uses: hecrj/setup-rust-action@v1
      with:
        rust-version: ${{ matrix.rust }}
    - name: Test
      run: cargo test

  publish-docs:
    if: github.ref == 'refs/heads/master'
    runs-on: ubuntu-latest
    needs: [test]
    steps:
      - name: Set up Rust
        uses: hecrj/setup-rust-action@v1
      - uses: actions/checkout@v2
      - name: Generate Docs
        run: |
          cargo doc --no-deps
          echo "<meta http-equiv=refresh content=0;url=`echo ${{ github.repository  }} | cut -d / -f 2 | tr '-' '_'`/index.html>" > target/doc/index.html
      - name: Publish
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./target/doc

  publish-crate:
    if: startsWith(github.ref, 'refs/tags/')
    needs: [test]
    runs-on: ubuntu-latest
    steps:
      - name: Set up Rust
        uses: hecrj/setup-rust-action@v1
      - uses: actions/checkout@v1
      - name: Publish
        if: startsWith(github.ref, 'refs/tags/') && env.CRATES_TOKEN
        shell: bash
        run: cargo publish --token ${{ env.CRATES_TOKEN }}
        env:
          CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
{'fraction_non_alphanumeric': 0.1328658755843222, 'fraction_numerical': 0.005573534699748292, 'mean_word_length': 1.627775153519131, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, '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': '1521280', 'n_tokens_mistral': 1908, 'n_tokens_neox': 1844, 'n_words': 402}