Skip to content

Commit

Permalink
Last passed state
Browse files Browse the repository at this point in the history
  • Loading branch information
michplunkett committed Dec 29, 2023
1 parent 177e930 commit 27fbb84
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/test_prs.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
name: CI

# Controls when the action will run.
on:
pull_request:
branches:
- develop
- main

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
env:
FLASK_APP: OpenOversight.app
strategy:
matrix:
python-version: ["3.11", "3.12"]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Run tests
run: PYTHON_VERSION=${{ matrix.python-version }} make test_with_version
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build_with_version: create_empty_secret

.PHONY: test_with_version
test_with_version: build_with_version assets
docker-compose run --rm web-test pytest --cov=OpenOversight --cov-report xml:OpenOversight/tests/coverage.xml --doctest-modules -n 4 --dist=loadfile -v OpenOversight/tests/
ENV=testing docker-compose run --rm web pytest --cov=OpenOversight --cov-report xml:OpenOversight/tests/coverage.xml --doctest-modules -n 4 --dist=loadfile -v OpenOversight/tests/

.PHONY: start
start: build ## Run containers
Expand Down Expand Up @@ -48,9 +48,9 @@ populate: create_db ## Build and run containers
.PHONY: test
test: start ## Run tests
if [ -z "$(name)" ]; then \
docker-compose run --rm web-test pytest --cov --doctest-modules -n auto --dist=loadfile -v OpenOversight/tests/; \
ENV=testing docker-compose run --rm web-test pytest --cov --doctest-modules -n auto --dist=loadfile -v OpenOversight/tests/; \
else \
docker-compose run --rm web-test pytest --cov --doctest-modules -v OpenOversight/tests/ -k $(name); \
ENV=testing docker-compose run --rm web-test pytest --cov --doctest-modules -v OpenOversight/tests/ -k $(name); \
fi

.PHONY: lint
Expand Down
19 changes: 17 additions & 2 deletions dockerfiles/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ENV DEBIAN-FRONTEND noninteractive
ENV DISPLAY=:1

# install apt dependencies
RUN apt-get update && apt-get install -y xvfb libpq-dev python3-dev \
RUN apt-get update && apt-get install -y xvfb firefox-esr libpq-dev python3-dev \
&& apt-get clean

# install node
Expand All @@ -21,6 +21,16 @@ RUN echo "${NODE_SETUP_SHA} setup_12.x" | sha256sum --check -
RUN bash setup_12.x
RUN apt-get install -y nodejs

# install geckodriver
ENV GECKODRIVER_VERSION="v0.26.0"
ENV GECKODRIVER_SHA=d59ca434d8e41ec1e30dd7707b0c95171dd6d16056fb6db9c978449ad8b93cc0
ENV GECKODRIVER_BASE_URL="https://github.com/mozilla/geckodriver/releases/download"
RUN curl ${CURL_FLAGS} \
${GECKODRIVER_BASE_URL}/${GECKODRIVER_VERSION}/geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz
RUN echo "${GECKODRIVER_SHA} geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz" | sha256sum --check -
RUN mkdir geckodriver
RUN tar -xzf geckodriver-${GECKODRIVER_VERSION}-linux64.tar.gz -C geckodriver

# install yarn
RUN npm install -g yarn
RUN mkdir /var/www ./node_modules /.cache /.yarn /.mozilla
Expand All @@ -29,14 +39,19 @@ COPY yarn.lock /usr/src/app/
RUN chmod -R 777 /usr/src/app/ /var/lib/xkb /.cache /.yarn /.mozilla


COPY requirements.txt /usr/src/app/
COPY requirements.txt dev-requirements.txt /usr/src/app/
RUN pip3 install --no-cache-dir -r requirements.txt

RUN test "${DOCKER_BUILD_ENV}" = production || pip3 install --no-cache-dir -r dev-requirements.txt

COPY package.json /usr/src/app/
RUN yarn

COPY test_data.py /usr/src/app/
COPY mypy.ini /usr/src/app/
EXPOSE 3000

ENV PATH="/usr/src/app/geckodriver:${PATH}"
ENV SECRET_KEY 4Q6ZaQQdiqtmvZaxP1If
ENV SQLALCHEMY_DATABASE_URI postgresql://openoversight:terriblepassword@postgres/openoversight-dev

Expand Down

0 comments on commit 27fbb84

Please sign in to comment.