Skip to content

Commit

Permalink
Merge branch 'main' into feat/indicate-schema-errors
Browse files Browse the repository at this point in the history
  • Loading branch information
NethmiRodrigo authored Sep 18, 2024
2 parents 5206c44 + 22d7ff7 commit 2b3c9c6
Show file tree
Hide file tree
Showing 9 changed files with 1,377 additions and 1,005 deletions.
60 changes: 44 additions & 16 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,66 +10,94 @@ on:

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

jobs:
run_e2e_tests:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repo
- name: πŸ“₯ Checkout repo
uses: actions/checkout@v4

- name: Copy test environment variables
- name: πŸ“‹ Copy test environment variables
run: cp example.env .env

- name: Setup node
- name: πŸ› οΈ Setup node
uses: actions/setup-node@v4
with:
node-version: 18

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

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

- name: Install Playwright Browsers
- name: πŸ” Get installed Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(grep '@playwright/test@' yarn.lock | sed -n 's/.*npm:\([^":]*\).*/\1/p' | head -n 1)" >> $GITHUB_ENV

- name: πŸ’Ύ Cache Playwright binaries
id: playwright-cache
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}

- name: 🎭 Install Playwright Browsers
run: npx playwright install chromium --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'

- name: Setup local cache server for Turborepo
- 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 app
- name: πŸ—οΈ Build app
run: yarn turbo run build --color

- name: Run dev server
- name: πŸ–₯️ Run dev server
run: bash e2e/support/github/run-e2e-docker-env.sh

- name: Wait for OpenMRS instance to start
- 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

- name: Run E2E tests
- name: πŸ§ͺ Run E2E tests
run: yarn playwright test

- name: Stop dev server
- name: πŸ›‘ Stop dev server
if: '!cancelled()'
run: docker stop $(docker ps -a -q)

- name: Upload Report
- name: πŸ“€ Upload Report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
overwrite: true

- name: πŸ“ Capture Server Logs
if: always()
uses: jwalton/gh-docker-logs@v2
with:
dest: './logs'

- name: πŸ“¦ Upload Logs as Artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: server-logs
path: './logs'
retention-days: 2
overwrite: true
104 changes: 57 additions & 47 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,45 @@ on:
- created

env:
ESM_NAME: "@openmrs/esm-form-builder-app"
JS_NAME: "openmrs-esm-form-builder-app.js"
TURBO_API: 'http://127.0.0.1:9080'
TURBO_TOKEN: 'turbo-token'
TURBO_TEAM: ${{ github.repository_owner }}

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@v4
- name: Setup Node.js
- name: πŸ› οΈ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"

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

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

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

- name: Run tests, lint and typechecking
- name: πŸ§ͺ Run tests, lint and type checks
run: yarn verify

- name: Run build
- name: πŸ—οΈ Run build
run: yarn turbo run build

- name: Upload Artifacts
- name: πŸ“€ Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: dist
Expand All @@ -68,59 +65,51 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Setup Node.js
- name: πŸ› οΈ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"

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

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

- name: Version
- 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: 🏷️ Version
run: yarn version "$(node -e "console.log(require('semver').inc(require('./package.json').version, 'patch'))")-pre.${{ github.run_number }}"

- name: Build
- name: πŸ—οΈ Build
run: yarn turbo run build

- name: πŸ”§ Configure Git
run: git config user.email "[email protected]" && git config user.name "OpenMRS CI"
- name: πŸ’Ύ Commit changes
run: git add . && git commit -m "Prerelease version" --no-verify

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

- name: Pre-release
- 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
- name: πŸ“€ Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: |
dist
overwrite: true

deploy_form_builder:
runs-on: ubuntu-latest

needs: pre_release

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

steps:
- name: Trigger RefApp Build
uses: fjogeleit/http-request-action@v1
with:
url: https://ci.openmrs.org/rest/api/latest/queue/O3-BF
method: "POST"
customHeaders: '{ "Authorization": "Bearer ${{ secrets.BAMBOO_TOKEN }}" }'

release:
runs-on: ubuntu-latest

Expand All @@ -130,35 +119,56 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Download Artifacts

- name: πŸ“₯ Download Artifacts
uses: actions/download-artifact@v4
- name: Use Node.js
- name: πŸ› οΈ Use Node.js
uses: actions/setup-node@v4
with:
node-version: "18"

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

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

- name: Build
- 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
- run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish --access public
- name: πŸš€ Publish to NPM
run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Upload Artifacts
- name: πŸ“€ Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: |
dist
overwrite: true

deploy_form_builder:
runs-on: ubuntu-latest

needs: pre_release

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

steps:
- name: πŸš€ Trigger RefApp Build
uses: fjogeleit/http-request-action@v1
with:
url: https://ci.openmrs.org/rest/api/latest/queue/O3-BF
method: "POST"
customHeaders: '{ "Authorization": "Bearer ${{ secrets.BAMBOO_TOKEN }}" }'
2 changes: 1 addition & 1 deletion .github/workflows/size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Compute bundle size differences
- name: πŸ“ Compute bundle size differences
uses: preactjs/compressed-size-action@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
Expand Down
Loading

0 comments on commit 2b3c9c6

Please sign in to comment.