Skip to content
Merged
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
31 changes: 31 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2022 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.
*/

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
rules: {
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
}
};
24 changes: 24 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
commit-message:
prefix: "chore(deps): "
rebase-strategy: "disabled"
schedule:
interval: "daily"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-patch", "version-update:semver-minor"] # Security updates are unaffected by this setting

- package-ecosystem: "npm"
directory: "/example-app"
commit-message:
prefix: "chore(deps): "
schedule:
interval: "monthly"
33 changes: 33 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright 2022 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: 'label'

on: 'pull_request_target'

jobs:
apply-label:
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/github-script@v3'
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
script: |-
github.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['Fork']
})
106 changes: 106 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Copyright 2022 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'
workflow_dispatch:

jobs:
# build compiles the code and creates a pull request of the compiled result if
# there is a diff.
build:
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v3'

- uses: 'actions/setup-node@v3'
with:
node-version: '16.x'

- name: 'npm build'
run: 'npm ci && npm run build'

- name: 'Create pull request'
uses: 'peter-evans/create-pull-request@dcd5fd746d53dd8de555c0f10bca6c35628be47a'
with:
token: '${{ secrets.ACTIONS_BOT_TOKEN }}'
add-paths: 'dist/'
committer: 'google-github-actions-bot <github-actions-bot@google.com>'
author: 'google-github-actions-bot <github-actions-bot@google.com>'
signoff: 'google-github-actions-bot <github-actions-bot@google.com>'
commit-message: 'Build dist'
title: 'chore: build dist'
body: 'Build compiled Typescript'
base: 'main'
branch: 'actions/build'
push-to-fork: 'google-github-actions-bot/ssh-compute'
delete-branch: true

# create-pull-request creates a release pull request if there are any
# convential commit changes since the last release.
create-pull-request:
runs-on: 'ubuntu-latest'
steps:
- uses: 'google-github-actions/release-please-action@v2'
with:
token: '${{ secrets.ACTIONS_BOT_TOKEN }}'
release-type: 'node'
bump-minor-pre-major: true
command: 'release-pr'
fork: true

# release does a release on the merge of the release pull request. It also
# updates the floating tag alias for the major version.
release:
runs-on: 'ubuntu-latest'
steps:
- id: 'release'
uses: 'google-github-actions/release-please-action@v2'
with:
release-type: 'node'
bump-minor-pre-major: true
command: 'github-release'

- name: 'Update floating tag'
if: '${{ steps.release.outputs.release_created }}'
uses: 'actions/github-script@v5'
with:
script: |-
const sha = '${{ steps.release.outputs.sha }}'
const major = 'v${{ steps.release.outputs.major }}';
// Try to update the ref first. If that fails, it probably does not
// exist yet, and we should create it.
try {
await github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `tags/${major}`,
sha: sha,
force: true,
});
core.info(`Updated ${major} to ${sha}`);
} catch(err) {
core.warning(`Failed to create ${major}: ${err}`);
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${major}`,
sha: sha,
});
core.info(`Created ${major} at ${sha}`);
}
58 changes: 58 additions & 0 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright 2022 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: 'unit'

on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
workflow_dispatch:

concurrency:
group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
run:
name: 'unit'
runs-on: '${{ matrix.os }}'
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-latest'
- 'windows-latest'
- 'macos-latest'
steps:
- uses: 'actions/checkout@v3'

- uses: 'actions/setup-node@v3'
with:
node-version: '16.x'

- name: 'npm build'
run: 'npm ci && npm run build'

- name: 'npm lint'
# There's no need to run the linter for each operating system, since it
# will find the same thing 3x and clog up the PR review.
if: ${{matrix.os == 'ubuntu-latest'}}
run: 'npm run lint'

- name: 'npm test'
run: npm run test
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
node_modules/
runner/

# Rest of the file pulled from https://github.com/github/gitignore/blob/main/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz
29 changes: 29 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2022 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.
*/

module.exports = {
arrowParens: 'always',
bracketSpacing: true,
endOfLine: 'auto',
jsxSingleQuote: true,
printWidth: 100,
quoteProps: 'consistent',
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
useTabs: false,
};
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @google-github-actions/maintainers
Loading