<commit_before>name: Wheel Builder
on:
  workflow_dispatch:
    inputs:
      version:
        required: true

jobs:
  manylinux:
    runs-on: ubuntu-latest
    container: pyca/cryptography-manylinux1:x86_64
    strategy:
      matrix:
        PYTHON: ["cp27-cp27m", "cp27-cp27mu", "cp35-cp35m"]
    name: "Python ${{ matrix.PYTHON }} for manylinux1"
    steps:
      - run: /opt/python/${{ matrix.PYTHON }}/bin/python -m virtualenv .venv
      - name: Downgrade pip, can't remember why
        run: .venv/bin/pip install -U pip==10.0.1
      - name: Install python dependencies
        run: .venv/bin/pip install cffi six
      - run: |
          REGEX="cp3([0-9])*"
          if [[ "${{ matrix.PYTHON }}" =~ $REGEX ]]; then
              PY_LIMITED_API="--build-option --py-limited-api=cp3${BASH_REMATCH[1]}"
          fi
          .venv/bin/pip wheel pynacl==${{ github.event.inputs.version }} --no-binary pynacl --no-deps --wheel-dir=tmpwheelhouse $PY_LIMITED_API
      - run: auditwheel repair tmpwheelhouse/PyNaCl*.whl -w wheelhouse/
      - run: .venv/bin/pip install pynacl --no-index -f wheelhouse/
      - run: |
          .venv/bin/python -c "import nacl.signing; key = nacl.signing.SigningKey.generate();signature = key.sign(b'test'); key.verify_key.verify(signature)"

      - run: mkdir pynacl-wheelhouse
      - run: mv wheelhouse/PyNaCl*.whl pynacl-wheelhouse/
      - uses: actions/upload-artifact@v1
        with:
          name: "pynacl-${{ github.event.inputs.version }}-manylinux1-${{ matrix.PYTHON }}"
          path: pynacl-wheelhouse/
  macos:
    runs-on: macos-latest
    strategy:
      matrix:
        PYTHON:
          - VERSION: '2.7'
            ABI_VERSION: '2.7'
            DOWNLOAD_URL: 'https://www.python.org/ftp/python/2.7.17/python-2.7.17-macosx10.9.pkg'
            BIN_PATH: '/Library/Frameworks/Python.framework/Versions/2.7/bin/python'
          - VERSION: '3.8'
            ABI_VERSION: '3.5'
            DOWNLOAD_URL: 'https://www.python.org/ftp/python/3.8.2/python-3.8.2-macosx10.9.pkg'
            BIN_PATH: '/Library/Frameworks/Python.framework/Versions/3.8/bin/python3'
    name: "Python ${{ matrix.PYTHON.VERSION }} for ABI ${{ matrix.PYTHON.ABI_VERSION }} on macOS"
    steps:
      - uses: actions/checkout@master
      - run: |
          curl "$PYTHON_DOWNLOAD_URL" -o python.pkg
          sudo installer -pkg python.pkg -target /
        env:
          PYTHON_DOWNLOAD_URL: ${{ matrix.PYTHON.DOWNLOAD_URL }}
      - run: ${{ matrix.PYTHON.BIN_PATH }} -m pip install -U virtualenv
      - run: ${{ matrix.PYTHON.BIN_PATH }} -m virtualenv venv
      # Downgrade pip, I can't remember why
      - run: venv/bin/pip install -U pip==10.0.1
      - run: venv/bin/pip install -U wheel cffi six
      - name: Build the wheel
        run: |
            REGEX="3\.([0-9])*"
            if [[ "$PYTHON_VERSION" =~ $REGEX ]]; then
                PY_LIMITED_API="--build-option --py-limited-api=cp3${BASH_REMATCH[1]}"
            fi

            CFLAGS="-mmacosx-version-min=10.9 -march=core2" \
                venv/bin/pip wheel pynacl==${{ github.event.inputs.version }} --wheel-dir=wheelhouse --no-binary pynacl --no-deps $PY_LIMITED_API
        env:
          PYTHON_VERSION: ${{ matrix.PYTHON.ABI_VERSION }}
      - run: venv/bin/pip install -f wheelhouse --no-index pynacl
      - run: |
          venv/bin/python -c "import nacl.signing; key = nacl.signing.SigningKey.generate();signature = key.sign(b'test'); key.verify_key.verify(signature)"

      - run: mkdir pynacl-wheelhouse
      - run: mv wheelhouse/PyNaCl*.whl pynacl-wheelhouse/
      - uses: actions/upload-artifact@v1
        with:
          name: "pynacl-${{ github.event.inputs.version }}-macOS-${{ matrix.PYTHON.VERSION }}"
          path: pynacl-wheelhouse/
  windows:
    runs-on: windows-latest
    strategy:
      matrix:
        WINDOWS:
          - {ARCH: 'x86', SODIUM_ARCH: 'Win32', VS_ARCH: 'x86'}
          - {ARCH: 'x64', SODIUM_ARCH: 'x64', VS_ARCH: 'amd64'}
        PYTHON:
          - {VERSION: "2.7", SODIUM_MSVC_VERSION: "v100"}
          - {VERSION: "3.5", SODIUM_MSVC_VERSION: "v140"}
          - {VERSION: "3.6", SODIUM_MSVC_VERSION: "v140"}
          - {VERSION: "3.7", SODIUM_MSVC_VERSION: "v140"}
          - {VERSION: "3.8", SODIUM_MSVC_VERSION: "v140"}
          - {VERSION: "3.8", SODIUM_MSVC_VERSION: "v140", "USE_ABI3": "true", "ABI_VERSION": "cp36"}
    name: "Python ${{ matrix.PYTHON.VERSION }} on Windows ${{ matrix.WINDOWS.ARCH }}"
    name: "${{ matrix.PYTHON.VERSION }} ${{ matrix.WINDOWS.ARCH }} ${{ matrix.PYTHON.ABI_VERSION }}"
    steps:
      - uses: actions/checkout@master
      - name: Setup python
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.PYTHON.VERSION }}
          architecture: ${{ matrix.WINDOWS.ARCH }}
      - name: Install MSVC for Python 2.7
        run: |
            Invoke-WebRequest -Uri https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi -OutFile VCForPython27.msi
            Start-Process msiexec -Wait -ArgumentList @('/i', 'VCForPython27.msi', '/qn', 'ALLUSERS=1')
            Remove-Item VCForPython27.msi -Force
        shell: powershell
        if: matrix.PYTHON.VERSION == '2.7'

      - name: Extract libsodium libraries
        run: |
          Expand-Archive src/libsodium-1.0.18-msvc.zip -DestinationPath c:\
        shell: powershell
      - name: Add sodium to paths
        run: |
          echo "::set-env name=INCLUDE::C:/libsodium/include;%INCLUDE%"
          echo "::set-env name=LIB::C:/libsodium/${{ matrix.WINDOWS.SODIUM_ARCH }}/release/${{ matrix.PYTHON.SODIUM_MSVC_VERSION }}/static;%LIB%"

      - name: Copy stdint.h to include dir (distant weeping)
        run: mv .github/stdint-nonsense/stdint.h C:/libsodium/include/stdint.h
        if: matrix.PYTHON.VERSION == '2.7'
      - name: Install wheel and our Python dependencies
        run: python -m pip install -U pip wheel cffi six
      - name: Download the sdist
        run: pip download pynacl==${{ github.event.inputs.version }} --no-deps --no-binary pynacl && tar zxvf PyNaCl* && mkdir wheelhouse
        shell: bash
      - name: Build the wheel (py2)
        run: cd PyNaCl* && python setup.py bdist_wheel && mv dist/PyNaCl*.whl ../wheelhouse
        env:
          PYNACL_SODIUM_LIBRARY_NAME: sodium
          PYNACL_SODIUM_STATIC: 1
          SODIUM_INSTALL: system
        if: matrix.PYTHON.VERSION == '2.7'
      - name: Build the wheel (py3 no abi3)
        run: |
          call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -no_logo -arch=${{ matrix.WINDOWS.VS_ARCH }}
          cd PyNaCl* && python setup.py bdist_wheel && mv dist/PyNaCl*.whl ../wheelhouse
        shell: cmd
        env:
          PYNACL_SODIUM_LIBRARY_NAME: sodium
          PYNACL_SODIUM_STATIC: 1
          SODIUM_INSTALL: system
        if: matrix.PYTHON.VERSION != '2.7' && matrix.PYTHON.USE_ABI3 != 'true'
      - name: Build the wheel (py3 abi3)
        run: |
          call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -no_logo -arch=${{ matrix.WINDOWS.VS_ARCH }}
          cd PyNaCl* && python setup.py bdist_wheel  --py-limited-api=${{ matrix.PYTHON.ABI_VERSION }} && mv dist/PyNaCl*.whl ../wheelhouse
        shell: cmd
        env:
          PYNACL_SODIUM_LIBRARY_NAME: sodium
          PYNACL_SODIUM_STATIC: 1
          SODIUM_INSTALL: system
        if: matrix.PYTHON.USE_ABI3 == 'true'

      - name: Test installing the wheel
        run: pip install -f wheelhouse pynacl --no-index
      - name: Test the installed wheel
        run: |
          python -c "import nacl.signing; key = nacl.signing.SigningKey.generate();signature = key.sign(b'test'); key.verify_key.verify(signature)"
      - run: mkdir pynacl-wheelhouse
      - run: move wheelhouse\PyNaCl*.whl pynacl-wheelhouse\
      - uses: actions/upload-artifact@v1<commit_msg>Fix wheels (#629)<commit_after>name: Wheel Builder
on:
  workflow_dispatch:
    inputs:
      version:
        required: true

jobs:
  manylinux:
    runs-on: ubuntu-latest
    container: pyca/cryptography-manylinux1:x86_64
    strategy:
      matrix:
        PYTHON: ["cp27-cp27m", "cp27-cp27mu", "cp35-cp35m"]
    name: "Python ${{ matrix.PYTHON }} for manylinux1"
    steps:
      - run: /opt/python/${{ matrix.PYTHON }}/bin/python -m virtualenv .venv
      - name: Install python dependencies
        run: .venv/bin/pip install -U pip cffi six
      - run: .venv/bin/pip download pynacl==${{ github.event.inputs.version }} --no-deps --no-binary pynacl && tar zxvf PyNaCl*.tar.gz && mkdir tmpwheelhouse

      - run: |
          REGEX="cp3([0-9])*"
          if [[ "${{ matrix.PYTHON }}" =~ $REGEX ]]; then
              PY_LIMITED_API="--py-limited-api=cp3${BASH_REMATCH[1]}"
          fi
          cd PyNaCl*
          LIBSODIUM_MAKE_ARGS="-j$(nproc)" ../.venv/bin/python setup.py bdist_wheel $PY_LIMITED_API && mv dist/PyNaCl*.whl ../tmpwheelhouse
      - run: auditwheel repair tmpwheelhouse/PyNaCl*.whl -w wheelhouse/
      - run: .venv/bin/pip install pynacl --no-index -f wheelhouse/
      - run: |
          .venv/bin/python -c "import nacl.signing; key = nacl.signing.SigningKey.generate();signature = key.sign(b'test'); key.verify_key.verify(signature)"

      - run: mkdir pynacl-wheelhouse
      - run: mv wheelhouse/PyNaCl*.whl pynacl-wheelhouse/
      - uses: actions/upload-artifact@v1
        with:
          name: "pynacl-${{ github.event.inputs.version }}-manylinux1-${{ matrix.PYTHON }}"
          path: pynacl-wheelhouse/
  macos:
    runs-on: macos-latest
    strategy:
      matrix:
        PYTHON:
          - VERSION: '2.7'
            ABI_VERSION: '2.7'
            DOWNLOAD_URL: 'https://www.python.org/ftp/python/2.7.17/python-2.7.17-macosx10.9.pkg'
            BIN_PATH: '/Library/Frameworks/Python.framework/Versions/2.7/bin/python'
          - VERSION: '3.8'
            ABI_VERSION: '3.5'
            DOWNLOAD_URL: 'https://www.python.org/ftp/python/3.8.2/python-3.8.2-macosx10.9.pkg'
            BIN_PATH: '/Library/Frameworks/Python.framework/Versions/3.8/bin/python3'
    name: "Python ${{ matrix.PYTHON.VERSION }} for ABI ${{ matrix.PYTHON.ABI_VERSION }} on macOS"
    steps:
      - uses: actions/checkout@master
      - run: |
          curl "$PYTHON_DOWNLOAD_URL" -o python.pkg
          sudo installer -pkg python.pkg -target /
        env:
          PYTHON_DOWNLOAD_URL: ${{ matrix.PYTHON.DOWNLOAD_URL }}
      - run: ${{ matrix.PYTHON.BIN_PATH }} -m pip install -U virtualenv
      - run: ${{ matrix.PYTHON.BIN_PATH }} -m virtualenv venv
      - run: venv/bin/pip install -U pip wheel cffi six
      - run: venv/bin/pip download pynacl==${{ github.event.inputs.version }} --no-deps --no-binary pynacl && tar zxvf PyNaCl*.tar.gz && mkdir wheelhouse
      - name: Build the wheel
        run: |
            REGEX="3\.([0-9])*"
            if [[ "$PYTHON_VERSION" =~ $REGEX ]]; then
                PY_LIMITED_API="--py-limited-api=cp3${BASH_REMATCH[1]}"
            fi

            cd PyNaCl*
            LIBSODIUM_MAKE_ARGS="-j$(sysctl -n hw.ncpu)" CFLAGS="-mmacosx-version-min=10.9 -march=core2" \
                ../venv/bin/python setup.py bdist_wheel $PY_LIMITED_API && mv dist/PyNaCl*.whl ../wheelhouse
        env:
          PYTHON_VERSION: ${{ matrix.PYTHON.ABI_VERSION }}
      - run: venv/bin/pip install -f wheelhouse --no-index pynacl
      - run: |
          venv/bin/python -c "import nacl.signing; key = nacl.signing.SigningKey.generate();signature = key.sign(b'test'); key.verify_key.verify(signature)"

      - run: mkdir pynacl-wheelhouse
      - run: mv wheelhouse/PyNaCl*.whl pynacl-wheelhouse/
      - uses: actions/upload-artifact@v1
        with:
          name: "pynacl-${{ github.event.inputs.version }}-macOS-${{ matrix.PYTHON.VERSION }}"
          path: pynacl-wheelhouse/
  windows:
    runs-on: windows-latest
    strategy:
      matrix:
        WINDOWS:
          - {ARCH: 'x86', SODIUM_ARCH: 'Win32', VS_ARCH: 'x86'}
          - {ARCH: 'x64', SODIUM_ARCH: 'x64', VS_ARCH: 'amd64'}
        PYTHON:
          - {VERSION: "2.7", SODIUM_MSVC_VERSION: "v100"}
          - {VERSION: "3.8", SODIUM_MSVC_VERSION: "v140", "USE_ABI3": "true", "ABI_VERSION": "cp35"}
    name: "${{ matrix.PYTHON.VERSION }} ${{ matrix.WINDOWS.ARCH }} ${{ matrix.PYTHON.ABI_VERSION }}"
    steps:
      - uses: actions/checkout@master
      - name: Setup python
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.PYTHON.VERSION }}
          architecture: ${{ matrix.WINDOWS.ARCH }}
      - name: Install MSVC for Python 2.7
        run: |
            Invoke-WebRequest -Uri https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi -OutFile VCForPython27.msi
            Start-Process msiexec -Wait -ArgumentList @('/i', 'VCForPython27.msi', '/qn', 'ALLUSERS=1')
            Remove-Item VCForPython27.msi -Force
        shell: powershell
        if: matrix.PYTHON.VERSION == '2.7'

      - name: Extract libsodium libraries
        run: |
          Expand-Archive src/libsodium-1.0.18-msvc.zip -DestinationPath c:\
        shell: powershell
      - name: Add sodium to paths
        run: |
          echo "::set-env name=INCLUDE::C:/libsodium/include;%INCLUDE%"
          echo "::set-env name=LIB::C:/libsodium/${{ matrix.WINDOWS.SODIUM_ARCH }}/release/${{ matrix.PYTHON.SODIUM_MSVC_VERSION }}/static;%LIB%"

      - name: Copy stdint.h to include dir (distant weeping)
        run: mv .github/stdint-nonsense/stdint.h C:/libsodium/include/stdint.h
        if: matrix.PYTHON.VERSION == '2.7'
      - name: Install wheel and our Python dependencies
        run: python -m pip install -U pip wheel cffi six
      - name: Download the sdist
        run: pip download pynacl==${{ github.event.inputs.version }} --no-deps --no-binary pynacl && tar zxvf PyNaCl* && mkdir wheelhouse
        shell: bash
      - name: Build the wheel (py2)
        run: cd PyNaCl* && python setup.py bdist_wheel && mv dist/PyNaCl*.whl ../wheelhouse
        env:
          PYNACL_SODIUM_LIBRARY_NAME: sodium
          PYNACL_SODIUM_STATIC: 1
          SODIUM_INSTALL: system
        if: matrix.PYTHON.VERSION == '2.7'
      - name: Build the wheel (py3 abi3)
        run: |
          call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -no_logo -arch=${{ matrix.WINDOWS.VS_ARCH }}
          cd PyNaCl* && python setup.py bdist_wheel  --py-limited-api=${{ matrix.PYTHON.ABI_VERSION }} && mv dist/PyNaCl*.whl ../wheelhouse
        shell: cmd
        env:
          PYNACL_SODIUM_LIBRARY_NAME: sodium
          PYNACL_SODIUM_STATIC: 1
          SODIUM_INSTALL: system
        if: matrix.PYTHON.VERSION != '2.7'

      - name: Test installing the wheel
        run: pip install -f wheelhouse pynacl --no-index
      - name: Test the installed wheel
        run: |
          python -c "import nacl.signing; key = nacl.signing.SigningKey.generate();signature = key.sign(b'test'); key.verify_key.verify(signature)"
      - run: mkdir pynacl-wheelhouse
      - run: move wheelhouse\PyNaCl*.whl pynacl-wheelhouse\
      - uses: actions/upload-artifact@v1
{'fraction_non_alphanumeric': 0.14162190488667628, 'fraction_numerical': 0.022599240141490895, 'mean_word_length': 2.2952730412259874, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2537061', 'n_tokens_mistral': 5669, 'n_tokens_neox': 5303, 'n_words': 1067}