summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2020-08-16 12:07:10 -0500
committerGitHub <noreply@github.com>2020-08-16 13:07:10 -0400
commit314c0f57aae910c1e0153c0ab23019bb11ce9072 (patch)
tree57b5fc0bda2c7a88800542faee7b724fe038e461
parente813ce2a3f3d5451cefa670f1cac743cfa7aa2f9 (diff)
downloadpy-bcrypt-git-314c0f57aae910c1e0153c0ab23019bb11ce9072.tar.gz
convert to workflow and improve (#222)
* convert to workflow and improve * E231 should probably be ignored now that we use black but whatever * no legacy
-rw-r--r--.github/workflows/wheel-builder.yml62
-rw-r--r--release.py14
2 files changed, 40 insertions, 36 deletions
diff --git a/.github/workflows/wheel-builder.yml b/.github/workflows/wheel-builder.yml
index 48921dd..161f96b 100644
--- a/.github/workflows/wheel-builder.yml
+++ b/.github/workflows/wheel-builder.yml
@@ -1,7 +1,10 @@
name: Wheel Builder
on:
- repository_dispatch:
- types: [wheel-builder]
+ workflow_dispatch:
+ inputs:
+ version:
+ required: true
+
jobs:
manylinux:
@@ -18,8 +21,8 @@ jobs:
steps:
- run: /opt/python/${{ matrix.PYTHON.VERSION }}/bin/python -m venv .venv
- name: Install python dependencies
- run: .venv/bin/pip install -U wheel cffi six
- - run: .venv/bin/pip download bcrypt==${{ github.event.client_payload.BUILD_VERSION }} --no-deps --no-binary bcrypt && tar zxvf bcrypt*.tar.gz && mkdir tmpwheelhouse
+ run: .venv/bin/pip install -U pip wheel cffi six
+ - run: .venv/bin/pip download bcrypt==${{ github.event.inputs.version }} --no-deps --no-binary bcrypt && tar zxvf bcrypt*.tar.gz && mkdir tmpwheelhouse
- run: cd bcrypt* && ../.venv/bin/python setup.py bdist_wheel --py-limited-api=${{ matrix.PYTHON.ABI_VERSION }} && mv dist/bcrypt*.whl ../tmpwheelhouse
- run: auditwheel repair tmpwheelhouse/bcrypt*.whl -w wheelhouse/
- run: .venv/bin/pip install bcrypt --no-index -f wheelhouse/
@@ -30,7 +33,7 @@ jobs:
- run: mv wheelhouse/bcrypt*.whl bcrypt-wheelhouse/
- uses: actions/upload-artifact@v1
with:
- name: "bcrypt-${{ github.event.client_payload.BUILD_VERSION }}-${{ matrix.CONTAINER.NAME }} -${{ matrix.PYTHON.ABI_VERSION }}"
+ name: "bcrypt-${{ github.event.inputs.version }}-${{ matrix.CONTAINER.NAME }} -${{ matrix.PYTHON.ABI_VERSION }}"
path: bcrypt-wheelhouse/
macos:
@@ -38,27 +41,28 @@ jobs:
strategy:
matrix:
PYTHON:
- - {VERSION: '3.8', ABI_VERSION: 'cp36'}
+ - ABI_VERSION: 'cp36'
+ DOWNLOAD_URL: 'https://www.python.org/ftp/python/3.8.5/python-3.8.5-macosx10.9.pkg'
+ BIN_PATH: '/Library/Frameworks/Python.framework/Versions/3.8/bin/python3'
name: "${{ matrix.PYTHON.ABI_VERSION }} macOS"
steps:
- uses: actions/checkout@master
- - name: Setup python
- uses: actions/setup-python@v2
- with:
- python-version: ${{ matrix.PYTHON.VERSION }}
-
- - run: pip install -U wheel cffi six
- - run: pip download bcrypt==${{ github.event.client_payload.BUILD_VERSION }} --no-deps --no-binary bcrypt && tar zxvf bcrypt*.tar.gz && mkdir wheelhouse
- - run: cd bcrypt* && python setup.py bdist_wheel --py-limited-api=${{ matrix.PYTHON.ABI_VERSION }} && mv dist/bcrypt*.whl ../wheelhouse
- - 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)"
+ curl "${{ matrix.PYTHON.DOWNLOAD_URL }}" -o python.pkg
+ sudo installer -pkg python.pkg -target /
+ - run: ${{ matrix.PYTHON.BIN_PATH }} -m venv venv
+ - run: venv/bin/pip install -U pip wheel cffi six
+ - run: venv/bin/pip download bcrypt==${{ github.event.inputs.version }} --no-deps --no-binary bcrypt && tar zxvf bcrypt*.tar.gz && mkdir wheelhouse
+ - run: cd bcrypt* && ../venv/bin/python setup.py bdist_wheel --py-limited-api=${{ matrix.PYTHON.ABI_VERSION }} && mv dist/bcrypt*.whl ../wheelhouse
+ - run: venv/bin/pip install -f wheelhouse --no-index bcrypt
+ - 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 }}-macOS-${{ matrix.PYTHON.ABI_VERSION }}"
+ name: "bcrypt-${{ github.event.inputs.version }}-macOS-${{ matrix.PYTHON.ABI_VERSION }}"
path: bcrypt-wheelhouse/
windows:
@@ -66,20 +70,20 @@ jobs:
strategy:
matrix:
WINDOWS:
- - {ARCH: 'x86', WINDOWS: 'win32'}
- - {ARCH: 'x64', WINDOWS: 'win64'}
+ - 'x86'
+ - 'x64'
PYTHON:
- {VERSION: "3.6", ABI_VERSION: "cp36"}
- name: "${{ matrix.PYTHON.ABI_VERSION }} ${{ matrix.WINDOWS.WINDOWS }}"
+ name: "${{ matrix.PYTHON.VERSION }} ${{ matrix.PYTHON.ABI_VERSION }} ${{ matrix.WINDOWS}}"
steps:
- uses: actions/checkout@master
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.PYTHON.VERSION }}
- architecture: ${{ matrix.WINDOWS.ARCH }}
- - run: pip install -U wheel cffi six
- - run: pip download bcrypt==${{ github.event.client_payload.BUILD_VERSION }} --no-deps --no-binary bcrypt && tar zxvf bcrypt*.tar.gz && mkdir wheelhouse
+ architecture: ${{ matrix.WINDOWS }}
+ - run: python -m pip install -U pip wheel cffi six
+ - run: pip download bcrypt==${{ github.event.inputs.version }} --no-deps --no-binary bcrypt && tar zxvf bcrypt*.tar.gz && mkdir wheelhouse
shell: bash
- run: cd bcrypt* && python setup.py bdist_wheel --py-limited-api=${{ matrix.PYTHON.ABI_VERSION }} && mv dist/bcrypt*.whl ../wheelhouse
- run: pip install -f wheelhouse --no-index bcrypt
@@ -91,7 +95,7 @@ jobs:
- 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.ABI_VERSION }}"
+ name: "bcrypt-${{ github.event.inputs.version }}-${{ matrix.WINDOWS }}-${{ matrix.PYTHON.ABI_VERSION }}"
path: bcrypt-wheelhouse\
manylinux-arm64:
@@ -106,12 +110,16 @@ jobs:
- run: |
docker run --rm --privileged hypriot/qemu-register
- uses: docker://quay.io/pypa/manylinux2014_aarch64
+ # The weird pip cache nonsense below is due to docker ownership issues. We want
+ # a cache because otherwise we end up building cffi twice.
with:
args: |
bash -c "set -xe;
+ mkdir -p /github/home/.cache/pip;
+ chown -R $(whoami) /github/home/.cache;
/opt/python/${{ matrix.PYTHON.VERSION }}/bin/python -m venv .venv;
- .venv/bin/pip install -U wheel cffi six pip;
- .venv/bin/pip download bcrypt==${{ github.event.client_payload.BUILD_VERSION }} --no-deps --no-binary bcrypt;
+ .venv/bin/pip install -U pip wheel cffi six;
+ .venv/bin/pip download bcrypt==${{ github.event.inputs.version }} --no-deps --no-binary bcrypt;
tar zxvf bcrypt*.tar.gz;
mkdir tmpwheelhouse;
pushd bcrypt*;
@@ -125,5 +133,5 @@ jobs:
- 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.ABI_VERSION }}"
+ name: "bcrypt-${{ github.event.inputs.version }}-manylinux2014-aarch64-${{ matrix.PYTHON.ABI_VERSION }}"
path: bcrypt-wheelhouse/
diff --git a/release.py b/release.py
index 9e492af..83de6b4 100644
--- a/release.py
+++ b/release.py
@@ -83,18 +83,14 @@ def build_github_actions_wheels(token, version):
session = requests.Session()
response = session.post(
- "https://api.github.com/repos/pyca/bcrypt/dispatches",
+ "https://api.github.com/repos/pyca/bcrypt/actions/workflows/"
+ "wheel-builder.yml/dispatches",
headers={
"Content-Type": "application/json",
- "Accept": "application/vnd.github.everest-preview+json",
+ "Accept": "application/vnd.github.v3+json",
"Authorization": "token {}".format(token),
},
- data=json.dumps(
- {
- "event_type": "wheel-builder",
- "client_payload": {"BUILD_VERSION": version},
- }
- ),
+ data=json.dumps({"ref": "master", "inputs": {"version": version}}),
)
response.raise_for_status()
@@ -103,7 +99,7 @@ def build_github_actions_wheels(token, version):
response = session.get(
(
"https://api.github.com/repos/pyca/bcrypt/actions/workflows/"
- "wheel-builder.yml/runs?event=repository_dispatch"
+ "wheel-builder.yml/runs?event=workflow_dispatch"
),
headers={
"Content-Type": "application/json",