migraf/fhir-kindling

View on GitHub
.github/workflows/main_ci.yml

Summary

Maintainability
Test Coverage
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
  release:
    types: # This configuration does not affect the page_build event above
      - created
jobs:
  test:
    runs-on: ubuntu-latest
    environment: CI
    services:
      hapi:
        image: "hapiproject/hapi:latest"
        env:
          hapi.fhir.default_encoding: json
          hapi.fhir.: json
          hapi.fhir.server_address: "http://127.0.0.1:8080/fhir"
        volumes:
          - hapi:/data/hapi
        ports:
          - 8080:8080

      blaze:
        image: "samply/blaze:latest"
        env:
          JAVA_TOOL_OPTIONS: "-Xmx2g"
          BASE_URL: "http://127.0.0.1:8081"
        volumes:
          - blaze:/app/data
        ports:
          - 8081:8080
    env:
      FHIR_API_URL: http://127.0.0.1:8080/fhir
      TRANSFER_SERVER_URL: http://127.0.0.1:8081/fhir
      TRANSFER_API_URL: http://127.0.0.1:8081/fhir


    steps:
      - uses: actions/checkout@v3
      - name: Install Poetry
        uses: snok/install-poetry@v1
        
      - uses: actions/setup-python@v4
        with:
          python-version: "3.11"
          cache: "poetry"
      - name: Install deps
        run: |
          poetry lock
          poetry install --with dev --all-extras
      - name: Prefill servers with data
        run: |
          poetry run python ./testing/prefill.py

      - name: Lint with ruff
        run: |
          poetry run ruff .
      - name: Tests and coverage report
        run: |
          poetry run coverage run -m pytest fhir_kindling
          poetry run coverage xml
      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v3
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          fail_ci_if_error: true
          name: codecov-umbrella
          verbose: true

      - name: Build and deploy documentation
        run: poetry run mkdocs gh-deploy --force