Skip to content

Commit 77974f2

Browse files
committed
chore: update node version and improve overall CI
Signed-off-by: Avi Miller <[email protected]>
1 parent 00c1fd1 commit 77974f2

27 files changed

+4630
-533
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/
2+
node_modules/

.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto eol=lf
2+
3+
dist/** -diff linguist-generated=true

.github/linters/.eslintrc.yml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
env:
2+
node: true
3+
es6: true
4+
5+
globals:
6+
Atomics: readonly
7+
SharedArrayBuffer: readonly
8+
9+
ignorePatterns:
10+
- '!.*'
11+
- '**/node_modules/.*'
12+
- '**/dist/.*'
13+
- '*.json'
14+
15+
parser: '@typescript-eslint/parser'
16+
17+
parserOptions:
18+
ecmaVersion: 2023
19+
sourceType: module
20+
project:
21+
- './.github/linters/tsconfig.json'
22+
- './tsconfig.json'
23+
24+
plugins:
25+
- '@typescript-eslint'
26+
- eslint-plugin-prettier
27+
28+
extends:
29+
- eslint:recommended
30+
- plugin:@typescript-eslint/eslint-recommended
31+
- plugin:@typescript-eslint/recommended
32+
- plugin:eslint-plugin-prettier/recommended
33+
34+
rules:
35+
{
36+
'camelcase': 'off',
37+
'eslint-comments/no-use': 'off',
38+
'eslint-comments/no-unused-disable': 'off',
39+
'i18n-text/no-en': 'off',
40+
'import/no-namespace': 'off',
41+
'no-console': 'off',
42+
'no-unused-vars': 'off',
43+
'prettier/prettier': 'error',
44+
'semi': 'off',
45+
'@typescript-eslint/array-type': 'error',
46+
'@typescript-eslint/await-thenable': 'error',
47+
'@typescript-eslint/ban-ts-comment': 'error',
48+
'@typescript-eslint/consistent-type-assertions': 'error',
49+
'@typescript-eslint/explicit-member-accessibility': ['error', { 'accessibility': 'no-public' }],
50+
'@typescript-eslint/explicit-function-return-type': ['error', { 'allowExpressions': true }],
51+
'@typescript-eslint/func-call-spacing': ['error', 'never'],
52+
'@typescript-eslint/no-array-constructor': 'error',
53+
'@typescript-eslint/no-empty-interface': 'error',
54+
'@typescript-eslint/no-explicit-any': 'error',
55+
'@typescript-eslint/no-extraneous-class': 'error',
56+
'@typescript-eslint/no-for-in-array': 'error',
57+
'@typescript-eslint/no-inferrable-types': 'error',
58+
'@typescript-eslint/no-misused-new': 'error',
59+
'@typescript-eslint/no-namespace': 'error',
60+
'@typescript-eslint/no-non-null-assertion': 'warn',
61+
'@typescript-eslint/no-require-imports': 'error',
62+
'@typescript-eslint/no-unnecessary-qualifier': 'error',
63+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
64+
'@typescript-eslint/no-unused-vars': 'error',
65+
'@typescript-eslint/no-useless-constructor': 'error',
66+
'@typescript-eslint/no-var-requires': 'error',
67+
'@typescript-eslint/prefer-for-of': 'warn',
68+
'@typescript-eslint/prefer-function-type': 'warn',
69+
'@typescript-eslint/prefer-includes': 'error',
70+
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
71+
'@typescript-eslint/promise-function-async': 'error',
72+
'@typescript-eslint/require-array-sort-compare': 'error',
73+
'@typescript-eslint/restrict-plus-operands': 'error',
74+
'@typescript-eslint/semi': ['error', 'never'],
75+
'@typescript-eslint/space-before-function-paren': 'off',
76+
'@typescript-eslint/type-annotation-spacing': 'error',
77+
'@typescript-eslint/unbound-method': 'error'
78+
}

.github/linters/.markdown-lint.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Unordered list style
2+
MD004:
3+
style: dash
4+
5+
MD013:
6+
line_length: 120
7+
ignore_code_blocks: true
8+
9+
# Ordered list item prefix
10+
MD029:
11+
style: one
12+
13+
# Spaces after list markers
14+
MD030:
15+
ul_single: 1
16+
ol_single: 1
17+
ul_multi: 1
18+
ol_multi: 1
19+
20+
# Code block style
21+
MD046:
22+
style: fenced

.github/linters/.yaml-lint.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
rules:
2+
document-end: disable
3+
document-start:
4+
level: warning
5+
present: false
6+
line-length:
7+
level: warning
8+
max: 120
9+
allow-non-breakable-words: true
10+
allow-non-breakable-inline-mappings: true

.github/linters/tsconfig.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"extends": "../../tsconfig.json",
4+
"compilerOptions": {
5+
"noEmit": true
6+
},
7+
"include": ["../../src/**/*"],
8+
"exclude": ["../../dist", "../../node_modules", "*.json"]
9+
}

.github/workflows/check-dist.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Check Transpiled JavaScript
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
check-dist:
16+
name: Check dist/
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
id: checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js
25+
id: setup-node
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version-file: .node-version
29+
cache: npm
30+
31+
- name: Install Dependencies
32+
id: install
33+
run: npm ci
34+
35+
- name: Build dist/ Directory
36+
id: build
37+
run: npm run bundle
38+
39+
# This will fail the workflow if the `dist/` directory is different than
40+
# expected.
41+
- name: Compare Directories
42+
id: diff
43+
run: |
44+
if [ ! -d dist/ ]; then
45+
echo "Expected dist/ directory does not exist. See status below:"
46+
ls -la ./
47+
exit 1
48+
fi
49+
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
50+
echo "Detected uncommitted changes after build. See status below:"
51+
git diff --ignore-space-at-eol --text dist/
52+
exit 1
53+
fi
54+
55+
# If `dist/` was different than expected, upload the expected version as a
56+
# workflow artifact.
57+
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
58+
name: Upload Artifact
59+
id: upload
60+
uses: actions/upload-artifact@v4
61+
with:
62+
name: dist
63+
path: dist/

.github/workflows/ci.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Continuous Integration
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
test-typescript:
16+
name: TypeScript Tests
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
id: checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Node.js
25+
id: setup-node
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version-file: .node-version
29+
cache: npm
30+
31+
- name: Install Dependencies
32+
id: npm-ci
33+
run: npm ci
34+
35+
- name: Check Format
36+
id: npm-format-check
37+
run: npm run format:check
38+
39+
- name: Lint
40+
id: npm-lint
41+
run: npm run lint
42+
43+
test-action:
44+
name: OCI CLI GitHub Action Test
45+
runs-on: ubuntu-latest
46+
env:
47+
OCI_CLI_USER: ${{ secrets.OCI_CLI_USER }}
48+
OCI_CLI_TENANCY: ${{ secrets.OCI_CLI_TENANCY }}
49+
OCI_CLI_FINGERPRINT: ${{ secrets.OCI_CLI_FINGERPRINT }}
50+
OCI_CLI_KEY_CONTENT: ${{ secrets.OCI_CLI_KEY_CONTENT }}
51+
OCI_CLI_REGION: ${{ secrets.OCI_CLI_REGION }}
52+
53+
steps:
54+
- name: Checkout
55+
id: checkout
56+
uses: actions/checkout@v4
57+
58+
- name: Get OCI region key
59+
id: test-action-get-oci-region-key
60+
uses: ./
61+
with:
62+
command: iam region list
63+
query: "data[?name=='${{ secrets.OCI_CLI_REGION }}'].key"
64+
65+
- name: Output OCI region key
66+
id: output-oci-region-key
67+
run: echo "${{ steps.test-action-get-oci-region-key.outputs.output }}"

.github/workflows/linter.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Lint Codebase
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: read
13+
packages: read
14+
statuses: write
15+
16+
jobs:
17+
lint:
18+
name: Lint Codebase
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
id: checkout
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Setup Node.js
29+
id: setup-node
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version-file: .node-version
33+
cache: npm
34+
35+
- name: Install Dependencies
36+
id: install
37+
run: npm ci
38+
39+
- name: Lint Codebase
40+
id: super-linter
41+
uses: github/super-linter/slim@v6
42+
env:
43+
DEFAULT_BRANCH: main
44+
FILTER_REGEX_EXCLUDE: dist/**/*
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
TYPESCRIPT_DEFAULT_STYLE: prettier
47+
VALIDATE_ALL_CODEBASE: true
48+
VALIDATE_JAVASCRIPT_STANDARD: false
49+
VALIDATE_JSCPD: false

.github/workflows/test-run-oci-cli-command.yaml

-37
This file was deleted.

.node-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.6.0

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/
2+
node_modules/

.prettierrc.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"printWidth": 120,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": false,
6+
"singleQuote": true,
7+
"quoteProps": "as-needed",
8+
"jsxSingleQuote": false,
9+
"trailingComma": "none",
10+
"bracketSpacing": true,
11+
"bracketSameLine": true,
12+
"arrowParens": "avoid",
13+
"proseWrap": "always",
14+
"htmlWhitespaceSensitivity": "css",
15+
"endOfLine": "lf"
16+
}

0 commit comments

Comments
 (0)