Skip to content

Commit

Permalink
Avoid necessity to rename top level directory:
Browse files Browse the repository at this point in the history
The top level directory in the zip file is suffixed with a commit hash
that relates to the downloaded test data repository. Subsequent steps in
the pipeline expect this directory have the name `test_data`. This snippet
avoids manual renaming of the extracted folder with each newer version
of the test data repository.
  • Loading branch information
DanielKotik committed Jun 10, 2024
1 parent 9923992 commit 469c123
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/cpu-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ jobs:
- name: Download test data repository from RODARE
shell: 'bash -c "docker exec -i mala-cpu python < {0}"'
run: |
import requests
import requests, shutil, zipfile
# This DOI represents all versions, and will always resolve to the latest one
DOI = "https://doi.org/10.14278/rodare.2900"
Expand All @@ -204,12 +204,12 @@ jobs:
with open("test-data.zip", mode="wb") as file:
file.write(response.content)
# Once downloaded, we have to unzip the file. The name of the root
# folder in the zip file has to be updated for data repository
# updates as well - the string at the end is the hash of the data
# repository commit.
#unzip -q test-data-1.8.1.zip
#mv mala-project-test-data-741eda6 mala_data
# Get top level dir name
dir_name = zipfile.ZipFile("test-data.zip").namelist()[0]
shutil.unpack_archive("test-data.zip", ".")
print(f"Rename {dir_name} to mala_data")
shutil.move(dir_name, "mala_data")
- name: Test mala
shell: 'bash -c "docker exec -i mala-cpu bash < {0}"'
Expand Down

0 comments on commit 469c123

Please sign in to comment.