Skip to content

Commit

Permalink
feat: ci (#21)
Browse files Browse the repository at this point in the history
* fix: dockerfiles

* feat: revamped ci

* feat: revamped ci

* 🚿

* 🚿

* 🚿

* 🚿

* 🚿

* 🚿

* 🚿
  • Loading branch information
siriscmv authored Nov 1, 2024
1 parent f9a7053 commit 9be8755
Show file tree
Hide file tree
Showing 13 changed files with 175 additions and 141 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Check if frontend can be built

on:
push:
branches: [project2]
pull_request:
branches: [project2]

jobs:
frontend:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v1

- name: Install pnpm
run: npm install -g pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile
working-directory: frontend/

- name: Build
run: npm run build
working-directory: frontend/
33 changes: 0 additions & 33 deletions .github/workflows/frontend_CI_CD.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Check Prettier formatting

on:
push:
branches: [project2]
pull_request:
branches: [project2]

jobs:
format:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2 # Updated to the latest version

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18' # Specify the version of Node.js you need

- name: Install Prettier
run: npm install --global prettier # Install Prettier globally

- name: Run Prettier
run: |
prettier --check src/**/*.{js,ts,tsx,css}
prettier --check ../backend
working-directory: frontend/
44 changes: 27 additions & 17 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
name: Pylint

on: [push]
on:
push:
branches: [project2]
pull_request:
branches: [project2]

jobs:
build:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
- uses: actions/checkout@v3
- name: Set up Python 3.13
uses: actions/setup-python@v3
with:
python-version: 3.13

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analyzing the code with pylint
run: |
pylint $(git ls-files '*.py') > pylint_output.txt || true
score=$(tail -n 1 pylint_output.txt | awk '{print $2}') # Get the Pylint score
echo "::set-output name=score::$score" # Set the score as output
- name: Save Pylint score to file
run: |
echo "Pylint Score: ${{ steps.pylint.outputs.score }}" > pylint_score.txt
47 changes: 47 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Pytest CI

on:
push:
branches: [project2]
pull_request:
branches: [project2]

jobs:
test:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:5.0
ports:
- 27017:27017
env:
MONGO_INITDB_DATABASE: mydatabase
options: >-
--health-cmd "mongo --eval 'db.runCommand({ ping: 1 })'"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2

- name: Set up Python 3.13
uses: actions/setup-python@v2
with:
python-version: 3.13

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov pytest-mock coverage
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -r ./backend/requirements.txt
- name: Set environment variable for MongoDB
run: echo "MONGODB_HOST_STRING=mongodb://localhost:27017/mydatabase" >> $GITHUB_ENV

- name: Test with pytest
run: |
cd ./backend
pwd
pytest --cov-report xml:cov.xml --cov=./ ./
39 changes: 0 additions & 39 deletions .github/workflows/pytest_ci.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .github/workflows/super-linter.yml

This file was deleted.

9 changes: 8 additions & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ COPY requirements.txt /app/
# Install dependencies specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

RUN apt update && apt install -y texlive
RUN apt-get update && \
apt-get install -y \
texlive-full \
texlive-latex-extra \
texlive-fonts-recommended \
texlive-fonts-extra \
texlive-xetex \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Copy the rest of the application code
COPY . /app
Expand Down
Loading

0 comments on commit 9be8755

Please sign in to comment.