Skip to content

Commit

Permalink
new zlib download
Browse files Browse the repository at this point in the history
  • Loading branch information
tannermpeterson committed Oct 6, 2023
1 parent 0aa402f commit 00968d4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ jobs:
pipenv install --dev --deploy --sequential
- name: Download zlib Library
env:
AWS_ACCESS_KEY_ID: ${{ secrets.CI_IAM_GIT_PUBLISH_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_IAM_GIT_PUBLISH_SECRET_KEY }}
run: |
cd controller/
pipenv run python ../.github/workflows/run_zlib_download.py
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/dev-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ jobs:
pipenv install --dev --deploy --sequential
- name: Download zlib Library
env:
AWS_ACCESS_KEY_ID: ${{ secrets.CI_IAM_GIT_PUBLISH_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_IAM_GIT_PUBLISH_SECRET_KEY }}
run: |
cd controller/
pipenv run python ../.github/workflows/run_zlib_download.py
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/run_zlib_download.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
# -*- coding: utf-8 -*-
import os
import shutil
import zipfile

import requests
import boto3

s3_resource = boto3.resource("s3")
bucket = s3_resource.Bucket("downloads.curibio.com")

# assuming this is being run from controller/
controller_folder_path = os.path.join("src", "mantarray_desktop_app")
zlib_folder_path = os.path.join(controller_folder_path, "zlib")

r = requests.get("https://www.zlib.net/zlib13.zip", allow_redirects=True)
with open(zlib_folder_path + ".zip", "wb") as zlib_zip:
zlib_zip.write(r.content)
filename = "zlib-1.3.zip"
zlib_zip_path = os.path.join(controller_folder_path, filename)
bucket.download_file(f"software/{filename}", zlib_zip_path)

with zipfile.ZipFile(zlib_folder_path + ".zip", "r") as zip_ref:
zlib_folder_path = os.path.join(controller_folder_path, "zlib")
with zipfile.ZipFile(zlib_zip_path, "r") as zip_ref:
zip_ref.extractall(controller_folder_path)

os.rename(f"{zlib_folder_path}-1.3", zlib_folder_path)

if "__MACOSX" in os.listdir(controller_folder_path):
shutil.rmtree(os.path.join(controller_folder_path, "__MACOSX"))

0 comments on commit 00968d4

Please sign in to comment.