Skip to content

Commit

Permalink
ci: add GitHub actions to do static code checks (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeandek authored Feb 28, 2024
1 parent a14d7e0 commit 9130840
Show file tree
Hide file tree
Showing 6 changed files with 9,898 additions and 13 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"plugins": [
"@typescript-eslint"
],
"ignorePatterns": [ "/dist/**" ],
"rules": {
"indent": ["error", 2],
"linebreak-style": ["error", "unix"],
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/staticChecks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Static checks

on: [ pull_request, push ]

jobs:
ci-static-checks:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout PR
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup NodeJS
uses: actions/[email protected]
with:
node-version-file: 'package.json'
- name: Install dependencies
run: npm ci
- name: Build code
run: npm run build
- name: Run linters
run: npm run lint
- name: Run unit tests
run: npm run test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules
package-lock.json
output-template.yml
*.tgz
coverage/
Expand Down
12 changes: 0 additions & 12 deletions __tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ describe('private functions', () => {
cookieExpirationDays: 365,
disableCookieDomain: false,
httpOnly: false,
logLevel: 'error',
});
});

Expand Down Expand Up @@ -82,7 +81,6 @@ describe('private functions', () => {
userPoolDomain: 'my-cognito-domain.auth.us-east-1.amazoncognito.com',
cookieExpirationDays: 365,
disableCookieDomain: true,
logLevel: 'error',
});
authenticatorWithNoCookieDomain._jwtVerifier.cacheJwks(jwksData);

Expand Down Expand Up @@ -121,7 +119,6 @@ describe('private functions', () => {
cookieExpirationDays: 365,
disableCookieDomain: false,
httpOnly: true,
logLevel: 'error',
});
authenticatorWithHttpOnly._jwtVerifier.cacheJwks(jwksData);

Expand Down Expand Up @@ -160,7 +157,6 @@ describe('private functions', () => {
cookieExpirationDays: 365,
disableCookieDomain: false,
httpOnly: true,
logLevel: 'error',
sameSite: 'Strict',
});
authenticatorWithSameSite._jwtVerifier.cacheJwks(jwksData);
Expand Down Expand Up @@ -200,7 +196,6 @@ describe('private functions', () => {
userPoolDomain: 'my-cognito-domain.auth.us-east-1.amazoncognito.com',
cookieExpirationDays: 365,
disableCookieDomain: false,
logLevel: 'error',
cookiePath,
});
authenticatorWithPath._jwtVerifier.cacheJwks(jwksData);
Expand Down Expand Up @@ -240,7 +235,6 @@ describe('private functions', () => {
userPoolDomain: 'my-cognito-domain.auth.us-east-1.amazoncognito.com',
cookieExpirationDays: 365,
disableCookieDomain: false,
logLevel: 'error',
cookiePath,
csrfProtection: {
nonceSigningSecret: 'foo-bar',
Expand Down Expand Up @@ -286,7 +280,6 @@ describe('private functions', () => {
userPoolDomain: 'my-cognito-domain.auth.us-east-1.amazoncognito.com',
cookieExpirationDays: 365,
disableCookieDomain: false,
logLevel: 'error',
cookiePath,
httpOnly: true,
csrfProtection: {
Expand Down Expand Up @@ -656,7 +649,6 @@ describe('handle', () => {
userPoolAppId: '123456789qwertyuiop987abcd',
userPoolDomain: 'my-cognito-domain.auth.us-east-1.amazoncognito.com',
cookieExpirationDays: 365,
logLevel: 'debug',
});
authenticator._jwtVerifier.cacheJwks(jwksData);
jest.spyOn(authenticator, '_getTokensFromCookie');
Expand Down Expand Up @@ -843,7 +835,6 @@ describe('handleSignIn', () => {
userPoolAppId: '123456789qwertyuiop987abcd',
userPoolDomain: 'my-cognito-domain.auth.us-east-1.amazoncognito.com',
cookieExpirationDays: 365,
logLevel: 'debug',
parseAuthPath: 'parseAuth',
});
authenticator._jwtVerifier.cacheJwks(jwksData);
Expand Down Expand Up @@ -886,7 +877,6 @@ describe('handleParseAuth', () => {
userPoolAppId: '123456789qwertyuiop987abcd',
userPoolDomain: 'my-cognito-domain.auth.us-east-1.amazoncognito.com',
cookieExpirationDays: 365,
logLevel: 'debug',
parseAuthPath: 'parseAuth',
});
authenticator._jwtVerifier.cacheJwks(jwksData);
Expand Down Expand Up @@ -978,7 +968,6 @@ describe('handleRefreshToken', () => {
userPoolAppId: '123456789qwertyuiop987abcd',
userPoolDomain: 'my-cognito-domain.auth.us-east-1.amazoncognito.com',
cookieExpirationDays: 365,
logLevel: 'debug',
});
authenticator._jwtVerifier.cacheJwks(jwksData);
jest.spyOn(authenticator, '_getTokensFromCookie');
Expand Down Expand Up @@ -1030,7 +1019,6 @@ describe('handleSignOut', () => {
userPoolAppId: '123456789qwertyuiop987abcd',
userPoolDomain: 'my-cognito-domain.auth.us-east-1.amazoncognito.com',
cookieExpirationDays: 365,
logLevel: 'debug',
});
authenticator._jwtVerifier.cacheJwks(jwksData);
jest.spyOn(authenticator, '_getTokensFromCookie');
Expand Down
Loading

0 comments on commit 9130840

Please sign in to comment.