Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions .github/workflows/rootski-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ jobs:
- name: cache dependencies
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
path: |
${{ env.pythonLocation }}
/tmp/.buildx-cache
key: ${{ env.pythonLocation }}-${{ hashFiles('**/aws-cdk/**/setup.py', '**/rootski_api/setup.py')}}

# cache the python environment for faster pre-commit
Expand All @@ -66,6 +68,17 @@ jobs:
# install docker-compose because it is needed to run the tests
make install-docker-compose

- name: Build production image
uses: docker/build-push-action@v2
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: ./rootski_api/tests/ci/Dockerfile
push: false
tags: api_build
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new

- name: checkout trunk and current branches
run: |
# these steps are necessary for darker to compare diffs properly
Expand All @@ -81,7 +94,7 @@ jobs:
# check the code quality across the entire project (formatting, linting, static code checks)
make check-code-quality-ci

# run the backend tests
# run the backend tests, commenting this out so we can have githubactions handle it for us
cd rootski_api
make full-test-ci

Expand Down
1 change: 1 addition & 0 deletions rootski_api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
# return: version of the form ``X.X.X``
# """
# return ".dirty" if version.dirty else ""
# adding comment to trigger cache

if __name__ == "__main__":
setup(
Expand Down
8 changes: 8 additions & 0 deletions rootski_api/tests/ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# The context for this file needs to be path/to/rootski_api
FROM python:3.9.6-slim-buster

RUN apt-get update && apt-get -y install git make
# RUN apt-get -y install git
WORKDIR /usr/src/rootski_api
COPY . .
RUN make install
33 changes: 33 additions & 0 deletions rootski_api/tests/ci/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: "3.9"

services:

rootski:
command: py.test tests/functional_tests/main/endpoints -xv
# command: tail -f /dev/null
image: rootski-api
build:
context: ../.. # rootski_api/
dockerfile: ./tests/ci/Dockerfile
env_file:
- test.env
volumes:
- ../..:/usr/src/rootski_api
depends_on:
postgres:
condition: service_healthy

# (1) this database intentionally has no volumes; the database for tests should be fresh
# (2) we run it on port 8432 to avoid accidentally wiping databases running on 5432
postgres:
image: postgres:9.6
command: "-p 8432"
env_file:
- test.env
ports:
- "8432:8432"
healthcheck:
test: [ "CMD-SHELL", "pg_isready --username test-user --dbname test_db --port 8432" ]
interval: 1s
timeout: 1s
retries: 6