This commit is contained in:
75
.drone.yml
75
.drone.yml
@@ -1,71 +1,18 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
name: hello-world-pipeline
|
||||
|
||||
steps:
|
||||
# Step 1: Install dependencies and run server tests
|
||||
- name: server_test
|
||||
image: node:18-alpine
|
||||
commands:
|
||||
- echo "Running server tests..."
|
||||
- cd services/server || echo "services/server directory not found!"
|
||||
- if [ -f package.json ]; then
|
||||
yarn install --frozen-lockfile;
|
||||
yarn test;
|
||||
else
|
||||
echo "package.json not found! Skipping server tests.";
|
||||
fi
|
||||
|
||||
# Step 2: Install dependencies and run client tests
|
||||
- name: client_test
|
||||
image: node:18-alpine
|
||||
commands:
|
||||
- echo "Running tests for React client..."
|
||||
- cd services/client || echo "services/client directory not found!"
|
||||
- if [ -f package.json ]; then
|
||||
yarn install --frozen-lockfile;
|
||||
yarn add --dev @babel/plugin-proposal-private-property-in-object @testing-library/jest-dom;
|
||||
yarn test --coverage --detectOpenHandles;
|
||||
else
|
||||
echo "package.json not found! Skipping client tests.";
|
||||
fi
|
||||
|
||||
# Step 3: Lint and static analysis (optional)
|
||||
- name: lint
|
||||
image: node:18-alpine
|
||||
commands:
|
||||
- echo "Running linter..."
|
||||
- cd services/client || echo "services/client directory not found!"
|
||||
- yarn lint || echo "Linting failed! Please fix lint errors."
|
||||
|
||||
# Step 4: Build the React client
|
||||
- name: client_build
|
||||
image: node:18-alpine
|
||||
commands:
|
||||
- echo "Building React client..."
|
||||
- cd services/client || echo "services/client directory not found!"
|
||||
- if [ -f package.json ]; then
|
||||
yarn install --frozen-lockfile;
|
||||
yarn build;
|
||||
else
|
||||
echo "package.json not found! Skipping build.";
|
||||
fi
|
||||
|
||||
# Step 5: Deploy (example step)
|
||||
- name: deploy
|
||||
# Step 1: Run Hello World
|
||||
- name: hello-world
|
||||
image: alpine:latest
|
||||
environment:
|
||||
DEPLOY_KEY:
|
||||
from_secret: deploy_key
|
||||
commands:
|
||||
- echo "Deploying application..."
|
||||
- # Add deployment commands here (e.g., SSH, Rsync, Kubernetes, etc.)
|
||||
- echo "Hello, World! Everything is running fine!"
|
||||
|
||||
# Specify trigger conditions
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
# Step 2: Cleanup
|
||||
- name: cleanup
|
||||
image: alpine:latest
|
||||
commands:
|
||||
- echo "Cleaning up any created data..."
|
||||
- rm -rf /tmp/* # Example cleanup, adjust based on what needs cleanup
|
||||
- echo "Cleanup complete!"
|
||||
|
||||
Reference in New Issue
Block a user