Skip to content

Commit c5f37b9

Browse files
authoredApr 20, 2023
Rewrite internals for v2 release (#83)
Addresses #15, #35, #36, #47, #51, and #59
1 parent b992c2e commit c5f37b9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+9628
-12545
lines changed
 

‎.eslintrc.yml

+14-39
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ extends:
77
- "plugin:@typescript-eslint/strict"
88
- "plugin:import/recommended"
99
- "plugin:import/typescript"
10-
- "plugin:jsdoc/recommended-typescript"
10+
- "plugin:jsdoc/recommended-typescript-error"
1111
- "plugin:n/recommended"
1212
- "plugin:promise/recommended"
1313
- "plugin:sonarjs/recommended"
@@ -27,49 +27,24 @@ env:
2727
es2021: true
2828
node: true
2929

30+
rules:
31+
unicorn/prefer-top-level-await: "off"
32+
jsdoc/tag-lines: "off"
33+
3034
overrides:
3135
- files: ["**/*.js"]
3236
rules:
3337
"@typescript-eslint/no-var-requires": "off"
34-
"unicorn/prefer-module": "off"
38+
unicorn/prefer-module: "off"
3539

36-
- files: ["test/**/*"]
37-
env:
38-
mocha: true
40+
- files: ["**/__tests__/**/*"]
3941
rules:
42+
"@typescript-eslint/no-non-null-assertion": "off"
43+
"@typescript-eslint/no-unsafe-argument": "off"
44+
"@typescript-eslint/no-unsafe-assignment": "off"
4045
sonarjs/no-duplicate-string: "off"
46+
unicorn/no-useless-undefined: "off"
4147

42-
rules:
43-
n/no-unpublished-import: ["error", { "allowModules": ["@actions/core"] }]
44-
45-
# temporary rule overrides
46-
# TODO(mc, 2023-04-12): fix problems, remove overrides, and remove --quiet
47-
prefer-const: "warn"
48-
no-regex-spaces: "warn"
49-
"@typescript-eslint/no-floating-promises": "warn"
50-
"@typescript-eslint/no-unsafe-argument": "warn"
51-
"@typescript-eslint/no-unsafe-assignment": "warn"
52-
"@typescript-eslint/no-unsafe-call": "warn"
53-
"@typescript-eslint/no-unsafe-member-access": "warn"
54-
"@typescript-eslint/no-unsafe-return": "warn"
55-
"@typescript-eslint/require-await": "warn"
56-
"@typescript-eslint/restrict-plus-operands": "warn"
57-
"@typescript-eslint/restrict-template-expressions": "warn"
58-
"@typescript-eslint/unbound-method": "warn"
59-
n/no-missing-import: "warn"
60-
n/no-missing-require: "warn"
61-
n/no-process-exit: "warn"
62-
unicorn/better-regex: "warn"
63-
unicorn/catch-error-name: "warn"
64-
unicorn/import-style: "warn"
65-
unicorn/no-array-push-push: "warn"
66-
unicorn/no-process-exit: "warn"
67-
unicorn/no-useless-undefined: "warn"
68-
unicorn/prefer-export-from: "warn"
69-
unicorn/prefer-module: "warn"
70-
unicorn/prefer-node-protocol: "warn"
71-
unicorn/prefer-optional-catch-binding: "warn"
72-
unicorn/prefer-spread: "warn"
73-
unicorn/prefer-top-level-await: "warn"
74-
unicorn/prevent-abbreviations: "warn"
75-
unicorn/text-encoding-identifier-case: "warn"
48+
- files: ["src/action/**/*"]
49+
rules:
50+
n/no-unpublished-import: "off"

‎.github/workflows/ci-cd.yml

+33-37
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,8 @@ on:
1313
- cron: "25 12 * * 1"
1414

1515
jobs:
16-
lint:
17-
name: Lint
18-
runs-on: ubuntu-latest
19-
timeout-minutes: 10
20-
21-
steps:
22-
- name: Checkout source
23-
uses: actions/checkout@v3
24-
25-
- name: Install Node.js and dependencies
26-
uses: ./.github/actions/setup
27-
28-
- name: Run linters
29-
run: npm run lint
30-
3116
test:
32-
name: Run tests using Node ${{ matrix.node }} on ${{ matrix.os }}
17+
name: Unit tests / Node.js ${{ matrix.node-version }} / ${{ matrix.os }}
3318
runs-on: ${{ matrix.os }}
3419
timeout-minutes: 10
3520
strategy:
@@ -38,9 +23,8 @@ jobs:
3823
os:
3924
- ubuntu-latest
4025
- macos-latest
41-
# TODO(mc, 2023-04-07): investigate and fix coverage-related failures on Windows
42-
# - windows-latest
43-
node:
26+
- windows-latest
27+
node-version:
4428
- 16
4529
- 18
4630

@@ -51,10 +35,7 @@ jobs:
5135
- name: Install Node.js ${{ matrix.node }} and dependencies
5236
uses: ./.github/actions/setup
5337
with:
54-
node-version: ${{ matrix.node }}
55-
56-
- name: Build the code
57-
run: npm run build
38+
node-version: ${{ matrix.node-version }}
5839

5940
- name: Run tests
6041
run: npm run coverage
@@ -78,7 +59,7 @@ jobs:
7859
parallel-finished: true
7960

8061
build:
81-
name: Build
62+
name: Build and lint
8263
runs-on: ubuntu-latest
8364
timeout-minutes: 10
8465

@@ -92,18 +73,33 @@ jobs:
9273
- name: Build
9374
run: npm run build
9475

76+
- name: Verify no un-staged changes
77+
run: |
78+
git status --porcelain
79+
git diff-files --quiet
80+
81+
- name: Run lints
82+
run: npm run lint
83+
9584
- name: Upload publish artifact
9685
uses: actions/upload-artifact@v3
9786
with:
9887
name: publish-artifact
9988
path: lib
10089

10190
e2e:
102-
name: Run end-to-end tests
91+
name: E2E tests / Node.js ${{ matrix.node-version }}
10392
runs-on: ubuntu-latest
10493
timeout-minutes: 10
10594
needs: build
10695

96+
strategy:
97+
fail-fast: false
98+
matrix:
99+
node-version:
100+
- 16
101+
- 18
102+
107103
services:
108104
verdaccio:
109105
image: verdaccio/verdaccio:5
@@ -117,6 +113,7 @@ jobs:
117113
- name: Install Node.js and dependencies
118114
uses: ./.github/actions/setup
119115
with:
116+
node-version: ${{ matrix.node-version }}
120117
install-command: npm install --production
121118

122119
- name: Download publish artifact
@@ -130,20 +127,20 @@ jobs:
130127
shell: bash
131128
run: |
132129
echo "token=$(./e2e/00-login.sh)" >> "$GITHUB_OUTPUT"
133-
echo "package=$(./e2e/01-setup-package.sh ./e2e/fixture 0.0.1)" >> "$GITHUB_OUTPUT"
130+
echo "package=$(./e2e/01-setup-package.sh ./e2e/fixture/cool\ package 0.0.1)" >> "$GITHUB_OUTPUT"
134131
135132
- name: Run CLI end-to-end test
136133
shell: bash
137134
env:
138135
TOKEN: ${{ steps.setup.outputs.token }}
139136
PACKAGE: ${{ steps.setup.outputs.package }}
140137
run: |
141-
./e2e/02-publish.sh ${PACKAGE} ${TOKEN}
142-
./e2e/03-verify.sh ${PACKAGE}
143-
./e2e/02-publish.sh ${PACKAGE} ${TOKEN}
144-
./e2e/01-setup-package.sh ${PACKAGE} 0.0.2
145-
./e2e/02-publish.sh ${PACKAGE} ${TOKEN}
146-
./e2e/03-verify.sh ${PACKAGE}
138+
./e2e/02-publish.sh "${PACKAGE}" ${TOKEN}
139+
./e2e/03-verify.sh "${PACKAGE}"
140+
./e2e/02-publish.sh "${PACKAGE}" ${TOKEN}
141+
./e2e/01-setup-package.sh "${PACKAGE}" 0.0.2
142+
./e2e/02-publish.sh "${PACKAGE}" ${TOKEN}
143+
./e2e/03-verify.sh "${PACKAGE}"
147144
148145
- id: action-no-publish
149146
name: Publish with already published version
@@ -154,14 +151,14 @@ jobs:
154151
token: ${{ steps.setup.outputs.token }}
155152

156153
- name: Check action output
157-
if: ${{ steps.action-no-publish.outputs.type != 'none' }}
154+
if: ${{ steps.action-no-publish.outputs.type }}
158155
run: |
159-
echo "::error::Expected release type to be 'none', got '${{ steps.action-no-publish.outputs.type }}'"
156+
echo "::error::Expected release type to be '', got '${{ steps.action-no-publish.outputs.type }}'"
160157
exit 1
161158
162159
- name: Create new version for Action end-to-end test
163160
shell: bash
164-
run: ./e2e/01-setup-package.sh ${{ steps.setup.outputs.package }} 0.0.3
161+
run: ./e2e/01-setup-package.sh "${{ steps.setup.outputs.package }}" 0.0.3
165162

166163
- id: action-publish
167164
name: Publish a new version
@@ -179,11 +176,10 @@ jobs:
179176
180177
deploy:
181178
if: ${{ github.ref == 'refs/heads/main' }}
182-
name: Publish to NPM
179+
name: Publish
183180
runs-on: ubuntu-latest
184181
timeout-minutes: 10
185182
needs:
186-
- lint
187183
- test
188184
- build
189185
- e2e

0 commit comments

Comments
 (0)
Failed to load comments.