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

chore: verify data availability using cronjob #232

Merged
merged 2 commits into from
May 19, 2024
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
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
Loading