Skip to content

Commit

Permalink
Capture code coverage from intgration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rosswhitfield committed Dec 1, 2023
1 parent 04e44ca commit dc87a51
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: CI
on:
pull_request:
push:
branches: main
tags: ['v*']
workflow_dispatch:


Expand Down Expand Up @@ -62,8 +60,28 @@ jobs:
run: python -m pytest tests/integration

- name: stop docker containers
run: docker-compose -f tests/integration/docker-compose.yml stop

- name: copy code coverage out
run: docker cp integration_post_processing_agent_1:/opt/postprocessing/ /tmp/

- name: combine and show coverage
shell: bash -l {0}
run: |
cd /tmp/postprocessing
coverage combine
coverage xml
cp coverage.xml $OLDPWD
coverage report
- name: down docker containers
run: docker-compose -f tests/integration/docker-compose.yml down

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

rpm:
runs-on: ubuntu-latest

Expand Down
10 changes: 9 additions & 1 deletion tests/integration/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ ARG MAMBA_DOCKERFILE_ACTIVATE=1
COPY --chown=$MAMBA_USER:$MAMBA_USER postprocessing /opt/postprocessing/postprocessing
COPY --chown=$MAMBA_USER:$MAMBA_USER tests/integration/post_processing.conf /etc/autoreduce/post_processing.conf

RUN echo \#\!/bin/bash > /opt/conda/bin/coverage_run && \
echo coverage run \$@ >> /opt/conda/bin/coverage_run && \
chmod +x /opt/conda/bin/coverage_run

ENV PYTHONPATH /opt/postprocessing

USER root
RUN echo -e "[run]\nsource=postprocessing\nparallel=True\nrelative_files=True" > /opt/postprocessing/.coveragerc
RUN mkdir -p /opt/postprocessing/log && \
mkdir -p /opt/postprocessing/scripts && \
touch /opt/postprocessing/scripts/oncat_ingest.py && \
Expand All @@ -36,4 +41,7 @@ RUN mkdir -p /opt/postprocessing/log && \

USER $MAMBA_USER

CMD /opt/postprocessing/postprocessing/queueProcessor.py
WORKDIR /opt/postprocessing
ENV COVERAGE_PROCESS_START /opt/postprocessing/.coveragerc

CMD ["coverage", "run", "postprocessing/queueProcessor.py"]
2 changes: 1 addition & 1 deletion tests/integration/post_processing.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"amq_pwd": "",
"sw_dir": "/opt/postprocessing",
"python_dir": "/opt/postprocessing/postprocessing",
"start_script": "python",
"start_script": "coverage_run",
"task_script": "PostProcessAdmin.py",
"task_script_queue_arg": "-q",
"task_script_data_arg": "-d",
Expand Down

0 comments on commit dc87a51

Please sign in to comment.