-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (40 loc) · 1.41 KB
/
react-lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: React Linting
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v3
- name: Setup Env Vars
run: |
cat >> .envvars << EOF
DJANGO_SECRET_KEY='django-insecure-4o3ug_h7f1r6fa2z5@4o3ug_h7f1r6fa2-!x=-n*tfuccxn5n'
MYSQL_HOST=stocksdb
MYSQL_PORT=3306
MYSQL_ROOT_PASSWORD=unittestrootpw
MYSQL_DATABASE=stocksapp
MYSQL_USER=team2
MYSQL_PASSWORD=unittestMysqlP@ssword
MYSQL_PWD=unittestMysqlP@ssword
EOF
- name: Build FrontEnd
run: |
docker compose -f BuildTools/docker-compose.yml up -d --build --remove-orphans frontend
- name: EsLint
run: |
docker exec stocks_frontend /bin/bash -c 'cd src; npx eslint $(find ./ -name "*.js" | grep -vP ".test.js")' > eslint.results.log
if [[ $(grep -P '[0-9]+ problems' eslint.results.log | wc -l ) -gt 0 ]]; then
echo "ESLint found errors."
cat eslint.results.log
exit 1
fi
cat eslint.results.log