Skip to content

Commit

Permalink
Merge pull request #292 from EasyDynamics/develop
Browse files Browse the repository at this point in the history
Sync `develop` to `main`
  • Loading branch information
Kyle Laker authored Mar 1, 2022
2 parents b7aab06 + 4abee58 commit 679fe88
Show file tree
Hide file tree
Showing 103 changed files with 87,750 additions and 46,434 deletions.
9 changes: 6 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"parser": "babel-eslint",
"extends": [
"plugin:react/recommended",
"plugin:json/recommended",
"airbnb",
"prettier"
],
Expand All @@ -18,14 +19,17 @@
},
"plugins": [
"react",
"prettier"
"prettier",
"json"
],
"rules": {
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"react/prop-types": [0],
"react/destructuring-assignment": [0],
"react/jsx-props-no-spreading": "off",
"prettier/prettier": "error"
"prettier/prettier": "error",
"import/no-extraneous-dependencies": ["error", {"packageDir": ["./", "./example"]}],
"no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_", "caughtErrorsIgnorePattern": "^_" }]
},
"overrides": [
{
Expand All @@ -38,5 +42,4 @@
}
}
]

}
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ updates:
directory: "/"
schedule:
interval: daily
reviewers:
- "EasyDynamics/easygrc-reviewers"
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
reviewers:
- "EasyDynamics/easygrc-reviewers"
53 changes: 53 additions & 0 deletions .github/workflows/dependency-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: Auto-update example app after Dependabot

on:
# Because we so heavily reference the pull request number within the workflow,
# it is preferable to use the pull_request_target. This will run after every
# pull request merged to develop that touches the main package-lock.json
pull_request_target:
types: [closed]
branches: [develop]
paths: ["package-lock.json"]

jobs:
update:
# If the pull request was closed then nothing needs to be done
if: github.event.pull_request_target.merged == true
runs-on: ubuntu-latest
name: Synchronize version
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: develop
- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: 14
- name: Globally update npm
run: npm install -g npm@latest
- name: Install library dependencies
run: npm ci
- name: Update example application dependencies
run: npm install
working-directory: example
- name: Commit back changes to example app
uses: peter-evans/create-pull-request@v3
with:
commit-message: >-
Synchronize OSCAL Viewer example app depenencies
title: Synchronize example app `package-lock.json` (#${{ github.event.pull_request.number }})
body: |
Pull request #${{ github.event.pull_request.number }} which updated some dependencies in
`/package-lock.json` was recently merged. This synchronizes those same updates back into
the `example/package-lock.json` file.
branch: automation/update-dependencies/${{ github.event.pull_request.number }}
delete-branch: true
base: develop
committer: Easy Dynamics Automation <noreply@easydynamics.com>
author: Easy Dynamics Automation <noreply@easydynamics.com>
add-paths: |
example/package.json
example/package-lock.json
37 changes: 37 additions & 0 deletions .github/workflows/gh-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Publish to GitHub Packages
on:
push:
branches: [develop]
workflow_dispatch:

concurrency: package-push

jobs:
publish:
name: Publish OSCAL Viewer Build to GitHub Packages
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
steps:
- name: Delete previous oscal-react-library version
uses: actions/delete-package-versions@v2.0.1
with:
package-name: oscal-react-library
- name: Checkout code
uses: actions/checkout@v2
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 14
registry-url: https://npm.pkg.github.com/
cache: npm
- name: Update Npm
run: npm install -g npm@latest
- name: Build and Publish Library
run: |
npm ci
npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
36 changes: 36 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Publish Storybook
on:
push:
branches:
- develop

concurrency: gh-pages

jobs:
publish:
name: Publish Storybook to GitHub Pages
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 14
cache: "npm"
- name: Globally update npm
run: npm install -g npm@latest
- name: Install dependencies
run: npm ci
- name: Build Storybook
run: npm run build-storybook
- name: Deploy to Pages
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: storybook-docs
folder: storybook-static
clean: true
single-commit: true
git-config-name: Easy Dynamics Automation
git-config-email: noreply@easydynamics.com
22 changes: 13 additions & 9 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,26 @@ jobs:
with:
fetch-depth: 0
- name: Setup NodeJS
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 14
cache: "npm"
- name: Globally update npm
run: npm install -g npm@latest
- name: Install dependencies
run:
npm install && cd example && npm install && cd ..
npm ci && cd example && npm ci && cd ..
- name: Lint Code Base
# super-linter@v4.4.0 moves to using eslint for JSON files which in
# our configuration results in JSON parsing failures. Temporarily,
# pinning to @v4.3.0 (using jsonlint) allows validation to succeed
uses: github/super-linter@v4
env:
DEFAULT_BRANCH: develop
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Our linter configuration files will be specified relative to the root of the workspace
# (/) rather than within the default directory (.github/linters)
# Our linter configuration files will be specified relative to the
# root of the workspace (/) rather than within the default directory
# (.github/linters)
LINTER_RULES_PATH: /
JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.json
MARKDOWN_CONFIG_FILE: .markdownlint.yaml
Expand All @@ -42,9 +46,9 @@ jobs:
VALIDATE_MARKDOWN: true
VALIDATE_JSON: true
VALIDATE_YAML: true
# Ideally, we should validate only changed files; we don't want to have a
# PR fail because rules changed outside the PR itself.
VALIDATE_ALL_CODEBASE: false
# Ideally, we should validate only changed files; we don't want to
# have a PR fail because rules changed outside the PR itself.
VALIDATE_ALL_CODEBASE: true
# The possum is fun but it does add a little noise to the workflow
SUPPRESS_POSSUM: true
build_and_test:
Expand All @@ -59,14 +63,14 @@ jobs:
with:
fetch-depth: 0
- name: Setup NodeJS
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: "npm"
- name: Globally update npm
run: npm install -g npm@latest
- name: Install dependencies
run: npm install && cd example && npm install && cd ..
run: npm ci && cd example && npm ci && cd ..
- name: Build library
run: npm run build
- name: Run tests
Expand Down
95 changes: 95 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
name: Create a New Release
on:
push:
branches: [EGRC-492-package]
workflow_dispatch:
inputs:
release-type:
description: >-
The type of release; either a new feature (minor version) or bug fix
(patch version)
required: true
type: choice
options: [feature, bug]

concurrency: package-repo-release

jobs:
release:
name: Create a New Release
runs-on: ubuntu-20.04
steps:
# Check out develop branch
- name: Checkout Code
uses: actions/checkout@v2
with:
ref: develop

- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 14
registry-url: https://npm.pkg.github.com/
cache: npm

- name: Update Npm
run: npm install -g npm@latest

- name: Set Up Git User Info
run: |
git config --global user.email "info@easydynamics.com"
git config --global user.name "${{ github.actor }}"
# Increment the version to the next minor release
- name: Set Version (Feature)
if: ${{ github.event.inputs.release-type == 'feature' }}
run: |
npm version minor
cd example
npm version minor
# Increment the version to the next bug fix
# Push the new version to the develop branch
- name: Set Version (Bug Fix)
#if: ${{ github.event.inputs.release-type == 'bug' }}
run: |
npm version patch
cd example
npm version patch
# Output the new package version to environment variable
- name: Get Package Version
run: |
echo "PKG_VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_ENV
- name: Build OSCAL Viewer
run: |
npm ci
cd example
npm ci
npm run build
zip -r viewer.zip ./build/
- name: Create a GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name:
${{ env.PKG_VERSION }}
files:
example/viewer.zip

# Commit the new version and push changes to main
# And push a new preminor version to develop.
# Should only run when triggered for a feature - for bug fixes
# this should be done manually since a merge might be needed.
- name: Push Changes
if: ${{ github.event.inputs.release-type == 'feature' }}
run: |
git push origin develop:main
git add ./{,example/}package{,-lock}.json
git commit -m "Build Viewer for Release ${{ env.PKG_VERSION }}"
npm version preminor
cd example
npm version preminor
git push origin develop
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,4 @@ Thumbs.db
*.flv
*.mov
*.wmv
example/.env.local
6 changes: 1 addition & 5 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# Default markdownlint.yaml:
# https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml
# Rule explanation:
# https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md

---
# Enable all rules by default
default: true

Expand Down
7 changes: 7 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
"stories": ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
"addons": ["@storybook/addon-links", "@storybook/addon-essentials", "@storybook/preset-create-react-app"],
core: {
builder: "webpack5"
}
};
9 changes: 9 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
Loading

0 comments on commit 679fe88

Please sign in to comment.