Skip to content

Commit

Permalink
chore: verify data availability using cronjob (#232)
Browse files Browse the repository at this point in the history
* chore: verify data availability via cronjob instead of in every PR

* fix some formatting issue
  • Loading branch information
sebhoerl authored May 19, 2024
1 parent 00259df commit 67afb8e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Tests if open data is properly accessible

on:
schedule:
- cron: "0 10 * * 0" # every sunday 10am

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: "ile-de-france"
environment-file: environment.yml
python-version: "3.10"
channels: conda-forge

- name: Verify availability of open data
shell: bash -el {0}
run: |
python scripts/verify_data.py
6 changes: 0 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,3 @@ jobs:
shell: bash -el {0}
run: |
MKL_CBWR=AUTO pytest tests/
- name: Verify availability of open data
if: matrix.os == 'ubuntu-latest'
shell: bash -el {0}
run: |
python scripts/verify_data.py
5 changes: 4 additions & 1 deletion docs/verify_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
},

{
"name": "SIRET géolocalisé",
"name": "SIRET géolocalisé",
"urls": [
"https://adresse.data.gouv.fr/donnees-nationales"
]
Expand Down Expand Up @@ -121,12 +121,15 @@
]

# Start testing process
import time
from urllib.request import urlopen

any_errors = False
sleep_time = 10 # s

for test in tests:
print("Testing %s ..." % test["name"])
time.sleep(sleep_time)

for url in test["urls"]:
try:
Expand Down

0 comments on commit 67afb8e

Please sign in to comment.