Skip to content

chore: updated readme, refactor service and controller #23

chore: updated readme, refactor service and controller

chore: updated readme, refactor service and controller #23

Workflow file for this run

name: FxQl CI/CD Workflow
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
test-build-deploy:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- uses: actions/checkout@v4
# Cache Node.js dependencies
- name: Cache Node Modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# Setup Node.js
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
# Install dependencies
- name: Install Dependencies
run: npm install
# Run linter
- name: Run Linter
run: npm run lint
# Run tests with coverage
- name: Run Tests
run: npm run test
# Build the application
- name: Build Application
run: npm run build
- name: Debug Secrets
run: |
echo "Docker Username: ${{ secrets.RAILWAY_TOKEN }}"
# Docker build and push
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Build and push Docker image
- name: Build and Push Docker Image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/fxql:${{ github.sha }} -t ${{ secrets.DOCKER_USERNAME }}/fxql:latest .
docker push ${{ secrets.DOCKER_USERNAME }}/fxql:${{ github.sha }}
docker push ${{ secrets.DOCKER_USERNAME }}/fxql:latest
# Deploy to Railway
- name: Deploy to Railway
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
run: |
npm install -g @railway/cli
railway up --service fxql-service