Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit bedd18f

Browse files
author
robinpdev
committed
add github action workflows for linting
1 parent 3612769 commit bedd18f

File tree

2 files changed

+101
-0
lines changed

2 files changed

+101
-0
lines changed

.github/workflows/linter.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Lint CI
2+
3+
on:
4+
- pull_request
5+
6+
jobs:
7+
flake8:
8+
runs-on: sel2-1-server
9+
steps:
10+
- uses: actions/checkout@v3
11+
- name: Set up Python 3.11
12+
uses: actions/setup-python@v4
13+
with:
14+
python-version: "3.11"
15+
- name: Install dependencies
16+
working-directory: ./backend
17+
run: |
18+
python -m pip install --upgrade pip
19+
pip install -r requirements.txt
20+
- name: Analysing the code with flake8
21+
working-directory: ./backend
22+
run: |
23+
flake8 backend/ drtrottoir/
24+
25+
ESLint:
26+
runs-on: sel2-1-server
27+
steps:
28+
29+
# Check out the repository
30+
- uses: actions/checkout@v3
31+
32+
# Install Node.js
33+
- uses: actions/setup-node@v3
34+
with:
35+
node-version: 18.17.0
36+
37+
# Install your dependencies
38+
- name: Install your dependencies
39+
working-directory: ./frontend
40+
run: npm ci
41+
42+
# Run ESLint
43+
- name: Run ESLint
44+
working-directory: ./frontend
45+
run: npm run lint

.github/workflows/tests.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: "Test CI"
2+
on:
3+
- pull_request
4+
5+
jobs:
6+
build:
7+
runs-on: self-hosted
8+
steps:
9+
- uses: actions/checkout@v3
10+
- name: Create and populate .env.dev file
11+
run: |
12+
echo "${{ secrets.CI_ENV_FILE }}" > .env.dev
13+
- name: Remove artifacts
14+
run: docker-compose down -v
15+
- name: Build the image
16+
run: docker-compose up -d --build
17+
18+
backend-tests:
19+
runs-on: self-hosted
20+
needs: build
21+
steps:
22+
- name: Test Django unittest
23+
run: docker exec DrTrottoir-be python manage.py test
24+
25+
frontend-tests-Jest:
26+
runs-on: self-hosted
27+
needs: build
28+
steps:
29+
- name: Test NEXT.js Jest
30+
run: docker exec DrTrottoir-fe npm run jest:workflow
31+
32+
frontend-tests-Cypress:
33+
runs-on: self-hosted
34+
needs: build
35+
steps:
36+
- name: Test NEXT.js Cypress component
37+
run: docker exec DrTrottoir-fe npm run component:headless
38+
- name: Test NEXT.js Cypress e2e
39+
run: docker exec DrTrottoir-fe npm run e2e:headless
40+
41+
# linting:
42+
# runs-on: self-hosted
43+
# needs: build
44+
# steps:
45+
# - name: Linter Python
46+
# run: docker exec DrTrottoir-be flake8 backend/ drtrottoir/
47+
# - name: Linter Javascript
48+
# run: docker exec DrTrottoir-fe npm run lint
49+
50+
remove:
51+
runs-on: self-hosted
52+
if: ${{ always() }}
53+
needs: [ build, backend-tests, frontend-tests-Jest, frontend-tests-Cypress]
54+
steps:
55+
- name: remove artifacts
56+
run: docker-compose down -v

0 commit comments

Comments
 (0)