diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..2db271ff8 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,18 @@ +## Requirements + +- [ ] This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a [conventional commit](https://o3-dev.docs.openmrs.org/#/getting_started/contributing?id=your-pr-title-should-indicate-the-type-of-change-it-is) label. See existing PR titles for inspiration. +- [ ] My work conforms to the [OpenMRS 3.0 Styleguide](https://om.rs/styleguide) and [design documentation](https://zeroheight.com/23a080e38/p/880723-introduction). +- [ ] My work includes tests or is validated by existing tests. + +## Summary + + +## Screenshots + + +## Related Issue + + + +## Other + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..945b79838 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,130 @@ + +name: OpenMRS CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + release: + types: + - created + +env: + ESM_NAME: "openmrs-form-engine-lib" + JS_NAME: "openmrs-form-engine-lib.js" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + - run: yarn install + - run: yarn lint + - run: yarn run test + - run: yarn build + - name: Upload Artifacts + uses: actions/upload-artifact@v2 + with: + name: dist + path: | + dist + + 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@v3 + with: + node-version: '16' + 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: ${{ env.TURBO_TOKEN }} + + - name: Version + run: yarn lerna version "$(node -e "console.log(require('semver').inc(require('./lerna.json').version, 'patch'))")-pre.${{ github.run_number }}" --no-git-tag-version --no-push --yes + + - name: Build + run: yarn turbo run build --color --concurrency=5 + + - run: git config user.email "info@openmrs.org" && git config user.name "OpenMRS 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: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: packages + path: | + packages/**/dist + + + release: + runs-on: ubuntu-latest + + needs: build + + if: ${{ github.event_name == 'release' }} + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + 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: ${{ env.TURBO_TOKEN }} + + - name: Build + run: yarn turbo run build --color --concurrency=5 + + - name: Publish + run: yarn run ci:publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index 0f19ec374..000000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: Form-engine-CI - -on: - push: - branches: - - '*' - pull_request: - branches: - - '*' - release: - types: - - created - -env: - ESM_NAME: "openmrs-form-engine-lib" - JS_NAME: "openmrs-form-engine-lib.js" - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: '16' - - run: yarn install - - run: yarn lint - - run: yarn run test - - run: yarn build - - name: Upload Artifacts - uses: actions/upload-artifact@v2 - with: - name: dist - path: | - dist - - pre_release: - runs-on: ubuntu-latest - - needs: build - - if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }} - - steps: - - uses: actions/checkout@v3 - - - name: Download Artifacts - uses: actions/download-artifact@v3 - - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: '16' - registry-url: "https://registry.npmjs.org" - - run: yarn install - - run: sed -i -e "s/\(\"version\":\\s\+\"\([0-9]\+\.\?\)\+\)/\1-pre.${{ github.run_number }}/" 'package.json' - - run: | - yarn config set npmAlwaysAuth true - yarn config set npmAuthToken ${{ secrets.NPM_OHRI_ACCESS_TOKEN }} - - run: yarn npm publish --tag next - - - release: - runs-on: ubuntu-latest - - needs: build - - if: ${{ github.event_name == 'release' }} - - steps: - - uses: actions/checkout@v3 - - name: Download Artifacts - uses: actions/download-artifact@v3 - - name: Use Node.js - # Setup .npmrc file to publish to npm - uses: actions/setup-node@v3 - with: - node-version: "16.x" - registry-url: "https://registry.npmjs.org" - - run: npm ci - - run: npm publish --tag latest - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_OHRI_ACCESS_TOKEN }}