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

V0.5.0rc2 #117

Merged
merged 41 commits into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
986c8be
revert docker compsoe update
austinorr Sep 8, 2021
aa8cdc2
bump minor version and requirements
austinorr Sep 13, 2021
386dbcf
include data files during install
austinorr Sep 13, 2021
0dcefb0
improve field descriptions
austinorr Sep 23, 2021
1f0b851
patch invalid treatment facility construct bug
austinorr Sep 23, 2021
40f8fff
Merge branch 'develop' of github.com:Geosyntec/nereid into v0.5.0rc1
austinorr Sep 24, 2021
5ed3ae8
workflow to build and push
austinorr Oct 10, 2021
32e4d9b
update build workflow
austinorr Oct 10, 2021
675c950
Update build.yml
austinorr Oct 11, 2021
21ff4fe
Update build.yml
austinorr Oct 11, 2021
d7dd040
Update docker-compose.deploy.images.yml
austinorr Oct 11, 2021
954334e
Update build.yml
austinorr Oct 11, 2021
87057e9
Update build.yml
austinorr Oct 11, 2021
a39d558
improve pip install packaging
austinorr Oct 29, 2021
3102e4c
login azure
austinorr Nov 29, 2021
4033881
new facility types for dry wells and tmnt
austinorr Nov 29, 2021
3ed7149
cleanup, test, and appease linter
austinorr Nov 30, 2021
8677c2a
Build and push (#114)
austinorr Nov 30, 2021
6c6a686
Merge branch 'develop' of github.com:Geosyntec/nereid into v0.5.0rc1
austinorr Nov 30, 2021
15138a7
Merge branch 'v0.5.0rc1' of github.com:Geosyntec/nereid into v0.5.0rc1
austinorr Nov 30, 2021
afbfe2c
patch build workflow triggers to main branches only
austinorr Nov 30, 2021
53ce466
patch test workflows
austinorr Nov 30, 2021
f57d8f2
wip one container progress, sync endpoints, tests, nocache
austinorr Jan 3, 2022
0e464d9
blacken
austinorr Feb 17, 2022
5c27f4f
patch pandas 1.4.0
austinorr Feb 17, 2022
0742d1b
stabilize cache
austinorr Feb 17, 2022
c593448
bump docker and deps
austinorr Feb 17, 2022
55d1988
better test failure response
austinorr Feb 18, 2022
10ff4df
Merge branch 'one-container' into merge-050-onecontainer
austinorr Feb 18, 2022
01be1b2
safe expose redis
austinorr Feb 24, 2022
8bc93e5
improve install
austinorr Feb 24, 2022
4e5bf60
bump deps
austinorr Feb 24, 2022
f59016f
add diff to black lint
austinorr Feb 24, 2022
c2e698c
cleanup redis env
austinorr Feb 24, 2022
c5d9d05
add pytest arg
austinorr Feb 24, 2022
2d7c4af
remove the redis cache
austinorr Feb 25, 2022
b114a05
enable optional async, default to one container
austinorr Feb 25, 2022
9be8082
tag as 0.5.0rc2
austinorr Feb 25, 2022
c4d433c
patch config load .env
austinorr Feb 25, 2022
54e15f9
polish tests and install pattern
austinorr Feb 25, 2022
2b1f559
add deps to install
austinorr Feb 25, 2022
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
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
**/.pytest_cache
**/.mypy_cache
**/.coverage
**/.env
**/.env
76 changes: 76 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Build and Push Image

on:
push:
branches:
- develop
- master
workflow_dispatch:

jobs:
build-and-push:
strategy:
fail-fast: false
matrix:
targets: [nereid, redis, celeryworker]
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Prepare
id: prep
run: |
DOCKER_IMAGE=${{ secrets.ACR_SERVER }}/nereid/${{ matrix.image }}
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
if [ "${{ github.event_name }}" = "schedule" ]; then
VERSION=nightly
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
echo "tags: $TAGS"
echo ::set-output name=tags::${TAGS}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"

- name: Login to Azure
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ${{ secrets.ACR_SERVER }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}

- name: Build and Push
id: docker_build
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: ./nereid
file: ./nereid/Dockerfile.multi
target: ${{ matrix.image }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
20 changes: 11 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
workflow_dispatch:
schedule:
# every other sunday at noon.
- cron: '0 12 1-7,15-21,29-31 * 0'
- cron: "0 12 1-7,15-21,29-31 * 0"

jobs:
python-test:
runs-on: ubuntu-latest
Expand All @@ -20,7 +20,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9
- name: Install Deps
run: pip install -r nereid/requirements.txt -r nereid/requirements_tests.txt
- name: Run Tests
Expand All @@ -36,11 +36,11 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9
- name: Install nereid as library
run: |
pip install .
pip install -r nereid/requirements_tests.txt
pip install .
pip install pytest
- name: Run Tests
run: pytest nereid/nereid/tests/test_src -xv

Expand All @@ -64,7 +64,7 @@ jobs:
- name: Run Edge Tests
continue-on-error: true
run: |
pytest nereid/nereid/tests/test_src -xv
pytest nereid/nereid/tests -xv
- name: Exit
run: exit 0

Expand All @@ -77,10 +77,12 @@ jobs:
- name: build stack
run: |
docker --version
bash ./scripts/build_deploy.sh
bash ./scripts/build_dev.sh
docker-compose up -d nereid-tests
- name: run tests
run: docker-compose exec -T nereid-tests coverage run -m pytest -xv
run: |
docker compose exec -T nereid-tests coverage run --branch -m pytest nereid/tests -xs
docker compose exec -T nereid-tests coverage run -a --branch -m pytest nereid/tests/test_api -xs --async
- name: coverage
run: |
docker-compose exec -T nereid-tests coverage report -mi
Expand Down
12 changes: 6 additions & 6 deletions docker-compose.deploy.images.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: '3.7'
version: "3.7"
services:
nereid:
image: sitkacontainers.azurecr.io/ocstormwatertools/nereid_nereid:${NEREID_IMAGE_TAG:-latest}
image: ${ACR_SERVER}/nereid/nereid:${NEREID_IMAGE_TAG:-latest}
celeryworker:
image: sitkacontainers.azurecr.io/ocstormwatertools/nereid_celeryworker:${NEREID_IMAGE_TAG:-latest}
image: ${ACR_SERVER}/nereid/celeryworker:${NEREID_IMAGE_TAG:-latest}
nereid-tests:
image: sitkacontainers.azurecr.io/ocstormwatertools/nereid_nereid-tests:${NEREID_IMAGE_TAG:-latest}
image: ${ACR_SERVER}/nereid/nereid-tests:${NEREID_IMAGE_TAG:-latest}
redis:
image: sitkacontainers.azurecr.io/ocstormwatertools/nereid_redis:${NEREID_IMAGE_TAG:-latest}
image: ${ACR_SERVER}/nereid/redis:${NEREID_IMAGE_TAG:-latest}
flower:
image: sitkacontainers.azurecr.io/ocstormwatertools/nereid_flower:${NEREID_IMAGE_TAG:-latest}
image: ${ACR_SERVER}/nereid/flower:${NEREID_IMAGE_TAG:-latest}
2 changes: 2 additions & 0 deletions docker-compose.shared.env.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
version: '3.7'
services:
nereid:
environment:
- NEREID_ASYNC_MODE=replace
env_file:
- env.env
nereid-tests:
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.shared.ports.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: '3.7'
services:
redis:
ports:
- 6379:6379
expose:
- 6379
nereid:
ports:
- '80:80'
Expand Down
4 changes: 1 addition & 3 deletions env.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
__CELERY_BROKER_URL=redis://guest@redis:6379/0
__CELERY_RESULT_BACKEND=redis://guest@redis:6379/0
CELERY_BROKER_URL=redis://redis:6379/0
CELERY_RESULT_BACKEND=redis://redis:6379/0
CELERY_RESULT_BACKEND=redis://redis:6379/0
40 changes: 38 additions & 2 deletions make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ if /i %1 == up goto :up
if /i %1 == down goto :down
if /i %1 == typecheck goto :typecheck
if /i %1 == coverage goto :coverage
if /i %1 == coverage-sync goto :coverage-sync
if /i %1 == coverage-async goto :coverage-async
if /i %1 == coverage-all goto :coverage-all
if /i %1 == cover-src goto :cover-src
if /i %1 == dev-server goto :dev-server
if /i %1 == restart goto :restart
if /i %1 == lint goto :lint
if /i %1 == login goto :login

:help
echo Commands:
Expand All @@ -31,10 +35,15 @@ goto :eof

set COMPOSE_DOCKER_CLI_BUILD=1

:login
bash scripts/az-login.sh
goto :eof

:test
call make clean
call make restart
docker compose exec nereid-tests pytest %2 %3 %4 %5 %6
for /f "tokens=1,* delims= " %%a in ("%*") do set ALL_BUT_FIRST=%%b
docker compose exec nereid-tests pytest %ALL_BUT_FIRST%
goto :eof

:typecheck
Expand All @@ -59,7 +68,29 @@ goto :eof
:coverage
call make clean
call make restart
docker compose exec nereid-tests coverage run -m pytest -x
docker compose exec nereid-tests coverage run --branch -m pytest nereid/tests -xs
docker compose exec nereid-tests coverage report -m
goto :eof

:coverage-sync
call make clean
call make restart
docker compose exec nereid-tests coverage run --branch -m pytest nereid/tests -xs
docker compose exec nereid-tests coverage report -m --omit=*test*,*bg_*,*celery_*
goto :eof

:coverage-async
call make clean
call make restart
docker compose exec nereid-tests coverage run --branch -m pytest nereid/tests -xs --async
docker compose exec nereid-tests coverage report -m --omit=*test*,*_sync*
goto :eof

:coverage-all
call make clean
call make restart
docker compose exec nereid-tests coverage run --branch -m pytest nereid/tests -xs
docker compose exec nereid-tests coverage run -a --branch -m pytest nereid/tests/test_api -xs --async
docker compose exec nereid-tests coverage report -m
goto :eof

Expand All @@ -85,3 +116,8 @@ goto :eof
:lint
bash scripts/lint.sh
goto :eof

rem docker build --target nereid_install -t nereid_install -f nereid/Dockerfile.multi .
rem docker run -it -v %cd%:/nereid -p 8088:80 --expose 80 nereid_install bash
rem pip install -e .[app]
rem uvicorn nereid.main:app --port 80 --host 0.0.0.0 --reload
2 changes: 1 addition & 1 deletion nereid/.coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ branch = True
[report]
include = nereid/*.py
ignore_errors = True
omit = nereid/data/*
omit = nereid/data/*,*main.py
Loading