Skip to content

Commit

Permalink
Merge pull request #25 from Michaelndula/billing
Browse files Browse the repository at this point in the history
Adding Working billing module
  • Loading branch information
PiusKariuki authored Jul 17, 2024
2 parents 412d422 + ed2b442 commit 3ff5a56
Show file tree
Hide file tree
Showing 116 changed files with 20,005 additions and 2,362 deletions.
299 changes: 299 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,299 @@
name: eHospital CI

on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types:
- created

env:
TURBO_API: 'http://127.0.0.1:9080'
TURBO_TOKEN: ${{ secrets.TURBO_SERVER_TOKEN }}
TURBO_TEAM: ${{ github.repository_owner }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
actions: read

steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"

- name: Cache dependencies
id: cache
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install

- name: Setup local cache server for Turborepo
uses: felixmosh/turborepo-gh-artifacts@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
server-token: ${{ secrets.TURBO_SERVER_TOKEN }}

- name: Run build
run: yarn turbo run build --color --concurrency=5

- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: packages
path: |
packages/**/dist
deploy_esm_billing_app:
runs-on: ubuntu-latest

env:
DIR_NAME: "esm-billing-app"
ESM_NAME: "@ssemr/esm-patient-hiv-art-app"
JS_NAME: "ssemr-esm-patient-hiv-art-app.js"

needs: build

if: ${{ github.event_name == 'push' }}

steps:
- name: Download Artifacts
uses: actions/download-artifact@v2

- name: Compute Timestamp
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Prepare Directory
shell: bash
run: |
mkdir -p dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}
mv packages/${{ env.DIR_NAME }}/dist/*.* dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/
ls dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/
deploy_esm_patient_registration_app:
runs-on: ubuntu-latest

env:
DIR_NAME: "esm-patient-registration-app"
ESM_NAME: "@sjthc/esm-billing-app"
JS_NAME: "sjthc-esm-billing-app.js"

needs: build

if: ${{ github.event_name == 'push' }}

steps:
- name: Download Artifacts
uses: actions/download-artifact@v2

- name: Compute Timestamp
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Prepare Directory
shell: bash
run: |
mkdir -p dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}
mv packages/${{ env.DIR_NAME }}/dist/*.* dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/
ls dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/
deploy_esm_patient_list_app:
runs-on: ubuntu-latest

env:
DIR_NAME: "esm-patient-list-app"
ESM_NAME: "@sjthc/esm-patient-list-app"
JS_NAME: "sjthc-esm-patient-list-app.js"

needs: build

if: ${{ github.event_name == 'push' }}

steps:
- name: Download Artifacts
uses: actions/download-artifact@v2

- name: Compute Timestamp
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Prepare Directory
shell: bash
run: |
mkdir -p dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}
mv packages/${{ env.DIR_NAME }}/dist/*.* dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/
ls dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/
deploy_esm_patient_registartion_app:
runs-on: ubuntu-latest

env:
DIR_NAME: "esm-patient-registration-app"
ESM_NAME: "@sjthc/esm-patient-registration-app"
JS_NAME: "sjthc-esm-patient-registration-app.js"

needs: build

if: ${{ github.event_name == 'push' }}

steps:
- name: Download Artifacts
uses: actions/download-artifact@v2

- name: Compute Timestamp
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Prepare Directory
shell: bash
run: |
mkdir -p dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}
mv packages/${{ env.DIR_NAME }}/dist/*.* dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/
ls dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/
deploy_esm_reports_app:
runs-on: ubuntu-latest

env:
DIR_NAME: "esm-reports-app"
ESM_NAME: "@sjthc/esm-reports-app"
JS_NAME: "sjthc-esm-reports-app.js"

needs: build

if: ${{ github.event_name == 'push' }}

steps:
- name: Download Artifacts
uses: actions/download-artifact@v2

- name: Compute Timestamp
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Prepare Directory
shell: bash
run: |
mkdir -p dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}
mv packages/${{ env.DIR_NAME }}/dist/*.* dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/
ls dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/
deploy_esm_service_queues_app:
runs-on: ubuntu-latest

env:
DIR_NAME: "esm-service-queues-app"
ESM_NAME: "@sjthc/esm-service-queues-app"
JS_NAME: "sjthc-esm-service-queues-app.js"

needs: build

if: ${{ github.event_name == 'push' }}

steps:
- name: Download Artifacts
uses: actions/download-artifact@v2

- name: Compute Timestamp
run: echo "TIMESTAMP=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Prepare Directory
shell: bash
run: |
mkdir -p dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}
mv packages/${{ env.DIR_NAME }}/dist/*.* dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/
ls dist/${{ env.ESM_NAME }}/${{ env.TIMESTAMP }}_${{ github.sha }}/
pre_release:
runs-on: ubuntu-latest

needs: build

if: ${{ github.event_name == 'push' }}

steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 18
registry-url: "https://registry.npmjs.org"

- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npx lerna bootstrap

- name: Build
run: yarn turbo run build --color

- name: Patch
run: yarn lerna version patch --no-git-tag-version --no-push --yes

- name: Version
run: npx lerna version "$(node -e "console.log(require('./lerna.json').version)")-pre.${{ github.run_number }}" --no-git-tag-version --yes

- run: git config user.email "[email protected]" && git config user.name "eHospital CI"
- run: git add . && git commit -m "Prerelease version" --no-verify

- name: Pre-release
run: yarn run ci:prepublish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: see directory
shell: bash
run: |
ls -alh
release:
runs-on: ubuntu-latest

needs: build

if: ${{ github.event_name == 'release' }}

steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'

- name: Cache dependencies
id: cache
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

- name: Setup local cache server for Turborepo
uses: felixmosh/turborepo-gh-artifacts@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
server-token: ${{ env.TURBO_TOKEN }}

- name: Build
run: yarn turbo run build --color --concurrency=5

- name: Publish
run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn run ci:publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
32 changes: 11 additions & 21 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,53 +11,43 @@ on:
jobs:
main:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v3

- name: Copy test environment variables
run: cp example.env .env
run: |
cp example.env .env
- name: Setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v3
with:
node-version: "18"
node-version: 18

- name: Cache dependencies
id: cache
uses: actions/cache@v4
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

- name: Install Playwright Browsers
run: npx playwright install chromium --with-deps

- name: Build apps
run: yarn turbo run build --color --concurrency=5

- name: Run dev server
run: bash e2e/support/github/run-e2e-docker-env.sh

- name: Wait for OpenMRS instance to start
run: while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/openmrs/login.htm)" != "200" ]]; do sleep 10; done
run: yarn start --sources 'packages/esm-*-app/' --port 8800 &

- name: Run E2E tests
run: yarn test-e2e

- name: Stop dev server
if: "!cancelled()"
run: docker stop $(docker ps -a -q)
run: yarn playwright test

- name: Upload report
- name: Upload Report
uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
retention-days: 30
Loading

0 comments on commit 3ff5a56

Please sign in to comment.