-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/gregory567/ContInt-backend
asdf
- Loading branch information
Showing
2 changed files
with
192 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,37 @@ on: | |
- main | ||
|
||
jobs: | ||
build: | ||
name: Build and Test Backend | ||
# Lint Job | ||
lint: | ||
name: Lint Backend | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Step 1: Checkout the code | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Full-depth clone for SonarQube analysis | ||
|
||
# Step 2: Run Snyk Security Scan | ||
- name: Snyk Security Scan | ||
uses: snyk/actions/node@master | ||
with: | ||
command: test --all-projects | ||
env: | ||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | ||
|
||
# Step 3: SonarQube Scan | ||
- name: SonarQube Scan | ||
uses: sonarsource/sonarqube-scan-action@master | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | ||
|
||
# Test Job | ||
test: | ||
name: Test Backend | ||
needs: lint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
@@ -31,11 +60,7 @@ jobs: | |
- name: Install Dependencies | ||
run: npm ci | ||
|
||
# Step 4: Build the source code (if applicable) | ||
- name: Build Source Code | ||
run: npm run build --if-present | ||
|
||
# Step 5: Run tests | ||
# Step 4: Run tests | ||
- name: Run Tests | ||
env: | ||
DB_HOST: ${{ secrets.DB_HOST }} | ||
|
@@ -45,36 +70,36 @@ jobs: | |
DB_NAME: ${{ secrets.DB_NAME }} | ||
run: npm test --if-present | ||
|
||
lint: | ||
name: Lint Backend | ||
needs: build | ||
# Build Job | ||
build: | ||
name: Build Backend | ||
needs: test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Step 1: Checkout the code | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Full-depth clone for SonarQube analysis | ||
|
||
# Step 2: Run Snyk Security Scan using Snyk's cloud service | ||
- name: Snyk Security Scan | ||
uses: snyk/actions/node@master | ||
# Step 2: Set up Node.js environment (latest version) | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
command: test --all-projects | ||
env: | ||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | ||
node-version: "22.x" | ||
cache: npm | ||
|
||
# Step 3: SonarQube Scan | ||
- name: SonarQube Scan | ||
uses: sonarsource/sonarqube-scan-action@master | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} | ||
# Step 3: Install dependencies | ||
- name: Install Dependencies | ||
run: npm ci | ||
|
||
# Step 4: Build the source code | ||
- name: Build Source Code | ||
run: npm run build --if-present | ||
|
||
# Deliver Job | ||
deliver: | ||
name: Deliver Backend | ||
needs: lint | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
@@ -94,11 +119,18 @@ jobs: | |
- name: Push Docker Image | ||
run: docker push gregory789/contint-backend-repository:contint-backend-image | ||
|
||
# Deploy Job | ||
deploy: | ||
name: Deploy Backend | ||
needs: deliver | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
# Step 1: Checkout the code | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
# Step 2: Execute remote SSH commands using SSH key | ||
- name: Executing remote SSH commands using SSH key | ||
uses: appleboy/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters