511 - anonymisation for spectroscopy data #2134
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) University College London Hospitals NHS Foundation Trust | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: pixl-ci | |
on: | |
push: | |
branches: | |
- main | |
- "renovate/**" | |
pull_request: | |
workflow_dispatch: | |
# Only run actions on the most recent push to a branch | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.head_ref }}" | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Run pre-commit | |
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 | |
with: | |
extra_args: --all-files | |
- name: Validate Docker Compose config file | |
working-directory: . | |
run: | | |
cp .env.sample .env | |
docker compose config --quiet | |
test: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false # run all tests if even if one fails | |
matrix: | |
package_dir: [pixl_core, hasher, pixl_dcmd, cli, pixl_export, pixl_imaging, pytest-pixl] | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Init Python | |
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5 | |
with: | |
python-version: "3.11" | |
cache: "pip" | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e pytest-pixl/ | |
pip install -e pixl_core/[test] | |
pip install -e ${{ matrix.package_dir }}/[test] | |
- name: Run tests and generate coverage report | |
working-directory: ${{ matrix.package_dir }} | |
run: COV_CORE_SOURCE=src COV_CORE_CONFIG=.coveragerc COV_CORE_DATAFILE=.coverage.eager pytest --cov=src --cov-append --cov-report=xml --cov-report=term-missing | |
env: | |
ENV: test | |
AZURE_KEY_VAULT_NAME: test | |
AZURE_KEY_VAULT_SECRET_NAME: test | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 | |
with: | |
directory: ${{ matrix.package_dir }} | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
system-test: | |
if: ${{ ! github.event.pull_request.draft || contains(github.event.pull_request.title, '[force-system-test]') }} | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3 | |
- name: Init Python | |
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5 | |
with: | |
python-version: "3.11" | |
cache: "pip" | |
- name: Install Python dependencies | |
# The -e option is required here due to the way the | |
# code determines the export directory. See issue #318. | |
run: | | |
pip install -e pytest-pixl/ | |
pip install -e pixl_core/[test] | |
pip install -e cli/[test] | |
- name: Create .secrets.env | |
run: touch test/.secrets.env | |
- name: Build test services | |
working-directory: test | |
run: | | |
docker compose build | |
- name: Build services | |
run: | | |
docker compose build | |
- name: Run tests | |
working-directory: test | |
env: | |
EXPORT_AZ_CLIENT_ID: ${{ secrets.EXPORT_AZ_CLIENT_ID }} | |
EXPORT_AZ_CLIENT_PASSWORD: ${{ secrets.EXPORT_AZ_CLIENT_PASSWORD }} | |
EXPORT_AZ_TENANT_ID: ${{ secrets.EXPORT_AZ_TENANT_ID }} | |
EXPORT_AZ_KEY_VAULT_NAME: ${{ secrets.EXPORT_AZ_KEY_VAULT_NAME }} | |
HASHER_API_AZ_CLIENT_ID: ${{ secrets.EXPORT_AZ_CLIENT_ID }} | |
HASHER_API_AZ_CLIENT_PASSWORD: ${{ secrets.EXPORT_AZ_CLIENT_PASSWORD }} | |
HASHER_API_AZ_TENANT_ID: ${{ secrets.EXPORT_AZ_TENANT_ID }} | |
HASHER_API_AZ_KEY_VAULT_NAME: ${{ secrets.EXPORT_AZ_KEY_VAULT_NAME }} | |
run: | | |
./run-system-test.sh coverage | |
echo FINISHED SYSTEM TEST SCRIPT | |
- name: Dump queue docker logs for debugging | |
if: ${{ failure() }} | |
run: | | |
docker logs -t system-test-queue-1 2>&1 | |
- name: Dump postgres docker logs for debugging | |
if: ${{ failure() }} | |
run: | | |
docker logs -t system-test-postgres-1 2>&1 | |
- name: Dump imaging-api docker logs for debugging | |
if: ${{ failure() }} | |
run: | | |
docker logs -t system-test-imaging-api-1 2>&1 | |
- name: Dump orthanc-raw docker logs for debugging | |
if: ${{ failure() }} | |
run: | | |
docker logs -t system-test-orthanc-raw-1 2>&1 | |
- name: Dump orthanc-anon docker logs for debugging | |
if: ${{ failure() }} | |
run: | | |
docker logs -t system-test-orthanc-anon-1 2>&1 | |
- name: Dump hasher-api docker logs for debugging | |
if: ${{ failure() }} | |
run: | | |
docker logs -t system-test-hasher-api-1 2>&1 | |
- name: Dump export-api docker logs for debugging | |
if: ${{ failure() }} | |
run: | | |
docker logs -t system-test-export-api-1 2>&1 | |
- name: Dump VNA docker logs for debugging | |
if: ${{ failure() }} | |
run: | | |
docker logs -t system-test-vna-qr-1 2>&1 | |
- name: Dump DICOMWeb docker logs for debugging | |
if: ${{ failure() }} | |
run: | | |
docker logs -t system-test-dicomweb-server-1 2>&1 | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 | |
with: | |
directory: test | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |