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

Add JavaScript Style Standard and CI Enforcement #94

Closed
wants to merge 9 commits into from
Closed
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
41 changes: 41 additions & 0 deletions .github/workflows/cdm-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

# Controls when the action will run.
on:
# Triggers the workflow on pull request events but only for the master branch
# ignore pull requests that only change documentation/license files
pull_request:
branches: [ master ]
paths-ignore:
- LICENSE
- '**.md'
- .github/workflows/faux-crucible-ci.yaml
- .github/workflows/faux-ci.yaml
- 'docs/**'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: ${{ github.ref }}/cdm-ci
cancel-in-progress: true

jobs:
# Job to test installation
formatting:
# Job will run on github-hosted runner
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "20.7.0"
- name: fail if javascript files are not formatted
run: npx prettier **/*.js --check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


1 change: 1 addition & 0 deletions .github/workflows/crucible-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- LICENSE
- '**.md'
- .github/workflows/faux-crucible-ci.yaml
- .github/workflows/faux-cdm-ci.yaml
- 'docs/**'
workflow_dispatch:

Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/faux-cdm-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: faux-cdm-ci

on:
pull_request:
branches: [ master ]
paths:
- LICENSE
- '**.md'
- .github/workflows/faux-crucible-ci.yaml
- .github/workflows/faux-cdm-ci.yaml
- 'docs/**'

jobs:
cdm-ci:
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required" '
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode
5 changes: 5 additions & 0 deletions queries/cdmq/.prettierrc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# .prettierrc.toml
trailingComma = "es5"
tabWidth = 2
semi = false
singleQuote = true
41 changes: 41 additions & 0 deletions queries/cdmq/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Contributing

When contributing, apply this project's JavaScript standard style, otherwise it will fail in CI.

## Requirements

- NodeJS 20.7.0
- NPM
- ElasticSearch 7.17

## Standardizing JavaScript Style

1. Clone this repository.

```shell
git clone https://github.com/perftool-incubator/CommonDataModel.git
```

2. Change your current working directory to the CDMQ directory.

```shell
cd CommonDataModel/queries/cdmq
```

3. Install this project's Node JS dependencies.

```shell
npm install
```

4. Check current code style if changes are required with [prettier](https://prettier.io/docs/en/cli.html) using [npx](https://docs.npmjs.com/cli/v7/commands/npx).

```shell
npx prettier *.js --check
```

5. Apply code style changes.

```shell
npx prettier *.js --write
```
Loading
Loading