зеркало из https://github.com/microsoft/AzureTRE.git
Run airlock's unit-tests in docker (#2128)
* airlock unit tests run in docker and ci * bump version * fix lint
This commit is contained in:
Родитель
c7206ae2d5
Коммит
c284039595
|
@ -167,6 +167,31 @@ jobs:
|
|||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
# Unit Tests are executed by calling the 'test-results' target in the
|
||||
# Dockerfile's. Test runner exit codes must be swallowed (and kept) so we
|
||||
# can output the test results. This means we have to check for failure
|
||||
# trigger files in later steps.
|
||||
- name: "Test image: airlock_processor"
|
||||
# test should be before build since its docker target
|
||||
# is prior to runtime
|
||||
if: |
|
||||
(steps.filter.outputs.airlock_processor == 'true'
|
||||
|| github.event_name == 'workflow_dispatch')
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: ./airlock_processor/
|
||||
file: ./airlock_processor/Dockerfile
|
||||
outputs: type=local,dest=test-results
|
||||
target: test-results
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: "Check pytest failure file existence"
|
||||
id: check_airlock_processor_test_result
|
||||
uses: andstor/file-existence-action@v1
|
||||
with:
|
||||
files: "test-results/pytest_airlock_processor_unit_failed"
|
||||
|
||||
- name: "Build image: airlock_processor"
|
||||
if: |
|
||||
(steps.filter.outputs.airlock_processor == 'true'
|
||||
|
|
|
@ -1,11 +1,23 @@
|
|||
# To enable ssh & remote debugging on app service change the base image to the one below
|
||||
# FROM mcr.microsoft.com/azure-functions/python:3.0-python3.8-appservice
|
||||
FROM mcr.microsoft.com/azure-functions/python:3.0-python3.8
|
||||
|
||||
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
|
||||
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
|
||||
|
||||
FROM mcr.microsoft.com/azure-functions/python:3.0-python3.8 as base
|
||||
COPY requirements.txt /
|
||||
RUN pip install --no-cache-dir -r /requirements.txt
|
||||
|
||||
|
||||
FROM base as test
|
||||
COPY requirements-dev.txt /
|
||||
RUN pip install --no-cache-dir -r /requirements-dev.txt
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN /app/run_tests_and_exit_succesfully.sh
|
||||
|
||||
|
||||
FROM scratch as test-results
|
||||
COPY --from=test /test-results/* /
|
||||
|
||||
|
||||
FROM base as runtime
|
||||
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
|
||||
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
|
||||
COPY . /home/site/wwwroot
|
||||
|
|
|
@ -1 +1 @@
|
|||
__version__ = "0.0.5"
|
||||
__version__ = "0.0.6"
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
# Dev requirements
|
||||
pytest==7.1.1
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 1. Remove any previously run failed flag
|
||||
# 2. Run pytest, but capture the exit code so we always succeed
|
||||
# 3. Output a file if the tests are not successful.
|
||||
rm -f ../test-results/pytest_airlock_processor*
|
||||
mkdir -p ../test-results
|
||||
|
||||
if ! pytest --junit-xml ../test-results/pytest_airlock_processor_unit.xml --ignore e2e_tests; then
|
||||
touch ../test-results/pytest_airlock_processor_unit_failed
|
||||
fi
|
Загрузка…
Ссылка в новой задаче