Skip to content

Commit

Permalink
Merge pull request #11 from GNS-Science/feature/save-disaggs-THS-v2
Browse files Browse the repository at this point in the history
* disaggregation
* gridded hazard
  • Loading branch information
chrisdicaprio committed Jul 26, 2023
2 parents c15dcb0 + 71e4cfa commit b28afdf
Show file tree
Hide file tree
Showing 90 changed files with 98,260 additions and 2,740 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.0
current_version = 0.3.0
commit = True
tag = True

Expand Down
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.tox
50 changes: 5 additions & 45 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,13 @@
# This is a basic workflow to help you get started with Actions
name: Dev workflow

name: dev workflow

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]
branches: [main, deploy-test]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "test"
test:
# The type of runner that the job will run on
strategy:
matrix:
python-versions: [3.8, 3.9]
os: [ubuntu-18.04]
runs-on: ${{ matrix.os }}

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-versions }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry tox tox-gh-actions
poetry export --dev --without-hashes > reqs.txt
pip install -r reqs.txt
pip install .
- name: test with tox
run:
tox

- name: list files
run: ls -l .

- uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true
files: coverage.xml
call-test-workflow:
#https://docs.github.com/en/actions/using-workflows/reusing-workflows#calling-a-reusable-workflow
uses: ./.github/workflows/run-tests.yml
63 changes: 63 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Run Tests

#https://docs.github.com/en/actions/using-workflows/reusing-workflows#calling-a-reusable-workflow

on:
workflow_call:

jobs:
run_unit_tests:
runs-on: ubuntu-latest
timeout-minutes: 10

strategy:
matrix:
python-versions: [3.8, 3.9, "3.10"]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-versions }}

- name: Install and configure Poetry
uses: GNS-Science/install-poetry@main
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
poetry install --no-interaction --no-root --with dev --all-extras
poetry add tox-gh-actions
- name: test with tox (uses tox-gh-actions to select correct environment)
run:
poetry run tox

- name: list files
run: ls -l .

- name: Submit coverage report if this is Linux
if: runner.os == 'Linux'
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false # optional (default = false)
verbose: true # optional (default = false)
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## [0.3.0] - 2023-07-24

### Added
* Disaggregation- local and AWS
* Gridded Hazard - local and AWS

### Changed
* Reduced number of conversions from probability to rate and back
* Improved parallelization
* Use nzhsm-model classes
* 100s of other updates
## [0.2.0] - 2022-08-03

### Added
Expand All @@ -10,4 +21,4 @@

## [0.1.0] - 2022-07-20

* First release on PyPI.
* First version
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ENV PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_VERSION=1.1.14 \
POETRY_VERSION=1.2.2 \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=true \
PYTHONPATH=/application_root \
Expand All @@ -32,7 +32,7 @@ RUN apt-get update \
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=$POETRY_HOME python3 - --version $POETRY_VERSION
ENV PATH "$PATH:/root/.local/bin/:$POETRY_HOME/bin"

RUN apt-get install --no-install-recommends -y git # deps for poetry seems 1.1.14 needs git !
# RUN apt-get install --no-install-recommends -y git # deps for poetry seems 1.1.14 needs git !

WORKDIR /app

Expand All @@ -46,14 +46,19 @@ ADD demo demo
ADD dist dist
ADD README.md ./

RUN poetry install --no-interaction --no-dev
# RUN poetry install --no-interaction --no-dev
RUN poetry install --no-interaction --only main

# Clean up project files. You can add them with a Docker mount later.
# RUN rm pyproject.toml poetry.lock

ADD scripts scripts
ADD pynamodb_settings.py pynamodb_settings.py
ENV PYNAMODB_CONFIG=/app/pynamodb_settings.py
RUN chmod +x /app/scripts/container_task.sh

WORKDIR /WORKING

# Hide virtual env prompt
# ENV VIRTUAL_ENV_DISABLE_PROMPT 1

Expand Down
Loading

0 comments on commit b28afdf

Please sign in to comment.