<commit_before>name: GitHub Actions

on: [ pull_request, push ]

jobs:
  build-test:
    name: Build and Test
    runs-on: ${{ matrix.os }}-latest
    timeout-minutes: 5

    strategy:
      fail-fast: false
      matrix:
        os: [windows, ubuntu, macos]
        pyver_minor: [6, 7, 8, 9]
        platform: [x64]
        shutdown_mode: [Normal, Soft]
        include:
        - os: ubuntu
          pyver_minor: 6
          dll_suffix: m
        - os: ubuntu
          pyver_minor: 7
          dll_suffix: m

        - os: macos
          dll_prefix: lib
          dll_pyver_major: '3.'
          dll_suffix: m
        - os: ubuntu
          dll_prefix: lib
          dll_pyver_major: '3.'
        - os: windows
          dll_pyver_major: '3'

        - os: ubuntu
          dll_ext: .so
        - os: windows
          dll_ext: .dll
        - os: macos
          dll_ext: .dylib

    env:
      PYTHONNET_SHUTDOWN_MODE: ${{ matrix.SHUTDOWN_MODE }}

    steps:
      - name: Set Environment on macOS
        uses: maxim-lobanov/setup-xamarin@v1
        if: ${{ matrix.os == 'macos' }}
        with:
          mono-version: latest

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

      - name: Setup .NET
        uses: actions/setup-dotnet@v1

      - name: Set up Python 3.${{ matrix.pyver_minor }}
        uses: actions/setup-python@v2
        with:
          python-version: 3.${{ matrix.pyver_minor }}
          architecture: ${{ matrix.platform }}

      - name: Install dependencies
        run: |
          pip install --upgrade -r requirements.txt

      - name: Build and Install
        run: |
          python setup.py configure
          pip install -v .

      - name: Python Tests
        run: pytest

      - name: Embedding tests
        run: dotnet test --runtime any-${{ matrix.platform }} src/embed_tests/
        if: ${{ matrix.os != 'macos' }} # Not working right now, doesn't find libpython
        env:
          PYTHONNET_PYDLL: ${{ matrix.DLL_PREFIX }}python${{matrix.DLL_PYVER_MAJOR}}${{matrix.PYVER_MINOR}}${{matrix.DLL_SUFFIX}}${{matrix.DLL_EXT}}

      - name: Python tests run from .NET
        run: dotnet test --runtime any-${{ matrix.platform }} src/python_tests_runner/
        if: ${{ matrix.os == 'windows' }} # Not working for others right now
        env:
          PYTHONNET_PYDLL: ${{ matrix.DLL_PREFIX }}python${{matrix.DLL_PYVER_MAJOR}}${{matrix.PYVER_MINOR}}${{matrix.DLL_SUFFIX}}${{matrix.DLL_EXT}}

      # TODO: Run perf tests
      # TODO: Run mono tests on Windows?<commit_msg>workaround for pytest/clr module not preloading python C API library<commit_after>name: GitHub Actions

on: [ pull_request, push ]

jobs:
  build-test:
    name: Build and Test
    runs-on: ${{ matrix.os }}-latest
    timeout-minutes: 5

    strategy:
      fail-fast: false
      matrix:
        os: [windows, ubuntu, macos]
        pyver_minor: [6, 7, 8, 9]
        platform: [x64]
        shutdown_mode: [Normal, Soft]
        include:
        - os: ubuntu
          pyver_minor: 6
          dll_suffix: m
        - os: ubuntu
          pyver_minor: 7
          dll_suffix: m

        - os: macos
          dll_prefix: lib
          dll_pyver_major: '3.'
          dll_suffix: m
        - os: ubuntu
          dll_prefix: lib
          dll_pyver_major: '3.'
        - os: windows
          dll_pyver_major: '3'

        - os: ubuntu
          dll_ext: .so
        - os: windows
          dll_ext: .dll
        - os: macos
          dll_ext: .dylib

    env:
      PYTHONNET_SHUTDOWN_MODE: ${{ matrix.SHUTDOWN_MODE }}

    steps:
      - name: Set Environment on macOS
        uses: maxim-lobanov/setup-xamarin@v1
        if: ${{ matrix.os == 'macos' }}
        with:
          mono-version: latest

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

      - name: Setup .NET
        uses: actions/setup-dotnet@v1

      - name: Set up Python 3.${{ matrix.pyver_minor }}
        uses: actions/setup-python@v2
        with:
          python-version: 3.${{ matrix.pyver_minor }}
          architecture: ${{ matrix.platform }}

      - name: Install dependencies
        run: |
          pip install --upgrade -r requirements.txt

      - name: Build and Install
        run: |
          python setup.py configure
          pip install -v .

      # TODO this should be gone once clr module sets PythonDLL or preloads it
      - name: Python Tests
        run: pytest
        if: ${{ matrix.os != 'macos' }}
        env:
          PYTHONNET_PYDLL: ${{ matrix.DLL_PREFIX }}python${{matrix.DLL_PYVER_MAJOR}}${{matrix.PYVER_MINOR}}${{matrix.DLL_SUFFIX}}${{matrix.DLL_EXT}}

      - name: Python Tests
        run: pytest
        if: ${{ matrix.os == 'macos' }}

      - name: Embedding tests
        run: dotnet test --runtime any-${{ matrix.platform }} src/embed_tests/
        if: ${{ matrix.os != 'macos' }} # Not working right now, doesn't find libpython
        env:
          PYTHONNET_PYDLL: ${{ matrix.DLL_PREFIX }}python${{matrix.DLL_PYVER_MAJOR}}${{matrix.PYVER_MINOR}}${{matrix.DLL_SUFFIX}}${{matrix.DLL_EXT}}

      - name: Python tests run from .NET
        run: dotnet test --runtime any-${{ matrix.platform }} src/python_tests_runner/
        if: ${{ matrix.os == 'windows' }} # Not working for others right now
        env:
          PYTHONNET_PYDLL: ${{ matrix.DLL_PREFIX }}python${{matrix.DLL_PYVER_MAJOR}}${{matrix.PYVER_MINOR}}${{matrix.DLL_SUFFIX}}${{matrix.DLL_EXT}}

      # TODO: Run perf tests
      # TODO: Run mono tests on Windows?
{'fraction_non_alphanumeric': 0.11960072595281307, 'fraction_numerical': 0.006533575317604356, 'mean_word_length': 1.8990005260389269, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7429417', 'n_tokens_mistral': 1904, 'n_tokens_neox': 1718, 'n_words': 444}