diff --git a/.eslintrc.json b/.eslintrc.json index aa3e1a1d..fbda63ef 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,15 +19,10 @@ "plugins": ["@typescript-eslint"], "extends": ["plugin:@typescript-eslint/recommended"], "rules": { - "@typescript-eslint/no-unused-vars": 0, - "@typescript-eslint/no-explicit-any": 0, "@typescript-eslint/ban-ts-comment": 0, - "@typescript-eslint/ban-types": [ - 1, - { "extendDefaults": true, "types": { "Function": false } } - ], - "@typescript-eslint/no-empty-function": 0, - "@typescript-eslint/member-ordering": 0, + "@typescript-eslint/ban-types": 1, + "@typescript-eslint/no-empty-function": 1, + "@typescript-eslint/member-ordering": 1, "@typescript-eslint/explicit-member-accessibility": [ 1, { diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 509a2b38..b2ed4727 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -12,14 +12,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -## Runs CodeQL analysis for all PRs, merges into main and daily. - +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# name: "CodeQL" on: push: branches: [main] pull_request: + # The branches below must be a subset of the branches above branches: [main] schedule: - cron: "0 13 * * *" @@ -33,15 +43,43 @@ jobs: contents: read security-events: write + strategy: + fail-fast: false + matrix: + language: ["javascript"] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v2 - # Initializes the CodeQL tools for scanning and analyze + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v1 with: - languages: javascript-typescript + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 2cd852f8..a2711211 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -## Automatically approves and merges dependabot PRs if tests pass. - name: Dependabot on: pull_request @@ -23,18 +21,15 @@ permissions: jobs: test: uses: ./.github/workflows/test.yml - dependabot: needs: test - if: ${{ github.actor == 'dependabot[bot]' }} - runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' }} env: PR_URL: ${{github.event.pull_request.html_url}} GITHUB_TOKEN: ${{secrets.SYNCED_GITHUB_TOKEN_REPO}} steps: - - name: Approve + - name: approve run: gh pr review --approve "$PR_URL" - - - name: Merge + - name: merge run: gh pr merge --auto --squash --delete-branch "$PR_URL" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2b230917..dbf4f994 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -12,35 +12,27 @@ # See the License for the specific language governing permissions and # limitations under the License. -## Builds the documentation website and deploys it to the gh-pages -## branch for pushes to the main branch. - name: Docs on: [push, pull_request] jobs: test: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Node - uses: actions/setup-node@v3 + - uses: actions/checkout@v2 + - uses: actions/cache@v2 with: - node-version: 20 - cache: npm - - - name: Build Documentation - run: | - npm ci + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - run: | + npm i npm run docs - - - if: github.ref == 'refs/heads/main' - name: Deploy to gh-pages Branch - uses: peaceiris/actions-gh-pages@v3 + - uses: peaceiris/actions-gh-pages@v3 + if: github.ref == 'refs/heads/main' with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./docs - user_name: "googlemaps-bot" - user_email: "googlemaps-bot@users.noreply.github.com" + user_name: 'googlemaps-bot' + user_email: 'googlemaps-bot@users.noreply.github.com' commit_message: ${{ github.event.head_commit.message }} diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 00000000..c5cd396c --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,30 @@ +# Copyright 2021 Google LLC +# +# 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. + +name: Package +on: + - push + - pull_request +jobs: + package: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: npm i + - uses: jpoehnelt/verify-npm-files-action@main + with: + keys: | + types + main + module diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..9228f0a2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,57 @@ +# Copyright 2021 Google LLC +# +# 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. + +name: Release +on: + push: + branches: + - main +concurrency: release +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v2 + with: + node-version: '14' + - name: Checkout + uses: actions/checkout@v3 + with: + token: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }} + - uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Test + run: | + npm i + npm run lint + npm test + - name: Release + uses: cycjimmy/semantic-release-action@v3 + with: + extra_plugins: | + @semantic-release/commit-analyzer + semantic-release-interval + @semantic-release/release-notes-generator + @semantic-release/git + @semantic-release/github + @semantic-release/npm + @googlemaps/semantic-release-config + semantic-release-npm-deprecate + env: + GH_TOKEN: ${{ secrets.SYNCED_GITHUB_TOKEN_REPO }} + NPM_TOKEN: ${{ secrets.NPM_WOMBAT_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6dddee03..59e546c2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,31 +12,20 @@ # See the License for the specific language governing permissions and # limitations under the License. -## Runs the eslint and jest unit tests for every PR and push. - name: Test on: [push, pull_request, workflow_call] jobs: test: runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Node - uses: actions/setup-node@v3 + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 with: - node-version: 20 - cache: npm - - - name: Install Dependencies - run: npm ci - - - name: Run eslint - run: npm run lint - - - name: Run Unit Tests - run: npm test - - - name: Run codecov Analysis - uses: codecov/codecov-action@v1 + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - run: npm i + - run: npm run lint + - run: npm test + - uses: codecov/codecov-action@v1