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

Lab13 #1246

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

Lab13 #1246

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
84 changes: 84 additions & 0 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Node.js CI

on:
push:
paths:
- 'app_node/**'
- '.github/workflows/node-ci.yml'
pull_request:
paths:
- 'app_node/**'
- '.github/workflows/node-ci.yml'

defaults:
run:
working-directory: ./app_node # Set the default directory of the Node.js project

jobs:

lint-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout code repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14' # Change to your preferred Node.js version

- name: Install dependencies
run: |
npm install

- name: Lint with ESLint
run: |
npx eslint .

- name: Run tests
run: |
npx mocha test.js

security-check:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout code repository
uses: actions/checkout@v2

- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master
continue-on-error: true # To make sure that SARIF upload gets called
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --all-projects --sarif

build-and-push:
needs: [lint-and-test, security-check]
runs-on: ubuntu-latest

steps:

- name: Checkout code repository
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
run: |
docker buildx build -t artkochergin/random-node-app:latest .
docker buildx build --push -t artkochergin/random-node-app:latest .
working-directory: ./app_node # Change to your project directory
103 changes: 103 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Python CI

on:
push:
paths:
- 'app_python/**'
- '.github/workflows/python-ci.yml'
pull_request:
paths:
- 'app_python/**'
- '.github/workflows/python-ci.yml'

defaults:
run:
working-directory: ./app_python # We set the default directory of python project

jobs:

lint-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]

steps:
- name: Checkout code repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
./app_python/requirements.txt

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Lint with flake8
run: |
pip install flake8
flake8 .

- name: Run unit tests
run: |
python test_app.py

security-check:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout code repository.
uses: actions/checkout@v3

- name: Check for vulnerabilities using Snyk
uses: snyk/actions/python-3.10@master
continue-on-error: true # To make sure that SARIF upload gets called
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args:
--package-manager=pip
--skip-unresolved
--file=app_python/requirements.txt

build-and-push:
needs: [lint-and-test, security-check]
runs-on: ubuntu-latest

steps:

- name: Checkout code repository
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
id: login
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build Docker image
run: |
docker buildx build -t artkochergin/time-python-app:latest .
docker buildx build --push -t artkochergin/time-python-app:latest .
working-directory: ./app_python # Change to your project directory

- name: Check Docker Hub Login Status
run: echo "Logged in to Docker Hub successfully."

- name: Logout from Docker Hub
run: docker logout
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/.idea
**/venv/
**/__pycache__/
Loading