Skip to content

Commit 8a205f0

Browse files
authored
Merge pull request #316 from ComputerScienceHouse/develop
2 parents 14ac00b + 97ccf1a commit 8a205f0

24 files changed

+180
-426
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Dockerfile
2+
.gitignore

.github/dependabot.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "pip" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"
12+
13+
- package-ecosystem: "npm" # See documentation for possible values
14+
directory: "/" # Location of package manifests
15+
schedule:
16+
interval: "weekly"

.github/workflows/docker-build.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- master
8+
9+
# Run tests for any PRs.
10+
pull_request:
11+
branches:
12+
- develop
13+
- master
14+
15+
env:
16+
IMAGE_NAME: conditional
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
25+
- name: Run tests
26+
run: |
27+
if [ -f docker-compose.test.yml ]; then
28+
docker-compose --file docker-compose.test.yml build
29+
docker-compose --file docker-compose.test.yml run sut
30+
else
31+
docker build . --file Dockerfile
32+
fi

.github/workflows/node-js.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches: [develop, master]
9+
pull_request:
10+
branches: [develop, master]
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [8.x, 10.x]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v1
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
- run: npm install
27+
- run: npm run production

.github/workflows/python-app.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python application
5+
6+
on:
7+
push:
8+
branches: [master, develop]
9+
pull_request:
10+
branches: [master, develop]
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
python-version: [3.8, 3.9]
19+
20+
steps:
21+
- name: Install ldap dependencies
22+
run: sudo apt-get install libldap2-dev libsasl2-dev
23+
- uses: actions/checkout@v2
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32+
- name: Lint with pylint
33+
run: |
34+
pylint conditional

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ __pycache__/
99
# Distribution / packaging
1010
.Python
1111
env/
12+
venv/
1213
build/
1314
develop-eggs/
1415
dist/

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.3.1
1+
10

.pylintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,4 @@ min-public-methods = 2
9090
max-public-methods = 20
9191

9292
[EXCEPTIONS]
93-
overgeneral-exceptions = Exception
93+
overgeneral-exceptions = Exception

.travis.yml

-16
This file was deleted.

Dockerfile

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.6-stretch
1+
FROM docker.io/python:3.8-buster
22
MAINTAINER Devin Matte <[email protected]>
33

44
RUN mkdir /opt/conditional
@@ -8,15 +8,15 @@ ADD requirements.txt /opt/conditional
88
WORKDIR /opt/conditional
99

1010
RUN apt-get -yq update && \
11-
apt-get -yq install libsasl2-dev libldap2-dev libssl-dev && \
11+
apt-get -yq install libsasl2-dev libldap2-dev libssl-dev gcc g++ make && \
1212
pip install -r requirements.txt && \
1313
apt-get -yq clean all
1414

1515
ADD . /opt/conditional
1616

17-
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - && \
17+
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
1818
apt-get -yq update && \
19-
apt-get -yq install nodejs npm && \
19+
apt-get -yq install nodejs && \
2020
npm install && \
2121
npm run production && \
2222
rm -rf node_modules && \

conditional/__init__.py

+3-11
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from flask_gzip import Gzip
99
from flask_pyoidc.flask_pyoidc import OIDCAuthentication
1010
from flask_sqlalchemy import SQLAlchemy
11-
from raven.contrib.flask import Sentry
1211

1312
import sentry_sdk
1413
from sentry_sdk.integrations.flask import FlaskIntegration
@@ -30,10 +29,10 @@
3029
migrate = Migrate(app, db)
3130

3231
# Sentry setup
33-
sentry = Sentry(app)
3432
sentry_sdk.init(
3533
dsn=app.config['SENTRY_DSN'],
36-
integrations=[FlaskIntegration(), SqlalchemyIntegration()]
34+
integrations=[FlaskIntegration(), SqlalchemyIntegration()],
35+
environment=app.config['SENTRY_ENV'],
3736
)
3837

3938
ldap = CSHLDAP(app.config['LDAP_BIND_DN'],
@@ -190,15 +189,8 @@ def route_errors(error, user_dict=None):
190189
return render_template('errors.html',
191190
error=error_desc,
192191
error_code=code,
193-
event_id=g.sentry_event_id,
194-
public_dsn=sentry.client.get_public_dsn('https'),
192+
event_id=sentry_sdk.last_event_id(),
195193
**data), int(code)
196194

197195

198-
@app.cli.command()
199-
def zoo():
200-
from conditional.models.migrate import free_the_zoo
201-
free_the_zoo(app.config['ZOO_DATABASE_URI'])
202-
203-
204196
logger.info('conditional started')

conditional/blueprints/dashboard.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def display_dashboard(user_dict=None):
4444
if ldap_is_intromember(user_dict['account']):
4545
data['freshman'] = get_freshman_data(user_dict['account'].uid)
4646
else:
47-
data['freshman'] = False
47+
data['freshman'] = None
4848

4949
spring = {}
5050
c_meetings = get_cm(user_dict['account'])

conditional/blueprints/housing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def display_housing(user_dict=None):
2727
log.info('Display Housing Board')
2828

2929
housing = {}
30-
onfloors = [account for account in ldap_get_onfloor_members()]
30+
onfloors = ldap_get_onfloor_members()
3131
onfloor_freshmen = FreshmanAccount.query.filter(
3232
FreshmanAccount.room_number is not None
3333
)

conditional/blueprints/intro_evals.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ def get_fid_cm_count(member_id):
3737
FreshmanCommitteeAttendance.fid == member_id)
3838
if CommitteeMeeting.query.filter(CommitteeMeeting.id == a.meeting_id).first().approved])
3939

40-
members = [account for account in ldap_get_intro_members()]
40+
members = ldap_get_intro_members()
4141

4242
ie_members = []
4343

4444
# freshmen who don't have accounts
45-
fids = [f for f in FreshmanAccount.query.filter(
45+
fids = list(FreshmanAccount.query.filter(
4646
FreshmanAccount.eval_date > start_of_year(),
47-
FreshmanAccount.eval_date > datetime.now())]
47+
FreshmanAccount.eval_date > datetime.now()))
4848

4949
for fid in fids:
5050
h_meetings = [m.meeting_id for m in
@@ -104,7 +104,7 @@ def get_fid_cm_count(member_id):
104104

105105
if freshman_data is None:
106106
continue
107-
elif freshman_data.freshman_eval_result != "Pending" and internal:
107+
if freshman_data.freshman_eval_result != "Pending" and internal:
108108
continue
109109

110110
h_meetings = [m.meeting_id for m in get_hm(member, only_absent=True)]

conditional/blueprints/spring_evals.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def display_spring_evals(internal=False, user_dict=None):
2323
log = logger.new(request=request, auth_dict=user_dict)
2424
log.info('Display Membership Evaluations Listing')
2525

26-
active_members = [account for account in ldap_get_active_members()]
26+
active_members = ldap_get_active_members()
2727

2828
sp_members = []
2929
for account in active_members:

0 commit comments

Comments
 (0)