From e2af4298f5d8e953a717a7952280699a82de891e Mon Sep 17 00:00:00 2001 From: Jake Loew Date: Fri, 5 Apr 2024 11:12:31 -0600 Subject: [PATCH 1/3] Adding lint-and-test workflow to dispatch on pull requests --- .github/workflows/lint-and-test.yml | 42 +++++++++++++++++++++++++++++ .husky/pre-commit | 2 +- package.json | 2 +- 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/lint-and-test.yml diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml new file mode 100644 index 0000000..f6540f1 --- /dev/null +++ b/.github/workflows/lint-and-test.yml @@ -0,0 +1,42 @@ +name: Lint and Test + +on: + pull_request: + branches: [main] + +jobs: + lint: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20.x] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Check Linter + run: yarn lint:check + - name: Check Formatting + run: yarn format:check + + test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x, 20.x] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Run Tests + run: yarn test diff --git a/.husky/pre-commit b/.husky/pre-commit index 0b299d7..464bb48 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,3 +1,3 @@ -npm test +yarn test npx lint-staged \ No newline at end of file diff --git a/package.json b/package.json index 3d51aa0..440a3df 100644 --- a/package.json +++ b/package.json @@ -52,4 +52,4 @@ "*.{ts,tsx}": "eslint --cache --fix", "*.{js,css,md,ts,tsx,yml}": "prettier --write" } -} \ No newline at end of file +} From 07c5b875c08291dffeee3895b5ad70ae7c0cdd4d Mon Sep 17 00:00:00 2001 From: Jake Loew Date: Fri, 5 Apr 2024 11:24:11 -0600 Subject: [PATCH 2/3] Automatic format fixing --- packages/lexicon/package.json | 2 +- packages/sdk-angular/package.json | 2 +- .../sdk-angular/projects/fusionauth-angular-sdk/package.json | 2 +- packages/sdk-react/package.json | 2 +- packages/sdk-vue/web-types.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/lexicon/package.json b/packages/lexicon/package.json index 8ba528a..031d465 100644 --- a/packages/lexicon/package.json +++ b/packages/lexicon/package.json @@ -29,4 +29,4 @@ "vite-plugin-dts": "^3.7.1", "vitest": "^1.2.1" } -} \ No newline at end of file +} diff --git a/packages/sdk-angular/package.json b/packages/sdk-angular/package.json index 452b2ff..97916bc 100644 --- a/packages/sdk-angular/package.json +++ b/packages/sdk-angular/package.json @@ -36,4 +36,4 @@ "ng-packagr": "^17.2.0", "typescript": "~5.3.2" } -} \ No newline at end of file +} diff --git a/packages/sdk-angular/projects/fusionauth-angular-sdk/package.json b/packages/sdk-angular/projects/fusionauth-angular-sdk/package.json index 72aedf2..46adab2 100644 --- a/packages/sdk-angular/projects/fusionauth-angular-sdk/package.json +++ b/packages/sdk-angular/projects/fusionauth-angular-sdk/package.json @@ -10,4 +10,4 @@ "tslib": "^2.3.0" }, "sideEffects": false -} \ No newline at end of file +} diff --git a/packages/sdk-react/package.json b/packages/sdk-react/package.json index ccbc3b7..86ee653 100644 --- a/packages/sdk-react/package.json +++ b/packages/sdk-react/package.json @@ -57,4 +57,4 @@ "vite-plugin-dts": "^3.7.3", "vitest": "^1.3.1" } -} \ No newline at end of file +} diff --git a/packages/sdk-vue/web-types.json b/packages/sdk-vue/web-types.json index 77b1e88..c6ed038 100644 --- a/packages/sdk-vue/web-types.json +++ b/packages/sdk-vue/web-types.json @@ -105,4 +105,4 @@ ] } } -} \ No newline at end of file +} From a553921b766f64fa555c825c95b53e56d96edecf Mon Sep 17 00:00:00 2001 From: Jake Loew Date: Fri, 5 Apr 2024 11:29:31 -0600 Subject: [PATCH 3/3] Separate lint and test workflows --- ...{lint-and-test.yml => lint-and-format.yml} | 21 ++-------------- .github/workflows/run-tests.yml | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+), 19 deletions(-) rename .github/workflows/{lint-and-test.yml => lint-and-format.yml} (53%) create mode 100644 .github/workflows/run-tests.yml diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-format.yml similarity index 53% rename from .github/workflows/lint-and-test.yml rename to .github/workflows/lint-and-format.yml index f6540f1..58582fe 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-format.yml @@ -1,11 +1,11 @@ -name: Lint and Test +name: Lint and Format on: pull_request: branches: [main] jobs: - lint: + check: runs-on: ubuntu-latest strategy: matrix: @@ -23,20 +23,3 @@ jobs: run: yarn lint:check - name: Check Formatting run: yarn format:check - - test: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [18.x, 20.x] - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - name: Install dependencies - run: yarn install --frozen-lockfile - - name: Run Tests - run: yarn test diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..c28b69e --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,25 @@ +name: Run Tests + +on: + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x, 20.x] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Build Core + run: yarn build:core + - name: Run Tests + run: yarn test