summaryrefslogtreecommitdiff
path: root/.github/workflows/wheel-builder.yml
blob: 82727fc11b06c3846593de5c989788a779171c32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Wheel Builder
on:
  repository_dispatch:
    types: [wheel-builder]

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 bcrypt --no-binary bcrypt --no-deps --wheel-dir=tmpwheelhouse $PY_LIMITED_API
      - run: auditwheel repair tmpwheelhouse/bcrypt*.whl -w wheelhouse/
      - run: .venv/bin/pip install bcrypt --no-index -f wheelhouse/
      - run: |
          .venv/bin/python -c "import bcrypt; password = b'super secret password';hashed = bcrypt.hashpw(password, bcrypt.gensalt());bcrypt.checkpw(password, hashed)"

      - run: mkdir bcrypt-wheelhouse
      - run: mv wheelhouse/bcrypt*.whl bcrypt-wheelhouse/
      - uses: actions/upload-artifact@v1
        with:
          name: "bcrypt-${{ github.event.client_payload.BUILD_VERSION }}-manylinux1-${{ matrix.PYTHON }}"
          path: bcrypt-wheelhouse/

  macos:
    runs-on: macos-latest
    strategy:
      matrix:
        PYTHON:
          - {VERSION: '2.7', ABI_VERSION: '2.7'}
          - {VERSION: '3.8', ABI_VERSION: '3.5'}
    name: "Python ${{ matrix.PYTHON.VERSION }} on macOS"
    steps:
      - uses: actions/checkout@master
      - name: Setup python
        uses: actions/setup-python@v1
        with:
          python-version: ${{ matrix.PYTHON.VERSION }}

      # Downgrade pip, I can't remember why
      - run: pip install -U pip==10.0.1
      - run: 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

            pip wheel bcrypt --wheel-dir=wheelhouse --no-binary bcrypt --no-deps $PY_LIMITED_API
        env:
          PYTHON_VERSION: ${{ matrix.PYTHON.ABI_VERSION }}
      - run: pip install -f wheelhouse --no-index bcrypt
      - run: |
          python -c "import bcrypt;password = b'super secret password';hashed = bcrypt.hashpw(password, bcrypt.gensalt());bcrypt.checkpw(password, hashed)"

      - run: mkdir bcrypt-wheelhouse
      - run: mv wheelhouse/bcrypt*.whl bcrypt-wheelhouse/
      - uses: actions/upload-artifact@v1
        with:
          name: "bcrypt-${{ github.event.client_payload.BUILD_VERSION }}-macOS-${{ matrix.PYTHON.VERSION }}"
          path: bcrypt-wheelhouse/

  windows:
    runs-on: windows-latest
    strategy:
      matrix:
        WINDOWS:
          - {ARCH: 'x86', WINDOWS: 'win32'}
          - {ARCH: 'x64', WINDOWS: 'win64'}
        PYTHON:
          - {VERSION: "2.7", TOXENV: "py27"}
          - {VERSION: "3.5", TOXENV: "py35"}
          - {VERSION: "3.6", TOXENV: "py36"}
          - {VERSION: "3.7", TOXENV: "py37"}
          - {VERSION: "3.8", TOXENV: "py38"}
    name: "Python ${{ matrix.PYTHON.VERSION }} on ${{ matrix.WINDOWS.WINDOWS }}"
    steps:
      - uses: actions/checkout@master
      - name: Setup python
        uses: actions/setup-python@v1
        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'

      - run: pip install wheel cffi six
      - run: pip wheel bcrypt==${{ github.event.client_payload.BUILD_VERSION }} --wheel-dir=wheelhouse --no-binary bcrypt
      - run: pip install -f wheelhouse --no-index bcrypt
      - run: |
          python -c "import bcrypt; password = b'super secret password';hashed = bcrypt.hashpw(password, bcrypt.gensalt());bcrypt.checkpw(password, hashed)"

      - run: mkdir bcrypt-wheelhouse
      - run: move wheelhouse\bcrypt*.whl bcrypt-wheelhouse\
      - uses: actions/upload-artifact@v1
        with:
          name: "bcrypt-${{ github.event.client_payload.BUILD_VERSION }}-${{ matrix.WINDOWS.WINDOWS }}-${{ matrix.PYTHON.VERSION }}"
          path: bcrypt-wheelhouse\

  manylinux-arm64:
     name: "Python ${{ matrix.PYTHON }} for manylinux2014-aarch64"
     runs-on: ubuntu-latest
     strategy:
       matrix:
         PYTHON: ["cp35-cp35m"]
       fail-fast: false
     steps:
     - uses: actions/checkout@v2
     - run: |
         docker run --rm --privileged hypriot/qemu-register
     - uses: docker://quay.io/pypa/manylinux2014_aarch64
       with:
        args: |
              bash -c "/opt/python/${{ matrix.PYTHON }}/bin/pip install virtualenv;
              /opt/python/${{ matrix.PYTHON }}/bin/python -m virtualenv .venv;
              .venv/bin/pip install -U pip==10.0.1 # downgrade pip for reasons we can't remember but are definitely needed
              .venv/bin/pip install setuptools wheel cffi six;
              REGEX='cp3([0-9])*';
              if [[ ${{ matrix.PYTHON }} =~ $REGEX ]]; then
                  PY_LIMITED_API=\"--py-limited-api=cp3${BASH_REMATCH[1]}\";
              fi;
              .venv/bin/pip wheel bcrypt --no-binary bcrypt --no-deps --wheel-dir=tmpwheelhouse $PY_LIMITED_API              
              auditwheel repair tmpwheelhouse/bcrypt*.whl -w wheelhouse/;
              .venv/bin/pip install bcrypt --no-index -f wheelhouse/;
              .venv/bin/python -c \"import bcrypt; password = b'super secret password';hashed = bcrypt.hashpw(password, bcrypt.gensalt());bcrypt.checkpw(password, hashed)\";"
     - run: mkdir bcrypt-wheelhouse
     - run: sudo mv wheelhouse/bcrypt*.whl bcrypt-wheelhouse/
     - uses: actions/upload-artifact@v1
       with:
          name: "bcrypt-${{ github.event.client_payload.BUILD_VERSION }}-manylinux2014-aarch64-${{ matrix.PYTHON }}"
          path: bcrypt-wheelhouse/