Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Node 16/18 and NPM #42

Merged
merged 7 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 23 additions & 49 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,33 @@ name: CI Checks
on: [push, pull_request]

jobs:
build:
name: Checkout, install, lint, prettier, build and test
lint:
name: Check audit, lint, and prettier
runs-on: ubuntu-latest
strategy:
matrix:
node: [ '12', '14', '16' ]

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache node modules
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install node dependencies
run: yarn install

- name: Check yarn audit
run: yarn audit
env:
CI: true

- name: Lint the source code
run: yarn lint
node-version: '18'
- run: npm install
jafeltra marked this conversation as resolved.
Show resolved Hide resolved
- run: npm audit
- run: npm run lint
- run: npm run prettier
env:
CI: true

- name: Check prettier formatting
run: yarn prettier
env:
CI: true

- name: Build the source code
run: yarn build
env:
CI: true
test:
name: Test node ${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node: [ '14', '16', '18' ]

- name: Execute unit tests
run: yarn test
env:
CI: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: npm install
- run: npm test
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 18.16.0
38 changes: 34 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ FHIR 1.0.2 (DSTU2), FHIR 3.0.0 (STU3), FHIR 4.0.0 ,and FHIR 4.0.1 (R4) are suppo
To use this project, you should perform the following steps:

1. Install [Node.js](https://nodejs.org/en/download/)
2. Install [Yarn](https://yarnpkg.com/en/docs/install)
3. Execute the following from this project's root directory: `yarn`
2. Execute the following from this project's root directory: `npm install`

# Using the FHIR Patient Data Source

Expand Down Expand Up @@ -64,9 +63,40 @@ const conditionFhirObject = fhirWrapper.wrap(conditionResource)
// Now conditionFhirObject can be passed into the cql execution engine
```

# Testing the Code

To run the automated unit tests, execute the following command:
```
$ npm test
```

# Linting the Code

To encourage quality and consistency within the code base, all code should pass eslint without any warnings. Many text editors can be configured to automatically flag eslint violations. We also provide an npm script for running eslint on the project. To run eslint, execute the following command:
To encourage quality and consistency within the code base, all code should pass eslint without any warnings. Many text editors can be configured to automatically flag eslint violations. We also provide an npm script for running eslint on the project. To check your code against eslint's rules, execute the following command:
```
$ npm run lint
```

To automatically fix code that violates eslint's rules:
```
$ npm run lint:fix
```

# Prettier

To encourage quality and consistency within the code base, all code should also be formatted using [Prettier](https://prettier.io/). Many text editors can be configured to automatically reformat code using Prettier on save. We also provide an npm script for running prettier on the project. To check your code against Prettier's rules, execute the following command:
```
$ npm run prettier
```

To automatically fix any code that violates Prettier's rules:
```
$ npm run prettier:fix
```

# Altogether Now!

To run the unit tests, linter, and prettier all in one shot, execute the following command:
```
$ yarn lint
$ npm run test:plus
```
Loading