Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 5 additions & 34 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:
NODE_VERSION: 22.x

jobs:
test:
safety-check:
name: Production Safety Check
runs-on: ubuntu-latest

Expand All @@ -30,53 +30,24 @@ jobs:
uses: actions/setup-node@v7
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test
run: npm install

- name: Security audit
run: npm audit --audit-level=high

build-check:
name: Build Verification
needs: test
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v7

- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm

- name: Install dependencies
run: npm ci

- name: Verify imports
- name: Verify syntax
run: node --check server.js && node --check worker.js

- name: Verify environment
run: |
if [ ! -f .env.example ]; then
echo ".env.example not found"
exit 1
fi
echo "Environment template present"

deploy:
name: Trigger Production Deployment
needs: build-check
needs: safety-check
runs-on: ubuntu-latest

environment:
name: production
url: https://api.hoterstellar.com

steps:
- name: Trigger deployment
Expand Down
99 changes: 53 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,62 @@
name: CD - Production Deployment
name: CI

on:
push:
branches:
- main
- develop
- "feature/**"
- "fix/**"
- "refactor/**"

pull_request:
branches:
- main
- develop

workflow_dispatch:

permissions:
contents: read

concurrency:
group: production-deployment
cancel-in-progress: false
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
NODE_VERSION: 22.x

jobs:
test:
name: Production Safety Check
quality:
name: Code Quality
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: [20.x, 22.x]

steps:
- name: Checkout repository
uses: actions/checkout@v7

- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci
run: npm install

- name: Run tests
run: npm test
- name: Verify package
run: npm --version

- name: Security audit
if: matrix.node-version == '22.x'
run: npm audit --audit-level=high

build-check:
name: Build Verification
needs: test
syntax-check:
name: Syntax Verification
runs-on: ubuntu-latest

steps:
Expand All @@ -54,47 +67,41 @@ jobs:
uses: actions/setup-node@v7
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm

- name: Install dependencies
run: npm ci
run: npm install

- name: Verify server entry
run: node --check server.js

- name: Verify imports
run: node --check server.js && node --check worker.js
- name: Verify worker entry
run: node --check worker.js

- name: Verify environment
- name: Verify app bootstrap
run: node --check src/app/app.js

- name: Verify config files
run: |
if [ ! -f .env.example ]; then
echo ".env.example not found"
exit 1
fi
echo "Environment template present"
for file in src/config/*.js; do
node --check "$file"
done

deploy:
name: Trigger Production Deployment
needs: build-check
runs-on: ubuntu-latest
- name: Verify middleware files
run: |
for file in src/middlewares/*.js; do
node --check "$file"
done

environment:
name: production
url: https://api.hoterstellar.com
- name: Verify utility files
run: |
for file in src/utils/*.js; do
node --check "$file"
done

steps:
- name: Trigger deployment
env:
DEPLOY_HOOK_URL: ${{ secrets.PRODUCTION_DEPLOY_HOOK_URL }}
- name: Verify environment template
run: |
if [ -z "$DEPLOY_HOOK_URL" ]; then
echo "PRODUCTION_DEPLOY_HOOK_URL is not configured."
if [ ! -f .env.example ]; then
echo ".env.example not found"
exit 1
fi

curl \
--fail \
--silent \
--show-error \
--request POST \
"$DEPLOY_HOOK_URL"

- name: Deployment triggered
run: echo "Production deployment webhook triggered successfully."
echo "Environment template present"
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
paths-ignore:
- '**/*.test.js'
- '**/*.spec.js'
- 'tests/**'
- 'node_modules/**'

- name: Autobuild
uses: github/codeql-action/autobuild@v4
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ npm-debug.log*
*.log
.DS_Store
coverage/

package-lock.json
Loading
Loading