Skip to content

Commit

Permalink
Merge pull request #3 from TogetherCrew/feature/10-create-a-python-se…
Browse files Browse the repository at this point in the history
…rvice-template-repository

Github action
  • Loading branch information
cyri113 authored Jul 20, 2023
2 parents c6ccd73 + c03f764 commit aa64a3f
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 8 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Production CI/CD Pipeline

on:
push:
branches:
- main

jobs:
ci:
uses: TogetherCrew/operations/.github/workflows/ci.yml@main
secrets:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
9 changes: 9 additions & 0 deletions .github/workflows/start.staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Staging CI/CD Pipeline

on: pull_request

jobs:
ci:
uses: TogetherCrew/operations/.github/workflows/ci.yml@main
secrets:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
FROM python:3.10-alpine AS base
# It's recommended that we use `bullseye` for Python (alpine isn't suitable as it conflcts with numpy)
FROM python:3.10-bullseye AS base
WORKDIR /project
COPY . .
RUN pip3 install -r requirements.txt

FROM base AS test
CMD ["python3", "-m", "coverage", "run" ,"-m", "pytest", "tests"]
RUN python3 -m coverage run -m pytest tests
CMD ["python3", "-m", "coverage", "lcov" ,"-o", "coverage/lcov.info"]

FROM base AS prod-server
FROM base AS prod
CMD ["python3", "server.py"]

FROM base as prod-worker
CMD ["python3", "worker.py"]
14 changes: 14 additions & 0 deletions docker-compose.example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "3.9"

services:
server:
build:
context: .
target: prod
dockerfile: Dockerfile
worker:
build:
context: .
target: prod
dockerfile: Dockerfile
command: python3 worker.py
2 changes: 0 additions & 2 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ services:
context: .
target: test
dockerfile: Dockerfile
env_file:
- .env
environment:
- PORT=3000
- MONGODB_HOST=mongo
Expand Down
18 changes: 18 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
attrs==22.2.0
dnspython==2.2.1
exceptiongroup==1.1.0
iniconfig==2.0.0
numpy==1.25.1
packaging==23.0
pluggy==1.0.0
pymongo==4.3.3
pytest==7.2.0
python-dateutil==2.8.2
pytz==2022.7.1
python-dotenv==0.21.1
six==1.16.0
tomli==2.0.1
pandas==2.0.3
coverage==7.2.7
networkx
neo4j
Empty file added tests/__init__.py
Empty file.
2 changes: 2 additions & 0 deletions tests/test_sample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_sample():
assert 3 != 5

0 comments on commit aa64a3f

Please sign in to comment.