diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ac1b69e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,61 @@ +name: Node.js CI + +on: + push: + branches: [main, master, WHS_VULN_DETEC] + pull_request: + branches: [main, master] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [14.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: Install dependencies + run: npm install + - name: Build (if present) + run: npm run build --if-present + - name: Lint (ignore error) + run: npm run lint || true + + - name: Test each JS file (excluding node_modules) + run: | + set +e + LOG_ALL="test_results.log" + LOG_FAIL="test_failed.log" + > $LOG_ALL + > $LOG_FAIL + # node_modules 제외하고 .js 순회 + for f in $(find . -type f -name '*.js' -not -path "./node_modules/*"); do + echo "===== TEST $f =====" | tee -a $LOG_ALL + OUT=$(node "$f" 2>&1) + CODE=$? + echo "$OUT" >> $LOG_ALL + if [ $CODE -ne 0 ]; then + echo "[❌ FAIL] $f" | tee -a $LOG_FAIL + echo "에러 로그:" >> $LOG_FAIL + echo "$OUT" >> $LOG_FAIL + echo "" >> $LOG_FAIL + else + echo "[✅ PASS] $f" | tee -a $LOG_ALL + fi + done + echo "테스트 완료." | tee -a $LOG_ALL + exit 0 + continue-on-error: true + + - name: Upload test logs + uses: actions/upload-artifact@v4 + with: + name: test-logs + path: | + test_results.log + test_failed.log diff --git a/.github/workflows/pr_notify.yml b/.github/workflows/pr_notify.yml new file mode 100644 index 0000000..2b34036 --- /dev/null +++ b/.github/workflows/pr_notify.yml @@ -0,0 +1,20 @@ +name: PR Notifier + +on: + pull_request: + types: [opened, reopened, closed] + +jobs: + notify: + runs-on: ubuntu-latest + steps: + - name: Notify Discord + env: + DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} + run: | + curl -H "Content-Type: application/json" -d '{"content": "🔔 Pull Request [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) by ${{ github.event.pull_request.user.login }} - ${{ github.event.action }}"}' $DISCORD_WEBHOOK_URL + - name: Notify Slack + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + run: | + curl -H "Content-Type: application/json" -d '{"text": ":bell: Pull Request <${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}> by ${{ github.event.pull_request.user.login }} - ${{ github.event.action }}"}' $SLACK_WEBHOOK_URL diff --git a/package.json b/package.json index cb70fc3..e8c67ad 100644 --- a/package.json +++ b/package.json @@ -1,31 +1,53 @@ { - "name": "corner4", + "name": "autogen-js-project", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { - "start": "npm-run-all --parallel start:**", - "start:server": "cd server && nodemon server", - "start:client": "cd client && npm start", - "test": "echo \"Error: no test specified\" && exit 1" + "test": "for f in $(find . -type f -name '*.js'); do echo \"[TEST] $f\"; node $f || exit 1; done" }, - "repository": { - "type": "git", - "url": "git+https://github.com/koh0074/corner4.git" - }, - "author": "", - "license": "ISC", - "bugs": { - "url": "https://github.com/koh0074/corner4/issues" - }, - "homepage": "https://github.com/koh0074/corner4#readme", "dependencies": { - "axios": "^1.7.9", - "express": "^4.21.2" - }, - "devDependencies": { - "http-proxy-middleware": "^3.0.3", - "nodemon": "^3.1.9", - "npm-run-all": "^4.1.5" + "@testing-library/jest-dom": "*", + "@testing-library/react": "*", + "axios": "*", + "babel-cli": "*", + "bcrypt": "*", + "body-parser": "*", + "chai": "*", + "cookie-parser": "*", + "cors": "*", + "dotenv": "*", + "ejs": "*", + "eslint": "*", + "express": "*", + "express-session": "*", + "hapi": "*", + "http-proxy-middleware": "*", + "jest": "*", + "jsonwebtoken": "*", + "koa": "*", + "lodash": "*", + "mocha": "*", + "mongodb": "*", + "mongoose": "*", + "morgan": "*", + "multer": "*", + "mysql2": "*", + "nodemon": "*", + "nunjucks": "*", + "passport": "*", + "passport-local": "*", + "pg": "*", + "prettier": "*", + "pug": "*", + "react": "*", + "react-dom": "*", + "react-router-dom": "*", + "redis": "*", + "sequelize": "*", + "sqlite3": "*", + "supertest": "*", + "ts-node": "*", + "typescript": "*" } -} +} \ No newline at end of file diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..944b381 --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +Code is Modified!!! \ No newline at end of file