Skip to content

Commit

Permalink
bug: update to fix windows failing ci validation (microsoft#4217)
Browse files Browse the repository at this point in the history
# Description
  Cross Platform Validation
<!--- Describe your changes. -->
    Changed made to
   1. modified prettier:diff to prettier check and write in the package.json file
       added run prepare workspace.
   2. ON windows we have added this script to resolve the line ending
        run: |
          git config --global core.autocrlf false
          git config --global core.eol lf
          we have also specify the shell script as bash cmd in the workflow so the string can be treated as in Linux
          shel: bash
   3. dangerouslySetInnerHTML={{ __html: FooterTemplate }}  get replaced by 
       dangerouslySetInnerHTML={{ __html: FooterTemplate() }} to resolve a units test that was failing.
       changed made in sites/fast-color-explorer/app/site-footer.tsx
## Motivation & context

<!--- What problem does this change solve? -->
This fix os validation on windows and mac
closes microsoft#4058 
<!--- Provide a link if you are addressing an open issue. -->

## Issue type checklist

<!--- What type of change are you submitting? Put an x in the box that applies: -->

- [ ] **Chore**: A change that does not impact distributed packages.
- [x] **Bug**: A change that fixes an issue, link to the issue above.
- [ ] **New feature**: A change that adds functionality.

**Is this a breaking change?**
- [ ] This change causes current functionality to break.

<!--- If yes, describe the impact. -->

**Adding or modifying component(s) in `@microsoft/fast-components` checklist**

<!-- Do your changes add or modify components in the @microsoft/fast-components package? Put an x in the box that applies: -->

- [ ] I have added a new component
- [ ] I have modified an existing component
- [ ] I have updated the [definition file](https://github.com/Microsoft/fast/blob/master/packages/web-components/fast-components/CONTRIBUTING.md#definition)
- [ ] I have updated the [configuration file](https://github.com/Microsoft/fast/blob/master/packages/web-components/fast-components/CONTRIBUTING.md#configuration)

## Process & policy checklist

<!--- Review the list and check the boxes that apply. -->

- [x] I have added tests for my changes.
- [x] I have tested my changes.
- [x] I have updated the project documentation to reflect my changes.
- [x] I have read the [CONTRIBUTING](https://github.com/Microsoft/fast/blob/master/CONTRIBUTING.md) documentation and followed the [standards](https://www.fast.design/docs/community/code-of-conduct/#our-standards) for this project.

<!---
Formatting guidelines:

Accepted peer review title format:
<type>: <description>

Example titles:
    chore: add unit tests for all components
    feat: add a border radius to button
    fix: update design system to use 3px border radius

    <type> is required to be one of the following:

        - chore: A change that does not impact distributed packages.
        - fix: A change which fixes an issue.
        - feat: A that adds functionality.

    <description> is required for the CHANGELOG and speaks to what the user gets from this PR:

        - Be concise.
        - Use all lowercase characters. 
        - Use imperative, present tense (e.g. `add` not `adds`.)
        - Do not end your description with a period.
        - Avoid redundant words.

For additional information regarding working on FAST, check out our documentation site:
https://www.fast.design/docs/community/contributor-guide
-->

Co-authored-by: Ibrahimmaga <ibrahim.maga@yahoo.fr>
Co-authored-by: John Kreitlow <john.kreitlow@microsoft.com>
Co-authored-by: John Kreitlow <863023+radium-v@users.noreply.github.com>
  • Loading branch information
4 people authored Jan 15, 2021
1 parent 554760e commit 057582a
Show file tree
Hide file tree
Showing 11 changed files with 184 additions and 251 deletions.
181 changes: 138 additions & 43 deletions .github/workflows/ci-weekly.yml
Original file line number Diff line number Diff line change
@@ -1,75 +1,170 @@
name: CI - FAST Validation

on:
push:
braches:
- master
- releases/*
- features/*
schedule:
- cron: 0 7 * * 3



jobs:
build_windows:
name: Validate on Windows
runs-on: windows-latest
env:
GITHUB_SERVICE_PAT: ${{sercrets.GH_PAT}}
build_linux:
runs-on: [ubuntu-latest]

steps:
- uses: actions/checkout@v2

- name: Setup Node.js environment
uses: actions/setup-node@v2.1.0
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo '::set-output name=dir::$(yarn cache dir)'

- name: Set up node_modules cache
uses: actions/cache@v1.1.2
id: yarn-cache
with:
node-version: '10'
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Lerna
run: npm i -g lerna
- name: Install package dependencies
run: yarn install --frozen-lockfile --ignore-scripts

- name: Install package dependencies / prepare workspaces
run: |
yarn install --frozen-lockfile
- name: Prepare workspaces
run: yarn prepare

- name: Ensure Prettier formatting
run: lerna run prettier:diff
- name: Testing Prettier format
run: yarn format:check

- name: Execute unit tests
run: lerna run test --stream
- name: Testing unit tests
run: yarn lerna run test --stream


build_macos:
name: Validate on MacOS

runs-on: macos-latest
- name: Collect and upload code coverage to Code Climate
uses: paambaati/codeclimate-action@v2.6.0

env:
CC_TEST_REPORTER_ID: 08a773cb4ea5811add5a45e12873e5cd2634c005568705cc37abfd5217617a32
with:
coverageCommand: yarn lerna run coverage
coverageLocations: |
${{github.workspace}}/packages/tooling/fast-tooling/coverage/lcov.info:lcov
${{github.workspace}}/packages/tooling/fast-tooling-react/coverage/lcov.info:lcov
${{github.workspace}}/packages/tooling/fast-tooling-wasm/coverage/lcov.info:lcov
${{github.workspace}}/packages/tooling/fast-figma-plugin-msft/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-animation/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-colors/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-web-utilities/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-eslint-rules/coverage/lcov.info:lcov
${{github.workspace}}/sites/fast-component-explorer/coverage/lcov.info:lcov
debug: false

build-windows:
runs-on: [windows-latest]

steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v2

- name: Setup Node.js environment
uses: actions/setup-node@v2.1.0
- name: Display the path
run: echo $PATH
shell: bash

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

- name: Set up node_modules cache
uses: actions/cache@v1.1.2
id: yarn-cache
with:
node-version: '10'
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Lerna
run: sudo yarn global add lerna
- name: Install package dependencies
run: yarn install --frozen-lockfile --ignore-scripts

- name: Install package dependencies / prepare workspaces
run: yarn install --frozen-lockfile
- name: Prepare workspaces
run: yarn prepare

- name: Ensure Prettier formatting
run: lerna run prettier:diff
- name: Testing Prettier format
run: yarn format:check

- name: Execute unit tests
run: lerna run test --stream
- name: Testing unit tests
run: yarn lerna run test --stream

code_scan:
name: Validate Security
- name: Collect and upload code coverage to Code Climate
uses: paambaati/codeclimate-action@v2.6.0

runs-on: ubuntu-latest
env:
CC_TEST_REPORTER_ID: 08a773cb4ea5811add5a45e12873e5cd2634c005568705cc37abfd5217617a32
with:
coverageCommand: yarn lerna run coverage
coverageLocations: |
${{github.workspace}}/packages/tooling/fast-tooling/coverage/lcov.info:lcov
${{github.workspace}}/packages/tooling/fast-tooling-react/coverage/lcov.info:lcov
${{github.workspace}}/packages/tooling/fast-tooling-wasm/coverage/lcov.info:lcov
${{github.workspace}}/packages/tooling/fast-figma-plugin-msft/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-animation/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-colors/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-web-utilities/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-eslint-rules/coverage/lcov.info:lcov
${{github.workspace}}/sites/fast-component-explorer/coverage/lcov.info:lcov
debug: false

build-macos:
runs-on: [macos-latest]

steps:
- uses: actions/checkout@v2

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo '::set-output name=dir::$(yarn cache dir)'

- name: Set up node_modules cache
uses: actions/cache@v1.1.2
id: yarn-cache
with:
languages: javascript
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install package dependencies
run: yarn install --frozen-lockfile --ignore-scripts

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Prepare workspaces
run: yarn prepare

- name: Testing Prettier format
run: yarn format:check

- name: Testing unit tests
run: yarn lerna run test --stream

- name: Collect and upload code coverage to Code Climate
uses: paambaati/codeclimate-action@v2.6.0

env:
CC_TEST_REPORTER_ID: 08a773cb4ea5811add5a45e12873e5cd2634c005568705cc37abfd5217617a32
with:
coverageCommand: yarn lerna run coverage
coverageLocations: |
${{github.workspace}}/packages/tooling/fast-tooling/coverage/lcov.info:lcov
${{github.workspace}}/packages/tooling/fast-tooling-react/coverage/lcov.info:lcov
${{github.workspace}}/packages/tooling/fast-tooling-wasm/coverage/lcov.info:lcov
${{github.workspace}}/packages/tooling/fast-figma-plugin-msft/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-animation/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-colors/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-web-utilities/coverage/lcov.info:lcov
${{github.workspace}}/packages/utilities/fast-eslint-rules/coverage/lcov.info:lcov
${{github.workspace}}/sites/fast-component-explorer/coverage/lcov.info:lcov
debug: false
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,5 @@ docs/en/packages/*/api/

# Ignore Build Artefacts
bin/
obj/
obj/

12 changes: 10 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
packages/web-components/fast-components/src/default-palette.ts
packages/web-components/fast-element/src/**/*.spec.ts
*.spec.ts
**/__test-images__
**/__tests__
**/.tmp
**/bootstrap
**/coverage
**/dist
**/temp
default-palette.ts
testData.ts
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "avoid",
"htmlWhitespaceSensitivity": "ignore"
"htmlWhitespaceSensitivity": "ignore",
"endOfLine": "auto"
}
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@
"integration-tests:beta": "node build/testing/sauce-labs/test-browsers.js beta",
"integration-tests:release": "node build/testing/sauce-labs/test-browsers.js release",
"prepare": "lerna run prepare",
"test": "yarn eslint && yarn unit-tests",
"test": "yarn eslint \"/**/*.{ts}\"",
"unit-tests": "jest --maxWorkers=4",
"unit-tests:watch": "jest --watch",
"watch": "tsc -p ./tsconfig.json -w --preserveWatchOutput"
"watch": "tsc -p ./tsconfig.json -w --preserveWatchOutput",
"format:check": "lerna run prettier:diff",
"format": "lerna run prettier"
},
"husky": {
"hooks": {
Expand Down Expand Up @@ -92,7 +94,7 @@
"build/helpers/__tests__/*",
"build/helpers/"
],
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(js?|ts?)$",
"testRegex": "/__tests__/.*\\.(test|spec)\\.(js|ts|tsx)$",
"moduleFileExtensions": [
"ts",
"js"
Expand Down
2 changes: 1 addition & 1 deletion sites/fast-color-explorer/app/site-footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class Footer extends React.Component<{}, {}> {
<fast-design-system-provider
class="site-wrapper"
use-defaults
dangerouslySetInnerHTML={{ __html: FooterTemplate }}
dangerouslySetInnerHTML={{ __html: FooterTemplate() }}
></fast-design-system-provider>
);
}
Expand Down
2 changes: 1 addition & 1 deletion sites/fast-component-explorer/app/site-footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class Footer extends React.Component<{}, {}> {
<fast-design-system-provider
class="site-wrapper"
use-defaults
dangerouslySetInnerHTML={{ __html: FooterTemplate }}
dangerouslySetInnerHTML={{ __html: FooterTemplate() }}
></fast-design-system-provider>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion sites/fast-creator/app/site-footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class Footer extends React.Component<{}, {}> {
<fast-design-system-provider
class="site-wrapper"
use-defaults
dangerouslySetInnerHTML={{ __html: FooterTemplate }}
dangerouslySetInnerHTML={{ __html: FooterTemplate() }}
></fast-design-system-provider>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion sites/fast-website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"prettier": "2.0.2",
"rollup": "^2.7.6",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-ejs": "^2.2.0",
"rollup-plugin-jst": "^1.2.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-svg": "^2.0.0",
"rollup-plugin-typescript2": "^0.27.1",
Expand Down
11 changes: 2 additions & 9 deletions sites/fast-website/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import alias from "@rollup/plugin-alias";
import path from "path";
import commonJS from "rollup-plugin-commonjs";
import ejs from "rollup-plugin-ejs";
import jst from "rollup-plugin-jst";
import resolve from "rollup-plugin-node-resolve";
import svg from "rollup-plugin-svg";
import typescript from "rollup-plugin-typescript2";
Expand All @@ -23,14 +23,7 @@ export default [
}),
resolve(),
commonJS(),
ejs({
render: {
data: null,
},
compilerOptions: {
client: true,
},
}),
jst(),
svg(),
typescript({
tsconfigOverride: {
Expand Down
Loading

0 comments on commit 057582a

Please sign in to comment.