Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve actions #12

Merged
merged 5 commits into from
Mar 13, 2024
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
107 changes: 63 additions & 44 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
name: Build, Test and Push
name: Build, Test, and Push

on:
push:
branches:
- "**"
pull_request:
branches:
- "**"

jobs:
scan:
name: gitleaks
name: Gitleaks Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -19,48 +21,65 @@ jobs:
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE}}
build:
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}

build-test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install dependencies
run: npm install
- name: Run lint tests
run: npm run lint
- name: Run unit tests
run: npm run test
- name: Dependency Check
uses: dependency-check/Dependency-Check_Action@main
with:
project: 'messaging-app'
path: '.'
format: 'HTML'
out: 'reports'
args: >
--failOnCVSS 7
--enableRetired
- name: Upload Dependency Check Test results
uses: actions/upload-artifact@master
with:
name: Dependency Check report
path: ${{github.workspace}}/reports
- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and run docker containers
run: |
docker-compose up -d && \
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install dependencies
run: npm install

- name: Run lint tests
run: npm run lint

- name: Run unit tests
run: npm run test

- name: Dependency Check
uses: dependency-check/Dependency-Check_Action@main
with:
project: 'messaging-app'
path: '.'
format: 'HTML'
out: 'reports'
args: >
--failOnCVSS 7
--enableRetired

- name: Upload Dependency Check Report
uses: actions/upload-artifact@v2
with:
name: Dependency Check report
path: ${{ github.workspace }}/reports

docker:
name: Docker Build and Push
runs-on: ubuntu-latest
needs: build-test
steps:
- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Run Docker Containers
run: |
docker-compose up -d && \
docker ps && sleep 5
- name: Build and push to Docker Hub
uses: docker/[email protected]
with:
context: .
push: true
tags: dasha12678/messaging-app:latest

- name: Build and Push to Docker Hub
uses: docker/[email protected]
with:
context: .
push: true
tags: dasha12678/messaging-app:latest
15 changes: 15 additions & 0 deletions budget.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"path": "/*",
"resourceSizes": [
{
"resourceType": "document",
"budget": 18
},
{
"resourceType": "total",
"budget": 200
}
]
}
]
Loading