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

test #7

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"sandboxes": ["vanilla"]
}
10 changes: 10 additions & 0 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Pull Request validation Action workflow.
on: [pull_request]
jobs:
pr_validation_job:
runs-on: ubuntu-latest
name: A job to run test
steps:
- name: Run the script
id: test_script
uses: Brailor/instructure-ui@master
31 changes: 31 additions & 0 deletions .github/workflows/vrt-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# .github/workflows/chromatic.yml

# Other configuration required
name: Chromatic check.
on: [push]
jobs:
chromatic-deployment:
runs-on: ubuntu-latest
steps:
# 👇 Version 2 of the action
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0 # 👈 Required to retrieve git history
- name: Install Node 10
uses: actions/setup-node@v2
with:
node-version: '10'
- name: Install dependencies
run: yarn
- name: Build dependencies
run: yarn bootstrap
# 👇 Adds Chromatic as a step in the workflow
- name: Publish to Chromatic
uses: chromaui/action@v1
# Options required to the GitHub Chromatic Action
with:
token: ${{ secrets.GITHUB_TOKEN }}
# 👇 Chromatic projectToken, refer to the manage page to obtain it.
projectToken: ${{ secrets.CHROMATIC_APP_TOKEN }}
exitZeroOnChanges: true
7 changes: 7 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# action.yml
name: 'PR Validation Action'
runs:
using: 'docker'
image: './docker/Dockerfile.test'
entrypoint: './docker/test'

4,757 changes: 4,757 additions & 0 deletions build-storybook.log

Large diffs are not rendered by default.

10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
"start:examples": "lerna run start --stream --scope docs-examples",
"generate:sketch": "lerna run generate:sketch --stream --scope docs-examples",
"husky:pre-commit": "npm-run-all update:package:list commit:package:list lint:staged",
"husky:pre-push": "yarn lint:commit"
"husky:pre-push": "yarn lint:commit",
"build-storybook": "lerna run build-storybook --stream --scope docs-examples"
},
"license": "MIT",
"resolutions": {
Expand Down Expand Up @@ -123,12 +124,7 @@
"git add"
]
},
"husky": {
"hooks": {
"pre-commit": "yarn husky:pre-commit",
"pre-push": "yarn husky:pre-push"
}
},

"browserslist": [
"extends @instructure/browserslist-config-instui"
]
Expand Down
34 changes: 23 additions & 11 deletions packages/__examples__/.storybook/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@

// eslint-disable-next-line import/no-unresolved
import '@instructure/ui-polyfill-loader!'
import 'storybook-chromatic'
// import 'storybook-chromatic'

import { create } from '@storybook/theming'
import { getStorybook, storiesOf, configure, addParameters } from '@storybook/react'
import {
getStorybook,
storiesOf,
configure,
addParameters
} from '@storybook/react'

import { theme } from '@instructure/canvas-theme'
theme.use({ overrides: { transitions: { duration: '0ms' } } })
Expand All @@ -44,19 +49,27 @@ addParameters({
base: 'light',
name: 'instructure-ui',
brandUrl: 'https://instructure.design',
brandImage: 'https://instructure.design/icons-bea652a7d0546b99c7cba9d3b4a538ee/favicon-32x32.png'
brandImage:
'https://instructure.design/icons-bea652a7d0546b99c7cba9d3b4a538ee/favicon-32x32.png'
}),
showPanel: false,
isFullscreen: false
}
})

configure(() => {
const examplesContext = require.context('../../', true, /^.*\/src\/.*\.examples\.js$/, 'lazy')
const examplesContext = require.context(
'../../',
true,
/^.*\/src\/.*\.examples\.js$/,
'lazy'
)
let numStories = 0

// eslint-disable-next-line no-console
console.log(`Creating stories for ${examplesContext.keys().length} components...`)
console.log(
`Creating stories for ${examplesContext.keys().length} components...`
)

examplesContext.keys().map((requirePath) => {
examplesContext(requirePath).then(({ componentName, sections }) => {
Expand All @@ -67,12 +80,11 @@ configure(() => {
pages.forEach((page, i) => {
page.renderExample = renderExample
numStories++
stories
.add(
`${sectionName}${pages.length > 1 ? ` (page ${i + 1})` : ''}`,
renderPage.bind(null, page),
{ chromatic: page.parameters }
)
stories.add(
`${sectionName}${pages.length > 1 ? ` (page ${i + 1})` : ''}`,
renderPage.bind(null, page),
{ chromatic: page.parameters }
)
})
})
}
Expand Down
4,751 changes: 4,751 additions & 0 deletions packages/__examples__/build-storybook.log

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/__examples__/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"prestart": "yarn bundle",
"start": "ui-scripts --server -p 9001",
"start:watch": "ui-build --examples --watch -p 9090",
"storybook": "yarn start",
"build-storybook": "yarn bundle",
"test:vrt": "ui-test --vrt -p 9001",
"accept:vrt": "ui-test --vrt -p 9001 --auto-accept-changes",
"bundle": "ui-build --examples",
Expand All @@ -38,7 +38,7 @@
"react": "^16.8",
"react-dom": "^16.8",
"story2sketch": "^1.7.0",
"storybook-chromatic": "^2.0.0",
"chromatic": "^5",
"webpack-merge": "^4.2.1"
}
}
40 changes: 14 additions & 26 deletions packages/ui-scripts/lib/test/vrt.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,28 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
const { runCommandsConcurrently, getCommand } = require('@instructure/command-utils')

const {
CHROMATIC_APP_CODE,
GERRIT_CHANGE_ID,
GERRIT_PROJECT,
GERRIT_BRANCH
} = process.env
runCommandsConcurrently,
getCommand
} = require('@instructure/command-utils')

const { CHROMATIC_APP_CODE } = process.env

const args = process.argv.slice(2)

// ui-build --vrt -p 8080
const portIndex = args.findIndex(arg => arg === '-p')
let port = '9001'
if (portIndex > 0) {
port = args[portIndex + 1]
}
const portIndex = args.findIndex((arg) => arg === '-p')

let chromaticArgs = ['test', '--storybook-port', port]
let chromaticArgs = ['--list', '--debug']

if (args.includes('--auto-accept-changes')) {
chromaticArgs.push('--auto-accept-changes')
}

process.exit(runCommandsConcurrently({
chromatic: getCommand(
'chromatic',
chromaticArgs,
[
`CI=true`,
`CHROMATIC_APP_CODE=${CHROMATIC_APP_CODE}`,
(GERRIT_CHANGE_ID ? `GERRIT_CHANGE_ID=${GERRIT_CHANGE_ID}` : false),
(GERRIT_PROJECT ? `GERRIT_PROJECT=${GERRIT_PROJECT}` : false),
(GERRIT_BRANCH ? `GERRIT_BRANCH=${GERRIT_BRANCH}` : false)
].filter(Boolean)
)
}).status)
process.exit(
runCommandsConcurrently({
chromatic: getCommand('chromatic', chromaticArgs, [
`CHROMATIC_APP_CODE=${CHROMATIC_APP_CODE}`
])
}).status
)
2 changes: 1 addition & 1 deletion packages/ui-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"optionalDependencies": {
"@instructure/mocha-environment-jsdom": "^7.3.1",
"@storybook/react": "^4 || ^5",
"storybook-chromatic": "^2"
"chromatic": "^5"
},
"peerDependencies": {
"react": "^16.8",
Expand Down
66 changes: 0 additions & 66 deletions packages/ui-view/src/View/__examples__/View.examples.js

This file was deleted.

Loading