Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download zlib from S3 #614

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"))
Loading