Sfoglia il codice sorgente

[DATALAD] Recorded changes

Daniel Busch 5 mesi fa
parent
commit
e7977d02b2
3 ha cambiato i file con 48 aggiunte e 23 eliminazioni
  1. 1 1
      .github/workflows/ci.yaml
  2. 45 0
      .github/workflows/datalad_setup.yaml
  3. 2 22
      dodo.py

+ 1 - 1
.github/workflows/ci.yaml

@@ -1,7 +1,7 @@
 name: CI
 
 on:
-  pull_request:
+#  pull_request:
   push:
     branches: [main]
     tags: ['v*']

+ 45 - 0
.github/workflows/datalad_setup.yaml

@@ -0,0 +1,45 @@
+name: datalad set up
+
+on:
+  pull_request:
+  push:
+    branches: [main]
+    tags: ['v*']
+
+jobs:
+  download:
+    runs-on: ubuntu-22.04
+    steps:
+      - name: install datalad
+        uses: awalsh128/cache-apt-pkgs-action@v1.4.2
+        with:
+          packages: datalad
+          version: 1.0
+      - name: Install poetry
+        shell: bash
+        run: |
+          pipx install poetry
+          which poetry
+          poetry --version  # Check poetry installation
+      - name: configure git email
+        run: git config --global user.email "daniel.busch@climate-resource.com"
+      - name: configure git user
+        run: git config --global user.name "Daniel Busch (via github actions)"
+      - name: clone repo
+        run: datalad clone https://github.com/primap-community/FAOSTAT_data_primap.git
+      - name: setup Python
+        uses: actions/setup-python@v5
+        with:
+          python-version: '3.11'
+      - name: Set Poetry environment
+        shell: bash
+        run: |
+         cd FAOSTAT_data_primap/
+         poetry config virtualenvs.create true
+         poetry config virtualenvs.in-project true
+         poetry install --no-interaction --all-extras --only 'main,dev'
+         poetry run python --version  # Check python version just in case
+      - name: download data
+        run: |
+         cd FAOSTAT_data_primap/
+         poetry run doit download

+ 2 - 22
dodo.py

@@ -3,27 +3,6 @@ Define tasks to download and read the FAO data set.
 """
 import datalad.api
 
-# we need this for the download script
-# def get_output_folders(domains_and_releases_to_read):
-#     """Get the paths of folders where output files will be saved"""
-#     output_folders = []
-#     # todo remove hard coded key
-#     for domain, release in domains_and_releases_to_read["2024"]:
-#         # todo pathlib Path
-#         output_folders.append(f"downloaded_data/{domain}/{release}")
-#     return output_folders
-
-
-def task_test_basic_target():
-    """
-    test
-    """
-
-    def do_nothing():
-        pass
-
-    return {"actions": [do_nothing]}
-
 
 def task_download():
     """
@@ -32,7 +11,8 @@ def task_download():
 
     def datalad_run_download():
         datalad.api.run(
-            cmd="python3 scripts/download_all_domains.py", outputs="downloaded_data"
+            cmd="python3 scripts/download_all_domains.py",
+            outputs="downloaded_data",
         )
 
     return {"actions": [datalad_run_download]}