Skip to content

Commit

Permalink
✨ Re-introduce aws-library (#5031)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg authored Nov 14, 2023
1 parent 4d75a0c commit 992d8be
Show file tree
Hide file tree
Showing 128 changed files with 2,681 additions and 2,062 deletions.
1 change: 1 addition & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: "ospac-simcore CodeQL config"
disable-default-queries: false

paths:
- packages/aws-library/src
- packages/dask-task-models-library/src
- packages/models-library/src/models_library
- packages/postgres-database/src/simcore_postgres_database
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/ci-testing-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
aws-library: ${{ steps.filter.outputs.aws-library }}
dask-task-models-library: ${{ steps.filter.outputs.dask-task-models-library }}
models-library: ${{ steps.filter.outputs.models-library }}
postgres-database: ${{ steps.filter.outputs.postgres-database }}
Expand Down Expand Up @@ -87,6 +88,12 @@ jobs:
id: filter
with:
filters: |
aws-library:
- 'packages/aws-library/**'
- 'packages/pytest-simcore/**'
- 'services/docker-compose*'
- 'scripts/mypy/*'
- 'mypy.ini'
dask-task-models-library:
- 'packages/dask-task-models-library/**'
- 'packages/pytest-simcore/**'
Expand Down Expand Up @@ -804,6 +811,45 @@ jobs:
with:
flags: unittests #optional

unit-test-aws-library:
needs: changes
if: ${{ needs.changes.outputs.aws-library == 'true' || github.event_name == 'push' }}
timeout-minutes: 18 # if this timeout gets too small, then split the tests
name: "[unit] aws-library"
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: ["3.10"]
os: [ubuntu-22.04]
docker_buildx: [v0.10.4]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ matrix.docker_buildx }}
driver: docker-container
- name: setup python environment
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: "pip"
cache-dependency-path: "packages/aws-library/requirements/ci.txt"
- name: show system version
run: ./ci/helpers/show_system_versions.bash
- name: install
run: ./ci/github/unit-testing/aws-library.bash install
- name: typecheck
run: ./ci/github/unit-testing/aws-library.bash typecheck
- name: test
if: always()
run: ./ci/github/unit-testing/aws-library.bash test
- uses: codecov/codecov-action@v3.1.4
with:
flags: unittests #optional

unit-test-dask-task-models-library:
needs: changes
if: ${{ needs.changes.outputs.dask-task-models-library == 'true' || github.event_name == 'push' }}
Expand Down Expand Up @@ -1447,6 +1493,7 @@ jobs:
unit-test-catalog,
unit-test-clusters-keeper,
unit-test-dask-sidecar,
unit-test-aws-library,
unit-test-dask-task-models-library,
unit-test-datcore-adapter,
unit-test-director-v2,
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"python.analysis.autoImportCompletions": true,
"python.analysis.typeCheckingMode": "basic",
"python.analysis.extraPaths": [
"./packages/aws-library/src",
"./packages/models-library/src",
"./packages/postgres-database/src",
"./packages/postgres-database/tests",
Expand Down
41 changes: 41 additions & 0 deletions ci/github/unit-testing/aws-library.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -o errexit # abort on nonzero exitstatus
set -o nounset # abort on unbound variable
set -o pipefail # don't hide errors within pipes
IFS=$'\n\t'

install() {
bash ci/helpers/ensure_python_pip.bash
make devenv
# shellcheck source=/dev/null
source .venv/bin/activate
pushd packages/aws-library
make install-ci
popd
.venv/bin/pip list --verbose
}

test() {
# shellcheck source=/dev/null
source .venv/bin/activate
pushd packages/aws-library
make tests-ci
popd
}

typecheck() {
pushd packages/aws-library
make mypy
popd
}

# Check if the function exists (bash specific)
if declare -f "$1" >/dev/null; then
# call arguments verbatim
"$@"
else
# Show a helpful error
echo "'$1' is not a known function name" >&2
exit 1
fi
49 changes: 49 additions & 0 deletions packages/aws-library/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# Targets for DEVELOPMENT of aws Library
#
include ../../scripts/common.Makefile
include ../../scripts/common-package.Makefile

.PHONY: requirements
requirements: ## compiles pip requirements (.in -> .txt)
@$(MAKE_C) requirements reqs


.PHONY: install-dev install-prod install-ci
install-dev install-prod install-ci: _check_venv_active ## install app in development/production or CI mode
# installing in $(subst install-,,$@) mode
pip-sync requirements/$(subst install-,,$@).txt


.PHONY: tests tests-ci
tests: ## runs unit tests
# running unit tests
@pytest \
--asyncio-mode=auto \
--color=yes \
--cov-config=../../.coveragerc \
--cov-report=term-missing \
--cov=aws_library \
--durations=10 \
--exitfirst \
--failed-first \
--pdb \
-vv \
$(CURDIR)/tests

tests-ci: ## runs unit tests
# running unit tests
@pytest \
--asyncio-mode=auto \
--color=yes \
--cov-append \
--cov-config=../../.coveragerc \
--cov-report=term-missing \
--cov-report=xml \
--cov=aws_library \
--durations=10 \
--log-date-format="%Y-%m-%d %H:%M:%S" \
--log-format="%(asctime)s %(levelname)s %(message)s" \
--verbose \
-m "not heavy_load" \
$(CURDIR)/tests
22 changes: 22 additions & 0 deletions packages/aws-library/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# simcore AWS library

Provides a wrapper around AWS python libraries.

Requirements to be compatible with the library:

- only AWS-related code


## Installation

```console
make help
make install-dev
```

## Test

```console
make help
make test-dev
```
1 change: 1 addition & 0 deletions packages/aws-library/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0
6 changes: 6 additions & 0 deletions packages/aws-library/requirements/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
# Targets to pip-compile requirements
#
include ../../../requirements/base.Makefile

# Add here any extra explicit dependency: e.g. _migration.txt: _base.txt
12 changes: 12 additions & 0 deletions packages/aws-library/requirements/_base.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Specifies third-party dependencies for 'aws-library'
#
--constraint ../../../requirements/constraints.txt
--requirement ../../../packages/models-library/requirements/_base.in
--requirement ../../../packages/service-library/requirements/_base.in
--requirement ../../../packages/settings-library/requirements/_base.in

aioboto3
aiocache
pydantic[email]
types-aiobotocore[ec2]
Loading

0 comments on commit 992d8be

Please sign in to comment.