From baa2048a13820ef87c2be1dc7b8e6df754cf48be Mon Sep 17 00:00:00 2001 From: Marcelle <53578688+m-goggins@users.noreply.github.com> Date: Fri, 21 Jun 2024 12:42:13 -0700 Subject: [PATCH] [RELEASE]-1.4.14 (#2013) * add validation workflow...sorry validation * test trigger validation workflow * formatting * attempt to trigger validation test workflow * remove test --- .github/workflows/container-validation.yaml | 124 ++++++++++++++++++++ containers/validation/app/main.py | 1 - 2 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/container-validation.yaml diff --git a/.github/workflows/container-validation.yaml b/.github/workflows/container-validation.yaml new file mode 100644 index 0000000000..9ff7f21996 --- /dev/null +++ b/.github/workflows/container-validation.yaml @@ -0,0 +1,124 @@ +name: Test validation Container + +on: + pull_request: + branches: + - "**" + paths: + - containers/validation/** + - containers/dibbs/** + merge_group: + types: + - checks_requested + push: + branches: + - main + paths-ignore: + - pyproject.toml + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + TEST_RUNNER_PYTHON_VERSION: 3.11 + CONTAINER: validation + +jobs: + python-linting: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup python ${{env.TEST_RUNNER_PYTHON_VERSION}} + uses: actions/setup-python@v5 + with: + python-version: ${{env.TEST_RUNNER_PYTHON_VERSION}} + cache: pip + - name: Install dependencies + run: | + pip install -U pip + pip install ruff==0.4.3 + - name: Run linter (ruff) + run: | + ruff check --output-format=github . + - name: Run formatter (ruff) + run: | + ruff format --check + unit-test-python-containers: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup python ${{env.TEST_RUNNER_PYTHON_VERSION}} + uses: actions/setup-python@v5 + with: + python-version: ${{env.TEST_RUNNER_PYTHON_VERSION}} + cache: pip + - name: Install pytest and pytest-cov + run: pip install pytest pytest-cov + - name: Install dependencies + working-directory: ./containers/${{env.CONTAINER}} + run: | + commit_hash=$(git rev-parse HEAD) + find ./ -name requirements.txt -exec sed -i -e "s/phdi@main/phdi@${commit_hash}/g" {} \; + pip install -r requirements.txt + if [ -f dev-requirements.txt ]; then + pip install -r dev-requirements.txt + fi + - name: Run unit tests for container with coverage + working-directory: ./containers/${{env.CONTAINER}} + run: | + python -m pytest --cov-report xml --cov=. -m "not integration" tests/ + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + toekn: ${{ secrets.CODECOV_TOKEN }} + flags: ${{ env.CONTAINER }} + integration-test-python-containers: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup python ${{env.TEST_RUNNER_PYTHON_VERSION}} + uses: actions/setup-python@v5 + with: + python-version: ${{env.TEST_RUNNER_PYTHON_VERSION}} + cache: pip + - name: Install pytest + run: pip install pytest + - name: Install dependencies + working-directory: ./containers/${{env.CONTAINER}} + # When running as a PR check, instead of importing the SDK from @main, + # import it from the current commit. (Need to do this for all containers) + run: | + if [[ $GITHUB_REF != "refs/heads/main" ]]; then + commit_hash=$(git rev-parse HEAD) + find ./ -name requirements.txt -exec sed -i -e "s/phdi@main/phdi@${commit_hash}/g" {} \; + fi + pip install -r requirements.txt + if [ -f dev-requirements.txt ]; then + pip install -r dev-requirements.txt + fi + - name: Run integration tests for containers + working-directory: ./containers/${{env.CONTAINER}}/tests/integration + run: | + python -m pytest -m "integration" + build-container: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build ${{ env.CONTAINER }} Container + uses: docker/build-push-action@v3 + with: + context: ./containers/${{ env.CONTAINER }} + push: false + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/containers/validation/app/main.py b/containers/validation/app/main.py index 4b681b7d54..8a10dfc0f7 100644 --- a/containers/validation/app/main.py +++ b/containers/validation/app/main.py @@ -50,7 +50,6 @@ def validate_elr_msg(message: str, include_error_types: list) -> ValidateRespons :param message: A string representation of an HL7v2 ORU_R01 message to be validated. :return: A dictionary with keys and values described by the ValidateResponse class. """ - details = { "details": "No validation was actually performed. Validation for ELR is " "only stubbed currently."