Skip to content

Commit

Permalink
(chore) Prepare CI and refactor to match new nomenclature
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskigen committed Aug 25, 2023
1 parent a1d2bd6 commit 6b66b02
Show file tree
Hide file tree
Showing 13 changed files with 101 additions and 186 deletions.
137 changes: 91 additions & 46 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Node.js CI
name: UgandaEMR CI

on:
workflow_dispatch:
push:
branches: [main]
pull_request:
Expand All @@ -10,22 +11,45 @@ on:
- created

env:
ESM_NAME: "@openmrs/esm-template-app"
JS_NAME: "openmrs-esm-template-app.js"
ESM_NAME: "@ugandaemr/esm-stock-management-app"
JS_NAME: "esm-ugandaemr-stock-management-app.js"

jobs:
build:
runs-on: ubuntu-latest
env:
TURBO_API: 'http://127.0.0.1:9080'
TURBO_TOKEN: ${{ secrets.TURBO_SERVER_TOKEN }}
TURBO_TEAM: ${{ github.repository_owner }}

steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"
- run: yarn install --immutable
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: yarn install --immutable

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

- run: yarn verify
- run: yarn build
- run: yarn turbo build --color --concurrency=5

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
Expand All @@ -41,29 +65,54 @@ jobs:
if: ${{ github.event_name == 'push' }}

steps:
- run: echo "Uncomment the lines below and delete this one."
# - uses: actions/checkout@v2
# - name: Download Artifacts
# uses: actions/download-artifact@v3
# - name: Use Node.js
# uses: actions/setup-node@v3
# with:
# node-version: "18.x"
# registry-url: "https://registry.npmjs.org"
# - run: yarn install --immutable
# - run: yarn version "$(node -e "console.log(require('semver').inc(require('./package.json').version, 'patch'))")-pre.${{ github.run_number }}"
# - run: yarn build
# - run: git config user.email "[email protected]" && git config user.name "OpenMRS CI"
# - run: git add . && git commit -m "Prerelease version" --no-verify
# - run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish --access public --tag next
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
# - name: Upload Artifacts
# uses: actions/upload-artifact@v3
# with:
# name: dist
# path: |
# dist
- uses: actions/checkout@v3

- name: Download Artifacts
uses: actions/download-artifact@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"
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: yarn install --immutable

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

- name: Version
run: yarn version "$(node -e "console.log(require('semver').inc(require('./package.json').version, 'patch'))")-pre.${{ github.run_number }}"

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

- run: git config user.email "<>" && git config user.name "UgandaEMR CI"
- run: git add . && git commit -m "Prerelease version" --no-verify

- name: Pre-release
run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish --access public --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: |
dist
release:
runs-on: ubuntu-latest
Expand All @@ -80,24 +129,20 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: "18.x"
registry-url: 'https://registry.npmjs.org'
- run: yarn install --immutable
- run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

deploy:
runs-on: ubuntu-latest
registry-url: "https://registry.npmjs.org"

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

if: ${{ github.event_name == 'push' }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

steps:
- run: echo "Uncomment the lines below and delete this one."
# - name: Trigger RefApp Build
# uses: fjogeleit/http-request-action@master
# with:
# url: https://ci.openmrs.org/rest/api/latest/queue/REFAPP-D3X
# method: "POST"
# customHeaders: '{ "Authorization": "Bearer ${{ secrets.BAMBOO_TOKEN }}" }'
- run: yarn turbo build --color
- run: yarn run ci:publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# UgandaEMR Stock Management

This is a frontend module for managing a stock of essential medicines and drugs built for UgandaEMR+.

A frontend module that handles stock management in UgandaEMR+. This frontend module uses the [Community backend module](https://github.com/METS-Programme/openmrs-module-ugandaemr-commodity).
2 changes: 1 addition & 1 deletion i18next-parser.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = {
lineEnding: "auto",
// Control the line ending. See options at https://github.com/ryanve/eol

locales: ["en", "am", "es", "fr", "km", "he"],
locales: ["en"],
// An array of the locales in your applications

namespaceSeparator: ":",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "@ugandaemr/esm-stock-management-app",
"version": "3.0.0",
"license": "MPL-2.0",
"description": "An OpenMRS seed application for building microfrontends",
"browser": "dist/esm-stock-management-app.js",
"description": "A frontend module that handles stock management in UgandaEMR+",
"browser": "dist/esm-ugandaemr-stock-management-app.js",
"main": "src/index.ts",
"source": true,
"scripts": {
Expand Down
4 changes: 1 addition & 3 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import dayjs from "dayjs";
import { formatDisplayDate } from "./core/utils/datetimeUtils";

export const moduleName = "@ugandaemr/esm-stock-management-app";

export const spaRoot = window["getOpenmrsSpaBase"];
export const spaBasePath = `${window.spaBase}/commodity`;
export const spaRoot = `${window["getOpenmrsSpaBase"]}`;
export const omrsDateFormat = "YYYY-MM-DDTHH:mm:ss.SSSZZ";
export const startOfDay = dayjs(new Date().setUTCHours(0, 0, 0, 0)).format(
omrsDateFormat
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { configSchema } from "./config-schema";
const moduleName = "@openmrs/esm-template-app";

const options = {
featureName: "commodity-management",
featureName: "stock-management",
moduleName,
};

Expand All @@ -21,7 +21,7 @@ export const stockManagement = getAsyncLifecycle(
);

export const stockManagementLink = getAsyncLifecycle(
() => import("./stock-management-link.commodity"),
() => import("./stock-management-link.component"),
options
);

Expand Down
13 changes: 3 additions & 10 deletions src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,21 @@
"webservices.rest": "^2.24.0"
},
"extensions": [

{
"name": "stock-management-link",
"slot": "app-menu-slot",
"component": "stockManagementLink",
"online": true,
"offline": true
"component": "stockManagementLink"
},
{
"name": "stock-management-dashboard",
"slot": "stock-management-dashboard-slot",
"component": "stockManagementDashboard",
"online": true,
"offline": true
"component": "stockManagementDashboard"
}
],
"pages": [
{
"component": "stockManagement",
"route": "commodity",
"online": true,
"offline": true
"route": "stock-management"
}
]
}
File renamed without changes.
24 changes: 0 additions & 24 deletions translations/am.json

This file was deleted.

24 changes: 0 additions & 24 deletions translations/es.json

This file was deleted.

24 changes: 0 additions & 24 deletions translations/fr.json

This file was deleted.

24 changes: 0 additions & 24 deletions translations/he.json

This file was deleted.

Loading

0 comments on commit 6b66b02

Please sign in to comment.