From 4af67fbb0531284ff3f554949ad5b365df478fc6 Mon Sep 17 00:00:00 2001 From: vishal Date: Mon, 29 Jul 2024 14:35:54 +0530 Subject: [PATCH] Added workflow to test problem directory --- .github/workflows/deploy-problems.yml | 12 +--------- .github/workflows/test-pronblems.yml | 30 +++++++++++++++++++++++++ apps/boilerplate-generator/package.json | 4 ++-- docker/problems/Dockerfile | 2 +- package-lock.json | 1 - package.json | 2 +- yarn.lock | 1 - 7 files changed, 35 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/test-pronblems.yml diff --git a/.github/workflows/deploy-problems.yml b/.github/workflows/deploy-problems.yml index d74cef7..33f3098 100644 --- a/.github/workflows/deploy-problems.yml +++ b/.github/workflows/deploy-problems.yml @@ -9,14 +9,7 @@ on: - 'apps/boilerplate-generator/**' - 'docker/problems/**' - '.github/workflows/deploy-problems.yml' - pull_request: - branches: - - 'main' - paths: - - 'apps/problems/**' - - 'docker/problems/**' - - '.github/workflows/deploy-problems.yml' - + jobs: Deploy-sweeper: name: Builds and pushes to Docker Hub @@ -25,9 +18,6 @@ jobs: - name: Checkout the Repository uses: actions/checkout@v3 - - name: Run test for Problems - run: npm install && cd apps/boilerplate-generator && npm run test - - name: Copy Docker image to root run: cp ./docker/problems/Dockerfile . diff --git a/.github/workflows/test-pronblems.yml b/.github/workflows/test-pronblems.yml new file mode 100644 index 0000000..c244c75 --- /dev/null +++ b/.github/workflows/test-pronblems.yml @@ -0,0 +1,30 @@ +name: Test Problem directory structure + +on: + push: + branches: + - 'main' + paths: + - 'apps/problems/**' + - 'apps/boilerplate-generator/**' + - 'docker/problems/**' + - '.github/workflows/deploy-problems.yml' + pull_request: + branches: + - 'main' + paths: + - 'apps/problems/**' + - 'docker/problems/**' + - '.github/workflows/deploy-problems.yml' + + +jobs: + Deploy-sweeper: + name: Test Problem directory structure + runs-on: ubuntu-latest + steps: + - name: Checkout the Repository + uses: actions/checkout@v3 + + - name: Test problems directory + run: cd apps/boilerplate-generator && npm install && npm run test diff --git a/apps/boilerplate-generator/package.json b/apps/boilerplate-generator/package.json index 098848c..b990608 100644 --- a/apps/boilerplate-generator/package.json +++ b/apps/boilerplate-generator/package.json @@ -4,8 +4,8 @@ "description": "", "main": "index.js", "scripts": { - "build": "yarn esbuild src/index.ts --bundle --platform=node --outfile=dist/index.js", - "boiler:generate": "yarn run build && node dist/index.js", + "build": "npm esbuild src/index.ts --bundle --platform=node --outfile=dist/index.js", + "boiler:generate": "npm run build && node dist/index.js", "test": "npx vitest run", "start": "npm run test && npm run boiler:generate" }, diff --git a/docker/problems/Dockerfile b/docker/problems/Dockerfile index f1b4236..59f5b4a 100644 --- a/docker/problems/Dockerfile +++ b/docker/problems/Dockerfile @@ -13,7 +13,7 @@ WORKDIR /usr/src/app RUN npm install -RUN cd ./apps/boilerplate-generator && npm run build && PROBLEMS_DIR_PATH=/usr/src/app/apps/problems node dist/index.js +RUN cd ./apps/boilerplate-generator && PROBLEMS_DIR_PATH=/usr/src/app/apps/problems npm run start WORKDIR /usr/src/app diff --git a/package-lock.json b/package-lock.json index 35adb88..464b354 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,6 @@ "packages": { "": { "name": "algoearth3", - "hasInstallScript": true, "workspaces": [ "apps/*", "packages/*" diff --git a/package.json b/package.json index bad0770..d95fa6f 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "build": "turbo build", "dev": "turbo dev", "lint": "turbo lint", - "dev:docker": "npm run prisma:docker && yarn dev", + "dev:docker": "npm run prisma:docker && npm dev", "prisma:docker": "cd packages/db && npm prisma db push --force-reset && npm prisma db seed", "format": "prettier --write \"**/*.{ts,tsx,md}\"", "start:web": "cd apps/web && npm run start", diff --git a/yarn.lock b/yarn.lock index ddb94a3..4ee4c4b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1091,7 +1091,6 @@ binary-extensions@^2.0.0: dotenv "^16.4.5" esbuild "^0.21.5" fs "^0.0.1-security" - vitest "^2.0.4" brace-expansion@^1.1.7: version "1.1.11"