From 23ba46801fc1b65d765865310d148a2b31293a10 Mon Sep 17 00:00:00 2001 From: gabriel-logan Date: Mon, 10 Jun 2024 04:37:01 -0300 Subject: [PATCH] chore: Add pr-check script to run tests, linting, and build for pull request validation --- .github/FUNDING.yml | 14 ++++++++++++ .github/workflows/backend-pr-check.yml | 30 +++++++++++++++++++++++++ .github/workflows/frontend-pr-check.yml | 30 +++++++++++++++++++++++++ backend/package.json | 3 ++- frontend/package.json | 3 ++- 5 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/backend-pr-check.yml create mode 100644 .github/workflows/frontend-pr-check.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..f4b3ea7 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,14 @@ +# These are supported funding model platforms + +github: [gabriel-logan] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +polar: # Replace with a single Polar username +buy_me_a_coffee: gabriellogan +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] \ No newline at end of file diff --git a/.github/workflows/backend-pr-check.yml b/.github/workflows/backend-pr-check.yml new file mode 100644 index 0000000..53d2838 --- /dev/null +++ b/.github/workflows/backend-pr-check.yml @@ -0,0 +1,30 @@ +name: Backend Pull Request Check + +on: + pull_request: + branches: [ main ] + paths: + - 'backend/**' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://registry.npmjs.org/ + + - name: Cd to the directory to test + working-directory: ./backend/typescript + run: | + npm install + npm run pr-check \ No newline at end of file diff --git a/.github/workflows/frontend-pr-check.yml b/.github/workflows/frontend-pr-check.yml new file mode 100644 index 0000000..c43b157 --- /dev/null +++ b/.github/workflows/frontend-pr-check.yml @@ -0,0 +1,30 @@ +name: Frontend Pull Request Check + +on: + pull_request: + branches: [ main ] + paths: + - 'frontend/**' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: 16 + registry-url: https://registry.npmjs.org/ + + - name: Cd to the directory to test + working-directory: ./frontend/typescript + run: | + npm install + npm run pr-check \ No newline at end of file diff --git a/backend/package.json b/backend/package.json index a4f5f1d..6f3021a 100644 --- a/backend/package.json +++ b/backend/package.json @@ -17,7 +17,8 @@ "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "jest --config ./test/jest-e2e.json", - "pre-commit": "yarn format && yarn lint && yarn test && yarn build && git add ." + "pre-commit": "yarn format && yarn lint && yarn test && yarn build && git add .", + "pr-check": "yarn format && yarn lint && yarn test && yarn build" }, "dependencies": { "@nestjs/common": "^10.0.0", diff --git a/frontend/package.json b/frontend/package.json index 23282bf..3e3ebd6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -7,7 +7,8 @@ "build": "next build", "start": "next start", "lint": "next lint", - "pre-commit": "yarn lint && yarn build && git add ." + "pre-commit": "yarn lint && yarn build && git add .", + "pr-check": "yarn lint && yarn build" }, "dependencies": { "next": "14.2.3",