diff options
| -rw-r--r-- | .github/workflows/ci.yml | 12 | ||||
| -rw-r--r-- | .github/workflows/download_openssl.py | 27 |
2 files changed, 25 insertions, 14 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 144187893..883360f50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,10 +33,14 @@ jobs: - run: git clone https://github.com/google/wycheproof - - run: | + - name: Download OpenSSL + run: | + python .github/workflows/download_openssl.py macos openssl-macos + - name: Tests + run: | CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS=1 \ - LDFLAGS="/usr/local/opt/openssl\\@1.1/lib/libcrypto.a /usr/local/opt/openssl\\@1.1/lib/libssl.a" \ - CFLAGS="-I/usr/local/opt/openssl\\@1.1/include -Werror -Wno-error=deprecated-declarations -Wno-error=incompatible-pointer-types-discards-qualifiers -Wno-error=unused-function -Wno-error=unused-command-line-argument -mmacosx-version-min=10.9" \ + LDFLAGS="${HOME}/openssl-macos/lib/libcrypto.a ${HOME}/openssl-macos/lib/libssl.a" \ + CFLAGS="-I${HOME}/openssl-macos/include -Werror -Wno-error=deprecated-declarations -Wno-error=incompatible-pointer-types-discards-qualifiers -Wno-error=unused-function -Wno-error=unused-command-line-argument -mmacosx-version-min=10.9" \ tox -r -- --color=yes --wycheproof-root=wycheproof env: TOXENV: ${{ matrix.PYTHON.TOXENV }} @@ -78,7 +82,7 @@ jobs: - run: python -m pip install tox requests coverage - name: Download OpenSSL run: | - python .github/workflows/download_openssl.py openssl-${{ matrix.WINDOWS.WINDOWS }}-${{ matrix.PYTHON.MSVC_VERSION }} + python .github/workflows/download_openssl.py windows openssl-${{ matrix.WINDOWS.WINDOWS }}-${{ matrix.PYTHON.MSVC_VERSION }} echo "::set-env name=INCLUDE::C:/openssl-${{ matrix.WINDOWS.WINDOWS }}-${{ matrix.PYTHON.MSVC_VERSION }}/include;%INCLUDE%" echo "::set-env name=LIB::C:/openssl-${{ matrix.WINDOWS.WINDOWS }}-${{ matrix.PYTHON.MSVC_VERSION }}/lib;%LIB%" env: diff --git a/.github/workflows/download_openssl.py b/.github/workflows/download_openssl.py index f665e7f0e..78e5135ca 100644 --- a/.github/workflows/download_openssl.py +++ b/.github/workflows/download_openssl.py @@ -6,12 +6,6 @@ import zipfile import requests -RUNS_URL = ( - "https://api.github.com/repos/pyca/infra/actions/workflows/" - "build-openssl.yml/runs?branch=master&status=success" -) - - def get_response(url, token): response = requests.get(url, headers={"Authorization": "token " + token}) if response.status_code != 200: @@ -21,11 +15,24 @@ def get_response(url, token): return response -def main(target): +def main(platform, target): + if platform == "windows": + workflow = "build-openssl.yml" + path = "C:/" + elif platform == "macos": + workflow = "build-macos-openssl.yml" + path = os.environ["HOME"] + else: + raise ValueError("Invalid platform") + token = os.environ["GITHUB_TOKEN"] print("Looking for: {}".format(target)) + runs_url = ( + "https://api.github.com/repos/pyca/infra/actions/workflows/" + "{}/runs?branch=master&status=success".format(workflow) + ) - response = get_response(RUNS_URL, token).json() + response = get_response(runs_url, token).json() artifacts_url = response["workflow_runs"][0]["artifacts_url"] response = get_response(artifacts_url, token).json() for artifact in response["artifacts"]: @@ -35,10 +42,10 @@ def main(target): artifact["archive_download_url"], token ) zipfile.ZipFile(io.BytesIO(response.content)).extractall( - "C:/{}".format(artifact["name"]) + os.path.join(path, artifact["name"]) ) return if __name__ == "__main__": - main(sys.argv[1]) + main(sys.argv[1], sys.argv[2]) |
