Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ssa/workspaces
1 result
Show changes
Commits on Source (3)
Showing
with 114 additions and 105 deletions
[paths]
source =
./
/code/
/packages/
/code/packages
\ No newline at end of file
...@@ -65,7 +65,7 @@ services/capability/capability.log ...@@ -65,7 +65,7 @@ services/capability/capability.log
services/capability/workflow.log services/capability/workflow.log
services/workflow/workflow.log services/workflow/workflow.log
services/notification/notification.log services/notification/notification.log
**/.coverage **/.coverage*
**/htmlcov **/htmlcov
**/coverage.xml **/coverage.xml
**/coverage.json **/coverage.json
......
...@@ -117,24 +117,20 @@ unit test dev notification: ...@@ -117,24 +117,20 @@ unit test dev notification:
- build dev notification - build dev notification
.unit test coverage: unit test coverage:
stage: test-coverage stage: test-coverage
image: python:3.8-slim image: python:3.8-slim
before_script: before_script:
- apt update && apt install make
- pip install pytest pytest-cov - pip install pytest pytest-cov
script: script:
- make create-coverage-config - coverage combine --append
- coverage combine
- coverage report - coverage report
- coverage html
- coverage xml - coverage xml
artifacts: artifacts:
reports: reports:
cobertura: coverage.xml cobertura: coverage.xml
paths: paths:
- coverage.xml - coverage.xml
- htmlcov/
dependencies: dependencies:
- unit test dev workflow - unit test dev workflow
- unit test dev capability - unit test dev capability
...@@ -171,18 +167,21 @@ clean build workflow: ...@@ -171,18 +167,21 @@ clean build workflow:
variables: variables:
SERVICE_NAME: "workflow" SERVICE_NAME: "workflow"
extends: .cleanup extends: .cleanup
allow_failure: true
clean build capability: clean build capability:
stage: .post stage: .post
variables: variables:
SERVICE_NAME: "capability" SERVICE_NAME: "capability"
extends: .cleanup extends: .cleanup
allow_failure: true
clean build notification: clean build notification:
stage: .post stage: .post
variables: variables:
SERVICE_NAME: "notification" SERVICE_NAME: "notification"
extends: .cleanup extends: .cleanup
allow_failure: true
# Deploy Stages # Deploy Stages
# Disabled until GL Pages are set up # Disabled until GL Pages are set up
......
SHELL := /bin/bash SHELL := /bin/bash
.PHONY: check-build test-dev test dev setup alembic-update docker-base build coverage clean
all: dev check-build all: dev check-build
# Check if local code will pass CI build # Check if local code will pass CI build
.PHONY: check-build
check-build: docker-base docker-dev-images-locally test-dev check-build: docker-base docker-dev-images-locally test-dev
# Run tests on Dockerfile.dev images # Run tests on Dockerfile.dev images
.PHONY: test-dev
test-dev: test-dev:
docker run nrao:workflow ./bin/run-tests.sh docker run nrao:workflow ./bin/run-tests.sh
docker run nrao:capability ./bin/run-tests.sh docker run nrao:capability ./bin/run-tests.sh
docker run nrao:notification ./bin/run-tests.sh docker run nrao:notification ./bin/run-tests.sh
# Run tests on Dockerfile.local containers # Run tests on Dockerfile.local containers
.PHONY: test
test: test:
docker exec workspaces_workflow_1 ./bin/run-tests.sh docker exec workspaces_workflow_1 ./bin/run-tests.sh
docker exec workspaces_capability_1 ./bin/run-tests.sh docker exec workspaces_capability_1 ./bin/run-tests.sh
docker exec workspaces_notification_1 ./bin/run-tests.sh docker exec workspaces_notification_1 ./bin/run-tests.sh
# Setup local development environment # Setup local development environment
.PHONY: dev
dev: docker-base dev: docker-base
.PHONY: setup
setup: setup:
docker exec workspaces_capability_1 /bin/bash -c 'python -m pip install -r requirements.txt' docker exec workspaces_capability_1 /bin/bash -c 'python -m pip install -r requirements.txt'
docker exec workspaces_capability_1 /bin/bash -c 'python -m pip install -e .' docker exec workspaces_capability_1 /bin/bash -c 'python -m pip install -e .'
docker exec workspaces_workflow_1 /bin/bash -c 'python -m pip install -r requirements.txt'
docker exec workspaces_workflow_1 /bin/bash -c 'python -m pip install -e .' docker exec workspaces_workflow_1 /bin/bash -c 'python -m pip install -e .'
docker exec workspaces_notification_1 /bin/bash -c 'python -m pip install -r requirements.txt'
docker exec workspaces_notification_1 /bin/bash -c 'python -m pip install -e .' docker exec workspaces_notification_1 /bin/bash -c 'python -m pip install -e .'
docker-compose restart docker-compose restart
.PHONY: alembic-update
alembic-update: alembic-update:
cd schema; \ cd schema; \
env CAPO_PROFILE=local alembic upgrade head env CAPO_PROFILE=local alembic upgrade head
# Build images from Dockerfile.dev # Build images from Dockerfile.dev
.PHONY: docker-dev-images-locally
docker-dev-images-locally: docker-dev-images-locally:
docker build -t nrao:workflow -f services/workflow/Dockerfile.local . --build-arg capo_env=docker docker build -t nrao:workflow -f services/workflow/Dockerfile.local . --build-arg capo_env=docker
docker build -t nrao:capability -f services/capability/Dockerfile.local . --build-arg capo_env=docker docker build -t nrao:capability -f services/capability/Dockerfile.local . --build-arg capo_env=docker
docker build -t nrao:notification -f services/notification/Dockerfile.local . --build-arg capo_env=docker docker build -t nrao:notification -f services/notification/Dockerfile.local . --build-arg capo_env=docker
# Build base image # Build base image
.PHONY: docker-base
docker-base: docker-base:
docker build -t marconi.aoc.nrao.edu/ops/base:workspaces -f Dockerfile.base . docker build -t marconi.aoc.nrao.edu/ops/base:workspaces -f Dockerfile.base .
# Build docker images
build: docker-base
docker-compose build --no-cache
# Generate HTML coverage report
coverage:
docker exec workspaces_workflow_1 ./bin/run-tests.sh -b
cp services/workflow/.coverage ./.coverage.wf
docker exec workspaces_capability_1 ./bin/run-tests.sh -b
cp services/capability/.coverage ./.coverage.cap
docker exec workspaces_notification_1 ./bin/run-tests.sh -b
cp services/notification/.coverage ./.coverage.no
coverage combine --append
coverage html
# CI HELPERS # Clean up environment
# create .coveragerc clean:
.PHONY: create-coverage-config # Clean up Docker environment
create-coverage-config: docker-compose down
./ci/helpers/add-coverage-rc.sh -docker images -aq | xargs docker rmi
\ No newline at end of file docker system prune --volumes -af
docker volume prune -f
# Delete Python cache directories
find . \( -name "*.egg-info" -o -name ".pytest_cache" \) | xargs rm -r
#!/bin/bash
# This is a helper script to properly format the coverage reports in our CI pipeline
# It adds a .coveragerc config file to the project root directory
# The .coveragerc files is needed for coverage to properly generate HTML and XML reports in CI
# This is to be ran by our CI build server only
# Coveragerc reference https://coverage.readthedocs.io/en/latest/config.html#paths
# Create .coveragerc in project root
touch .coveragerc
# printf formatting:
# |<string>
# |<string>
# |<tab><string>
# |<tab><string>
# |<tab><string>
printf "%s\n%s\n\t%s\n\t%s\n\t%s\n\t%s" \
"[paths]" \
"source =" \
"./" \
"/code/src" \
"/code" >> .coveragerc
...@@ -35,9 +35,9 @@ services: ...@@ -35,9 +35,9 @@ services:
- schema - schema
volumes: volumes:
- ./services/workflow:/code - ./services/workflow:/code
- ./shared:/code/src/shared - ./shared:/packages/shared
- ./apps:/code/src/apps - ./apps:/packages/apps
- ./testing:/code/src/testing - ./testing:/packages/testing
capability: capability:
build: build:
...@@ -51,9 +51,9 @@ services: ...@@ -51,9 +51,9 @@ services:
- notification - notification
volumes: volumes:
- ./services/capability:/code - ./services/capability:/code
- ./shared:/code/src/shared - ./shared:/packages/shared
- ./apps:/code/src/apps - ./apps:/packages/apps
- ./testing:/code/src/testing - ./testing:/packages/testing
notification: notification:
build: build:
...@@ -65,9 +65,9 @@ services: ...@@ -65,9 +65,9 @@ services:
- schema - schema
volumes: volumes:
- ./services/notification:/code - ./services/notification:/code
- ./shared:/code/src/shared - ./shared:/packages/shared
- ./apps:/code/src/apps - ./apps:/packages/apps
- ./testing:/code/src/testing - ./testing:/packages/testing
frontend: frontend:
build: build:
......
...@@ -5,11 +5,15 @@ FROM marconi.aoc.nrao.edu/ops/base:workspaces ...@@ -5,11 +5,15 @@ FROM marconi.aoc.nrao.edu/ops/base:workspaces
WORKDIR /code WORKDIR /code
COPY ./services/capability ./ COPY ./services/capability ./
COPY ./shared ./src/shared
COPY ./apps/cli ./src/apps/cli WORKDIR /packages/
COPY ./testing ./src/testing
COPY ./shared ./shared
COPY ./apps/cli ./apps/cli
COPY ./testing ./testing
# Python library installation # Python library installation
WORKDIR /code
RUN pip install -r requirements.txt \ RUN pip install -r requirements.txt \
&& python setup.py develop && python setup.py develop
......
...@@ -5,11 +5,14 @@ FROM marconi.aoc.nrao.edu/ops/base:workspaces ...@@ -5,11 +5,14 @@ FROM marconi.aoc.nrao.edu/ops/base:workspaces
WORKDIR /code WORKDIR /code
COPY ./services/capability ./ COPY ./services/capability ./
COPY ./shared ./src/shared
COPY ./apps/cli ./src/apps/cli WORKDIR /packages/
COPY ./testing ./src/testing COPY ./shared ./shared
COPY ./apps/cli ./apps/cli
COPY ./testing ./testing
# Python library installation # Python library installation
WORKDIR /code/
RUN pip install -r requirements.txt \ RUN pip install -r requirements.txt \
&& python setup.py develop && python setup.py develop
......
[paths] [paths]
source = source =
./services/capability/test ./services/capability/
/code/test /code/
\ No newline at end of file \ No newline at end of file
...@@ -14,9 +14,7 @@ skip_arg="--skip-empty" ...@@ -14,9 +14,7 @@ skip_arg="--skip-empty"
# Install testing requirements # Install testing requirements
init () { init () {
cd src/testing || exit pip install -r /packages/testing/requirements.txt
pip install -r requirements.txt
cd /code || exit
# if exists, remove old .coverage file # if exists, remove old .coverage file
if [[ -e .coverage ]]; then if [[ -e .coverage ]]; then
...@@ -28,7 +26,7 @@ init () { ...@@ -28,7 +26,7 @@ init () {
run_tests () { run_tests () {
# Look for lines in requirements.txt starting with "-e" # Look for lines in requirements.txt starting with "-e"
# to find paths to packages containings tests to be executed. # to find paths to packages containings tests to be executed.
pkgs=($(sed -n "s|-e ./||p" requirements.txt | grep -v testing | tr "\n" " ")) pkgs=($(sed -n "s|-e ..||p" requirements.txt | grep -v testing | tr "\n" " "))
pkgs+=("$path_to_test") pkgs+=("$path_to_test")
for pkg in "${pkgs[@]}" for pkg in "${pkgs[@]}"
...@@ -44,7 +42,7 @@ run_tests () { ...@@ -44,7 +42,7 @@ run_tests () {
} }
pytestWithCoverage () { pytestWithCoverage () {
coverage run --parallel-mode -m pytest coverage run --parallel-mode --branch -m pytest
if [ "$1" == "b" ]; then if [ "$1" == "b" ]; then
cd /code/ && coverage combine --rcfile="/code/bin/config/.coveragerc" --append "$pkg" && cd "$pkg" cd /code/ && coverage combine --rcfile="/code/bin/config/.coveragerc" --append "$pkg" && cd "$pkg"
else else
......
# This file is intended to support the Dockerfile.base, not for actual development # This file is intended to support the Dockerfile.base, not for actual development
# DO NOT MODIFY THIS FILE, THIS IS FOR DOCKER ONLY! # DO NOT MODIFY THIS FILE, THIS IS FOR DOCKER ONLY!
-e ./src/shared/schema -e ../packages/shared/schema
-e ./src/shared/channels -e ../packages/shared/channels
-e ./src/shared/workspaces -e ../packages/shared/workspaces
-e ./src/apps/cli/utilities/wf_monitor -e ../packages/apps/cli/utilities/wf_monitor
-e ./src/testing -e ../packages/testing
behave == 1.2.6 behave == 1.2.6
pycapo == 0.3.0 pycapo == 0.3.0
......
...@@ -5,11 +5,15 @@ FROM marconi.aoc.nrao.edu/ops/base:workspaces ...@@ -5,11 +5,15 @@ FROM marconi.aoc.nrao.edu/ops/base:workspaces
WORKDIR /code WORKDIR /code
COPY ./services/notification ./ COPY ./services/notification ./
COPY ./shared ./src/shared
COPY ./apps/cli ./src/apps/cli WORKDIR /packages/
COPY ./testing ./src/testing
COPY ./shared ./shared
COPY ./apps/cli ./apps/cli
COPY ./testing ./testing
# Python library installation # Python library installation
WORKDIR /code
RUN pip install -r requirements.txt \ RUN pip install -r requirements.txt \
&& python setup.py develop && python setup.py develop
......
...@@ -5,11 +5,14 @@ FROM marconi.aoc.nrao.edu/ops/base:workspaces ...@@ -5,11 +5,14 @@ FROM marconi.aoc.nrao.edu/ops/base:workspaces
WORKDIR /code WORKDIR /code
COPY ./services/notification ./ COPY ./services/notification ./
COPY ./shared ./src/shared
COPY ./apps/cli ./src/apps/cli WORKDIR /packages/
COPY ./testing ./src/testing COPY ./shared ./shared
COPY ./apps/cli ./apps/cli
COPY ./testing ./testing
# Python library installation # Python library installation
WORKDIR /code/
RUN pip install -r requirements.txt \ RUN pip install -r requirements.txt \
&& python setup.py develop && python setup.py develop
......
[paths] [paths]
source = source =
./services/notification/test ./services/notification/
/code/test /code/
\ No newline at end of file \ No newline at end of file
...@@ -14,9 +14,7 @@ skip_arg="--skip-empty" ...@@ -14,9 +14,7 @@ skip_arg="--skip-empty"
# Install testing requirements # Install testing requirements
init () { init () {
cd src/testing || exit pip install -r /packages/testing/requirements.txt
pip install -r requirements.txt
cd /code || exit
# if exists, remove old .coverage file # if exists, remove old .coverage file
if [[ -e .coverage ]]; then if [[ -e .coverage ]]; then
...@@ -28,7 +26,7 @@ init () { ...@@ -28,7 +26,7 @@ init () {
run_tests () { run_tests () {
# Look for lines in requirements.txt starting with "-e" # Look for lines in requirements.txt starting with "-e"
# to find paths to packages containings tests to be executed. # to find paths to packages containings tests to be executed.
pkgs=($(sed -n "s|-e ./||p" requirements.txt | grep -v testing | tr "\n" " ")) pkgs=($(sed -n "s|-e ..||p" requirements.txt | grep -v testing | tr "\n" " "))
pkgs+=("$path_to_test") pkgs+=("$path_to_test")
for pkg in "${pkgs[@]}" for pkg in "${pkgs[@]}"
...@@ -44,7 +42,7 @@ run_tests () { ...@@ -44,7 +42,7 @@ run_tests () {
} }
pytestWithCoverage () { pytestWithCoverage () {
coverage run --parallel-mode -m pytest coverage run --parallel-mode --branch -m pytest
if [ "$1" == "b" ]; then if [ "$1" == "b" ]; then
cd /code/ && coverage combine --rcfile="/code/bin/config/.coveragerc" --append "$pkg" && cd "$pkg" cd /code/ && coverage combine --rcfile="/code/bin/config/.coveragerc" --append "$pkg" && cd "$pkg"
else else
......
# This file is intended to support the Dockerfile.base, not for actual development # This file is intended to support the Dockerfile.base, not for actual development
# DO NOT MODIFY THIS FILE, THIS IS FOR DOCKER ONLY! # DO NOT MODIFY THIS FILE, THIS IS FOR DOCKER ONLY!
-e ./src/shared/schema -e ../packages/shared/schema
-e ./src/shared/channels -e ../packages/shared/channels
-e ./src/shared/workspaces -e ../packages/shared/workspaces
-e ./src/apps/cli/utilities/wf_monitor -e ../packages/apps/cli/utilities/wf_monitor
-e ./src/apps/cli/executables/null -e ../packages/apps/cli/executables/null
-e ./src/apps/cli/executables/vulture -e ../packages/apps/cli/executables/vulture
-e ./src/testing -e ../packages/testing
pycapo == 0.3.0 pycapo == 0.3.0
pyramid == 1.10 pyramid == 1.10
......
...@@ -5,11 +5,15 @@ FROM marconi.aoc.nrao.edu/ops/base:workspaces ...@@ -5,11 +5,15 @@ FROM marconi.aoc.nrao.edu/ops/base:workspaces
WORKDIR /code WORKDIR /code
COPY ./services/workflow ./ COPY ./services/workflow ./
COPY ./shared ./src/shared
COPY ./apps/cli ./src/apps/cli WORKDIR /packages/
COPY ./testing ./src/testing
COPY ./shared ./shared
COPY ./apps/cli ./apps/cli
COPY ./testing ./testing
# Python library installation # Python library installation
WORKDIR /code
RUN pip install -r requirements.txt \ RUN pip install -r requirements.txt \
&& python setup.py develop && python setup.py develop
......
...@@ -5,11 +5,14 @@ FROM marconi.aoc.nrao.edu/ops/base:workspaces ...@@ -5,11 +5,14 @@ FROM marconi.aoc.nrao.edu/ops/base:workspaces
WORKDIR /code WORKDIR /code
COPY ./services/workflow ./ COPY ./services/workflow ./
COPY ./shared ./src/shared
COPY ./apps/cli ./src/apps/cli WORKDIR /packages/
COPY ./testing ./src/testing COPY ./shared ./shared
COPY ./apps/cli ./apps/cli
COPY ./testing ./testing
# Python library installation # Python library installation
WORKDIR /code/
RUN pip install -r requirements.txt \ RUN pip install -r requirements.txt \
&& python setup.py develop && python setup.py develop
......
[paths] [paths]
source = source =
./services/workflow/test ./services/workflow/
/code/test /code/
\ No newline at end of file \ No newline at end of file
...@@ -14,9 +14,7 @@ skip_arg="--skip-empty" ...@@ -14,9 +14,7 @@ skip_arg="--skip-empty"
# Install testing requirements # Install testing requirements
init () { init () {
cd src/testing || exit pip install -r /packages/testing/requirements.txt
pip install -r requirements.txt
cd /code || exit
# if exists, remove old .coverage file # if exists, remove old .coverage file
if [[ -e .coverage ]]; then if [[ -e .coverage ]]; then
...@@ -28,7 +26,7 @@ init () { ...@@ -28,7 +26,7 @@ init () {
run_tests () { run_tests () {
# Look for lines in requirements.txt starting with "-e" # Look for lines in requirements.txt starting with "-e"
# to find paths to packages containings tests to be executed. # to find paths to packages containings tests to be executed.
pkgs=($(sed -n "s|-e ./||p" requirements.txt | grep -v testing | tr "\n" " ")) pkgs=($(sed -n "s|-e ..||p" requirements.txt | grep -v testing | tr "\n" " "))
pkgs+=("$path_to_test") pkgs+=("$path_to_test")
for pkg in "${pkgs[@]}" for pkg in "${pkgs[@]}"
...@@ -44,7 +42,7 @@ run_tests () { ...@@ -44,7 +42,7 @@ run_tests () {
} }
pytestWithCoverage () { pytestWithCoverage () {
coverage run --parallel-mode -m pytest coverage run --parallel-mode --branch -m pytest
if [ "$1" == "b" ]; then if [ "$1" == "b" ]; then
cd /code/ && coverage combine --rcfile="/code/bin/config/.coveragerc" --append "$pkg" && cd "$pkg" cd /code/ && coverage combine --rcfile="/code/bin/config/.coveragerc" --append "$pkg" && cd "$pkg"
else else
......