<commit_before>name: Master

on:
  push:
    branches:
      master

concurrency:
  group: ${{ github.workflow }}
  cancel-in-progress: true

jobs:

  support-matrix:
    runs-on: ubuntu-latest
    name: CICD Matrix
    outputs:
      matrix: ${{ steps.set-matrix.outputs.matrix }}
    steps:
      - uses: actions/checkout@v2
      - id: set-matrix
        run: echo "::set-output name=matrix::$(python cicd-matrix.py)"

  run-tests:
    needs: support-matrix
    name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: ${{ fromJson(needs.support-matrix.outputs.matrix).os }}
        python-version: ${{ fromJson(needs.support-matrix.outputs.matrix).python-version }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - uses: actions/cache@v2
        with:
          path: ${{ env.pythonLocation }}
          key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.dev.txt') }}
      - name: Install Dependencies
        run: |
          pip install --upgrade --upgrade-strategy eager -r requirements.txt -r requirements.dev.txt -e .
      - name: Run Tests
        uses: ./.github/workflows/run-tests
        with:
          coverage-artifact-name: ${{ github.workflow }}

  publish-docs:
    needs: run-tests
    runs-on: ubuntu-latest
    name: Publish Docs
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: 3.8
      - uses: actions/cache@v2
        with:
          path: ${{ env.pythonLocation }}
          key: ${{ runner.os }}-3.8-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.dev.txt') }}-${{ hashFiles('requirements.publish.txt') }}
          restore-keys: ${{ runner.os }}-3.8-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.dev.txt') }}
      - name: Install Pandoc
        run: sudo apt-get install -y pandoc
      - name: Install Doc Dependencies
        run: |
          pip install --upgrade --upgrade-strategy eager -r requirements.publish.txt
      - name: Publish Docs
        run: |
          rm -rf docs/source/*.txt
          SPHINX_APIDOC_OPTIONS=members,undoc-members,show-inheritance sphinx-apidoc -eM -s txt -o docs/source/ exatomic *test*
          travis-sphinx build
          travis-sphinx deploy

  # keep github release and pypi upload together
  publish-release:
    needs: [ run-tests, support-matrix ]
    runs-on: ubuntu-latest
    name: Publish To Github + PyPI
    strategy:
      matrix:
        python-version: ${{ fromJson(needs.support-matrix.outputs.matrix).python-version }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - uses: actions/cache@v2
        with:
          path: ${{ env.pythonLocation }}
          key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.dev.txt') }}
      - name: Publish Github + PyPI Release
        uses: ./.github/workflows/publish-release
        with:
          github-token: ${{ secrets.REPOSITORY_TOKEN }}
          pypi-token: ${{ secrets.PYPI_TOKEN }}

  publish-conda:
    needs: [ run-tests, support-matrix, publish-release ]
    runs-on: ubuntu-latest
    name: Publish Artifacts to Conda
    strategy:
      matrix:
        python-version: ${{ fromJson(needs.support-matrix.outputs.matrix).python-version }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - uses: actions/cache@v2
        with:
          path: ${{ env.pythonLocation }}
          key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.dev.txt') }}-${{ hashFiles('requirements.release.txt') }}
          restore-keys: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.dev.txt') }}
      - name: Publish Conda Release
        uses: ./.github/workflows/publish-conda
        with:
          python-version: ${{ matrix.python-version }}
          conda-username: ${{ secrets.CONDA_USERNAME }}
          conda-password: ${{ secrets.CONDA_PASSWORD }}

  codacy-coverage-reporter:
    runs-on: ubuntu-latest
    needs: run-tests
    name: Codacy Coverage Reporter
    steps:
      - name: Download Coverage Report
        uses: actions/download-artifact@v2
        with:
          name: code-coverage-report-${{ github.workflow }}
      - name: Run codacy-coverage-reporter
        uses: codacy/codacy-coverage-reporter-action@v1
        with:
          project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
          coverage-reports: coverage.xml

  publish-to-npm:
    runs-on: ubuntu-latest
    needs: run-tests
    name: Publish To NPM
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '16'
      - name: Publish NPM Package
        shell: bash -l {0}
        run: |
          echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ${HOME}/.npmrc
          cd js && npm publish<commit_msg>fix: gracefully fail npm publish<commit_after>name: Master

on:
  push:
    branches:
      master

concurrency:
  group: ${{ github.workflow }}
  cancel-in-progress: true

jobs:

  support-matrix:
    runs-on: ubuntu-latest
    name: CICD Matrix
    outputs:
      matrix: ${{ steps.set-matrix.outputs.matrix }}
    steps:
      - uses: actions/checkout@v2
      - id: set-matrix
        run: echo "::set-output name=matrix::$(python cicd-matrix.py)"

  run-tests:
    needs: support-matrix
    name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: ${{ fromJson(needs.support-matrix.outputs.matrix).os }}
        python-version: ${{ fromJson(needs.support-matrix.outputs.matrix).python-version }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - uses: actions/cache@v2
        with:
          path: ${{ env.pythonLocation }}
          key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.dev.txt') }}
      - name: Install Dependencies
        run: |
          pip install --upgrade --upgrade-strategy eager -r requirements.txt -r requirements.dev.txt -e .
      - name: Run Tests
        uses: ./.github/workflows/run-tests
        with:
          coverage-artifact-name: ${{ github.workflow }}

  publish-docs:
    needs: run-tests
    runs-on: ubuntu-latest
    name: Publish Docs
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: 3.8
      - uses: actions/cache@v2
        with:
          path: ${{ env.pythonLocation }}
          key: ${{ runner.os }}-3.8-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.dev.txt') }}-${{ hashFiles('requirements.publish.txt') }}
          restore-keys: ${{ runner.os }}-3.8-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.dev.txt') }}
      - name: Install Pandoc
        run: sudo apt-get install -y pandoc
      - name: Install Doc Dependencies
        run: |
          pip install --upgrade --upgrade-strategy eager -r requirements.publish.txt
      - name: Publish Docs
        run: |
          rm -rf docs/source/*.txt
          SPHINX_APIDOC_OPTIONS=members,undoc-members,show-inheritance sphinx-apidoc -eM -s txt -o docs/source/ exatomic *test*
          travis-sphinx build
          travis-sphinx deploy

  # keep github release and pypi upload together
  publish-release:
    needs: [ run-tests, support-matrix ]
    runs-on: ubuntu-latest
    name: Publish To Github + PyPI
    strategy:
      matrix:
        python-version: ${{ fromJson(needs.support-matrix.outputs.matrix).python-version }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - uses: actions/cache@v2
        with:
          path: ${{ env.pythonLocation }}
          key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.dev.txt') }}
      - name: Publish Github + PyPI Release
        uses: ./.github/workflows/publish-release
        with:
          github-token: ${{ secrets.REPOSITORY_TOKEN }}
          pypi-token: ${{ secrets.PYPI_TOKEN }}

  publish-conda:
    needs: [ run-tests, support-matrix, publish-release ]
    runs-on: ubuntu-latest
    name: Publish Artifacts to Conda
    strategy:
      matrix:
        python-version: ${{ fromJson(needs.support-matrix.outputs.matrix).python-version }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - uses: actions/cache@v2
        with:
          path: ${{ env.pythonLocation }}
          key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.dev.txt') }}-${{ hashFiles('requirements.release.txt') }}
          restore-keys: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements.dev.txt') }}
      - name: Publish Conda Release
        uses: ./.github/workflows/publish-conda
        with:
          python-version: ${{ matrix.python-version }}
          conda-username: ${{ secrets.CONDA_USERNAME }}
          conda-password: ${{ secrets.CONDA_PASSWORD }}

  codacy-coverage-reporter:
    runs-on: ubuntu-latest
    needs: run-tests
    name: Codacy Coverage Reporter
    steps:
      - name: Download Coverage Report
        uses: actions/download-artifact@v2
        with:
          name: code-coverage-report-${{ github.workflow }}
      - name: Run codacy-coverage-reporter
        uses: codacy/codacy-coverage-reporter-action@v1
        with:
          project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
          coverage-reports: coverage.xml

  publish-to-npm:
    runs-on: ubuntu-latest
    needs: run-tests
    name: Publish To NPM
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '16'
      - name: Publish NPM Package
        shell: bash -l {0}
        run: |
          echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ${HOME}/.npmrc
          cd js && npm publish || echo "this version has likely been published, see above logs"

{'fraction_non_alphanumeric': 0.14591171882169404, 'fraction_numerical': 0.004771955584105717, 'mean_word_length': 2.291452733313198, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4910291', 'n_tokens_mistral': 3475, 'n_tokens_neox': 3319, 'n_words': 677}