diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..d1f0a3ae0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,31 @@ +** PLEASE READ THIS BEFORE FILING AN ISSUE ** + +**I'm submitting a:** + +- [ ] bug report +- [ ] feature request + +**What OS are you using?** + + +**What browser(s) is this bug affecting:** + + +**Current behavior:** + + +**Expected behavior:** + + +**Steps to reproduce:** + + +**Related code:** + +```js +// insert any relevant code here or add a include a codepen +``` + +**Other information:** + diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..9baa6eb6c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,32 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: 'Focus Area: Components, Type: Bug' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Browser Version (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..22c0379fc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: 'Focus Area: Components, Type: Feature' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/new-task-template.md b/.github/ISSUE_TEMPLATE/new-task-template.md new file mode 100644 index 000000000..176994181 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/new-task-template.md @@ -0,0 +1,22 @@ +--- +name: New Task Template +about: Use this template when you are creating a new task +title: '' +labels: 'Focus Area: Components, Type: Feature' +assignees: '' + +--- + +## Description + + +## Acceptance criteria + diff --git a/.github/workflows/auto-format.yml b/.github/workflows/auto-format.yml new file mode 100644 index 000000000..a72e0140e --- /dev/null +++ b/.github/workflows/auto-format.yml @@ -0,0 +1,42 @@ +name: auto-format + +on: + push: + branches: master + +jobs: + format: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: 10 + + - name: NPM install + # Don't run postinstall because we don't need to install sub-packages. + run: npm ci --ignore-scripts + + - name: Format + run: npm run format + + - name: Check if format produces git diff + id: ifChange + run: git diff --exit-code || echo "::set-output name=changed::yes" + + - name: Create PR + if: steps.ifChange.outputs.changed == 'yes' + uses: peter-evans/create-pull-request@v1.7.3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: Auto-format + # TODO Find or make an account that is whitelisted to not trigger the CLA check. + author-email: format-bot@polymer-project.org + author-name: Polymer GitHub Actions Robot + title: Auto-format master branch + body: This PR was auto generated by the auto-format GitHub action. + reviewers: aomarks,azakus,e111077,asyncliz + branch: auto-format-action + branch-suffix: none + labels: "Ready for Google" diff --git a/.github/workflows/bump-mdc-deps.yml b/.github/workflows/bump-mdc-deps.yml new file mode 100644 index 000000000..97be38828 --- /dev/null +++ b/.github/workflows/bump-mdc-deps.yml @@ -0,0 +1,45 @@ +name: bump-mdc-deps + +on: + schedule: + # Run every 3 hours. + - cron: '0 */3 * * *' + +jobs: + bump: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: 10 + + - name: NPM install + # Don't run postinstall because we don't need to install sub-packages. + run: npm ci --ignore-scripts + + - name: Build scripts + run: npm run build:scripts + + - name: Bump MDC deps + id: bump + # Note this script sets the "new-mdc-version" GitHub Action output. + run: npm run bump-all-mdc-web-deps + + - name: Create PR + if: steps.bump.outputs.new-mdc-version != '' + # TODO Avoid this third-party action if possible. Can we install and use + # https://github.com/github/hub instead? + uses: peter-evans/create-pull-request@v1.5.2 + env: + GITHUB_TOKEN: ${{ secrets.TEDIUM_BOT_GITHUB_ACCESS_TOKEN }} + COMMIT_MESSAGE: Auto bump MDC Web deps to ${{ steps.bump.outputs.new-mdc-version }} + # TODO Find or make an account that is whitelisted to not trigger the# CLA check. + COMMIT_AUTHOR_EMAIL: format-bot@polymer-project.org + COMMIT_AUTHOR_NAME: Polymer GitHub Actions Robot + PULL_REQUEST_TITLE: Auto bump MDC Web deps to ${{ steps.bump.outputs.new-mdc-version }} + PULL_REQUEST_BODY: This PR was auto generated by the bump-mdc-deps GitHub action. + PULL_REQUEST_REVIEWERS: aomarks,azakus,e111077,asyncliz + PULL_REQUEST_BRANCH: auto-bump-mdc-deps-${{ steps.bump.outputs.new-mdc-version }} + BRANCH_SUFFIX: none diff --git a/.github/workflows/release-canary.yml b/.github/workflows/release-canary.yml new file mode 100644 index 000000000..40707056f --- /dev/null +++ b/.github/workflows/release-canary.yml @@ -0,0 +1,46 @@ +name: MWC Release (Canary) + +# This workflow creates a pre-release and publishes packages to NPM with canary +# tag on every commit to master. + +on: + push: + branches: + - master + paths: + - 'packages/**/*.ts' + - 'packages/**/*.scss' + - '**/package*.json' + - '**/.npmignore' + - '**/tsconfig.json' + +jobs: + release-canary: + runs-on: ubuntu-latest + steps: + - name: Clone repository + uses: actions/checkout@v1.0.0 + - name: Checkout master branch + # GITHUB_REF:11 gets `refs/heads/master` => `master`. + # See https://github.com/actions/checkout/issues/6 + run: | + git checkout "${GITHUB_REF:11}" + git pull + - name: Setup node + uses: actions/setup-node@v1 + with: + node-version: 10 + registry-url: https://registry.npmjs.org/ + - name: Install dependencies + run: | + npm install + - name: Create canary release + run: | + npx lerna version preminor --no-git-tag-version --no-push --preid canary.$(git rev-parse --short HEAD) --yes --exact + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -am "chore: Publish" + - name: Publish to NPM registry with canary tag + run: npx lerna publish from-package --yes --dist-tag canary + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 000000000..942c0598d --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,54 @@ +name: tests + +on: [push, pull_request] + +jobs: + tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: 12 + + - name: NPM install + # ignore-scripts so that we skip postinstall, because postinstall runs + # bootstrap, and it's a little nicer to see that here as its own step + # when debugging. + run: npm ci --ignore-scripts + + - name: Lerna bootstrap + run: npm run bootstrap + + - name: Check format + run: npm run format:check + + - name: Build component Sass + run: npm run build:styling + + - name: Compile component TypeScript + run: npm run build:typescript + + # TODO(aomarks) Once b/144957560 is fixed, move lint and format into their + # own workflows or jobs so that they can run in parallel. + - name: Check lint + run: npm run lint + + - name: Compile test TypeScript + run: npm run build:tests + + - name: Unit tests + env: + SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} + SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} + run: | + # Don't run Sauce from a forked repo, since the code may not be trusted + # and therefore secrets like the Sauce password are not available. + # GITHUB_HEAD_REF is only defined when building a fork. + if [ ! "$GITHUB_HEAD_REF" ]; then + export USE_SAUCE=true + export SAUCE_BUILD_ID=mwc-tests-${GITHUB_EVENT_NAME}-${GITHUB_ACTION}-${GITHUB_SHA} + export SAUCE_TUNNEL_ID=${SAUCE_BUILD_ID}-tunnel + fi + npm test diff --git a/packages/list/src/mwc-check-list-item-base.ts b/packages/list/src/mwc-check-list-item-base.ts index 6307d4652..b36b9145a 100644 --- a/packages/list/src/mwc-check-list-item-base.ts +++ b/packages/list/src/mwc-check-list-item-base.ts @@ -21,7 +21,7 @@ import {Checkbox} from '@material/mwc-checkbox'; import {html, property, query} from 'lit-element'; import {classMap} from 'lit-html/directives/class-map.js'; -import {GraphicType, ListItemBase} from './mwc-list-item-base-master.js'; +import {GraphicType, ListItemBase} from './mwc-list-item-base.js'; export class CheckListItemBase extends ListItemBase { @query('slot') protected slotElement!: HTMLSlotElement|null; diff --git a/packages/list/src/mwc-list-base.ts b/packages/list/src/mwc-list-base.ts index e121abdc0..38236ec8c 100644 --- a/packages/list/src/mwc-list-base.ts +++ b/packages/list/src/mwc-list-base.ts @@ -24,7 +24,7 @@ import {ifDefined} from 'lit-html/directives/if-defined.js'; import {MDCListAdapter} from './mwc-list-adapter.js'; import MDCListFoundation, {ActionDetail, isIndexSet, SelectedDetail} from './mwc-list-foundation.js'; import {MWCListIndex} from './mwc-list-foundation.js'; -import {ListItemBase, RequestSelectedDetail} from './mwc-list-item-base-master.js'; +import {ListItemBase, RequestSelectedDetail} from './mwc-list-item-base.js'; export {createSetFromIndex, isEventMulti, isIndexSet, MWCListIndex} from './mwc-list-foundation.js'; diff --git a/packages/list/src/mwc-list-item-master.ts b/packages/list/src/mwc-list-item-master.ts deleted file mode 100644 index ca80a256e..000000000 --- a/packages/list/src/mwc-list-item-master.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** -@license -Copyright 2020 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import {customElement} from 'lit-element'; - -import {ListItemBase} from './mwc-list-item-base-master.js'; -import {style} from './mwc-list-item-css.js'; - -export {GraphicType, RequestSelectedDetail} from './mwc-list-item-base-master.js'; -declare global { - interface HTMLElementTagNameMap { - 'mwc-list-item': ListItem; - } -} - -@customElement('mwc-list-item') -export class ListItem extends ListItemBase { - static styles = style; -} diff --git a/packages/list/src/mwc-radio-list-item-base.ts b/packages/list/src/mwc-radio-list-item-base.ts index 36e4b7668..d0c157b2d 100644 --- a/packages/list/src/mwc-radio-list-item-base.ts +++ b/packages/list/src/mwc-radio-list-item-base.ts @@ -22,7 +22,7 @@ import {html, property, query} from 'lit-element'; import {classMap} from 'lit-html/directives/class-map.js'; import {ifDefined} from 'lit-html/directives/if-defined.js'; -import {GraphicType, ListItemBase} from './mwc-list-item-base-master.js'; +import {GraphicType, ListItemBase} from './mwc-list-item-base.js'; export class RadioListItemBase extends ListItemBase { @query('slot') protected slotElement!: HTMLSlotElement|null;