-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
1,197 additions
and
413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ omit = | |
*/site-packages/* | ||
*/tests/* | ||
*__init__* | ||
*/_version.py | ||
|
||
exclude_lines = | ||
if __name__ == '__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
default_language_version: | ||
python: python3.12 | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
exclude: test_scraper_.*\.json | ||
- id: check-ast | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.6.1 | ||
hooks: | ||
# Run the linter. | ||
- id: ruff | ||
args: [--config, .config/ruff.toml, --fix] | ||
# Run the formatter. | ||
- id: ruff-format | ||
args: [--config, .config/ruff.toml] | ||
- repo: https://github.com/astral-sh/uv-pre-commit | ||
rev: 0.2.37 | ||
hooks: | ||
# Run the pip compile | ||
- id: pip-compile | ||
name: pip-compile requirements.txt | ||
files: pyproject.toml | ||
args: [ pyproject.toml, --resolver=backtracking, --upgrade, -q, | ||
-o, requirements.txt ] | ||
- id: pip-compile | ||
name: pip-compile requirements-test.txt | ||
files: pyproject.toml | ||
args: [ pyproject.toml, --resolver=backtracking, --upgrade, -q, | ||
--extra, test, -c, requirements.txt, -o, requirements-test.txt ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[pytest] | ||
pythonpath = ../src | ||
addopts = "--color=yes" | ||
log_cli = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
line-length = 79 | ||
exclude = ["_version.py"] | ||
|
||
[lint] | ||
# List of rules: https://docs.astral.sh/ruff/rules/ | ||
select = [ | ||
"E", # pycodestyle - default | ||
"F", # pyflakes - default | ||
"I" # isort | ||
] | ||
|
||
[lint.isort] | ||
known-local-folder = ["hdx.scraper.acled"] | ||
known-third-party = ["hdx.api", "hdx.location", "hdx.data", "hdx.database", "hdx.facades", "hdx.scraper", "hdx.utilities"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# This workflow will install Python dependencies and run the script | ||
|
||
name: Run script | ||
|
||
on: | ||
workflow_dispatch: # add run button in github | ||
schedule: | ||
- cron: "32 10 * * *" | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.x | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
pip install . | ||
- name: Run script | ||
env: | ||
HDX_SITE: ${{ vars.HDX_SITE }} | ||
HDX_KEY: ${{ secrets.HDX_BOT_SCRAPERS_API_TOKEN }} | ||
PREPREFIX: ${{ secrets.HDX_PIPELINE_PREPREFIX }} | ||
USER_AGENT: ${{ vars.USER_AGENT }} | ||
EXTRA_PARAMS: ${{ vars.EXTRA_PARAMS }} | ||
run: | | ||
python -m hdx.scraper.acled | ||
- name: Send mail | ||
if: failure() | ||
uses: dawidd6/action-send-mail@v3 | ||
with: | ||
server_address: ${{secrets.HDX_PIPELINE_EMAIL_SERVER}} | ||
server_port: ${{secrets.HDX_PIPELINE_EMAIL_PORT}} | ||
username: ${{secrets.HDX_PIPELINE_EMAIL_USERNAME}} | ||
password: ${{secrets.HDX_PIPELINE_EMAIL_PASSWORD}} | ||
subject: "FAILED: ${{github.repository}} run job" | ||
body: GitHub Actions run job for ${{github.repository}} failed! | ||
to: ${{vars.HDX_PIPELINE_EMAIL_LIST}} | ||
from: ${{secrets.HDX_PIPELINE_EMAIL_FROM}} | ||
|
||
workflow-keepalive: | ||
if: github.event_name == 'schedule' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: write | ||
steps: | ||
- uses: liskin/gh-workflow-keepalive@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# This workflow will install Python dependencies, lint and run tests | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Run tests | ||
|
||
on: | ||
workflow_dispatch: # add run button in github | ||
push: | ||
branches-ignore: | ||
- gh-pages | ||
- 'dependabot/**' | ||
pull_request: | ||
branches-ignore: | ||
- gh-pages | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
- name: Install Hatch | ||
uses: pypa/hatch@install | ||
- name: Test with hatch/pytest | ||
env: | ||
HDX_KEY_TEST: ${{ secrets.HDX_BOT_SCRAPERS_API_TOKEN }} | ||
GSHEET_AUTH: ${{ secrets.GSHEET_AUTH }} | ||
run: | | ||
hatch test | ||
- name: Check styling | ||
if: always() | ||
run: | | ||
hatch fmt --check | ||
- name: Publish Unit Test Results | ||
uses: EnricoMi/publish-unit-test-result-action@v2 | ||
if: always() | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
junit_files: test-results.xml | ||
- name: Publish in Coveralls | ||
uses: coverallsapp/github-action@v2 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
flag-name: tests | ||
format: lcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.