Skip to content

Commit 6a06bd2

Browse files
committed
Added postman tests
1 parent 5e2269d commit 6a06bd2

File tree

2 files changed

+23
-38
lines changed

2 files changed

+23
-38
lines changed

.travis.yml

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,31 @@ install: pip install -r backend/requirements.txt
1515

1616
jobs:
1717
include:
18-
# - stage: build
19-
# script: make build
18+
- stage: build
19+
script:
20+
# login to github registry
21+
- echo $DEPLOY_PERSONAL_TOKEN | docker login ghcr.io --username seluj78 --password-stdin
22+
# build image
23+
- docker build -t PyMatchaAPI .
24+
# push image
25+
- docker push PyMatchaAPI
26+
- stage: test
27+
script:
28+
# login to github registry
29+
- echo $DOCKER_TRAVIS_PERSONAL_TOKEN | docker login ghcr.io --username seluj78 --password-stdin
30+
# pull images
31+
- docker pull PyMatchaAPI
32+
# run docker on port 80
33+
# do not forget to add env-file an environment file in Settings/CI CD/Variables
34+
- docker run -d -p 5000:5000 --restart always PyMatchaAPI
35+
# run newman tests
36+
- newman run --color on 'PyMatcha.postman_collection.json'
37+
after_script:
38+
# stop and remove docker to prevent them from block port at next iteration/test
39+
- docker stop $(docker ps -a -q)
40+
- docker rm $(docker ps -a -q)
2041
- stage: lint
2142
script: black --check backend
22-
# script: make lint
23-
# - stage: tests
24-
# before_script:
25-
# - wget https://repo.mysql.com//mysql-apt-config_0.8.14-1_all.deb
26-
# - sudo dpkg -i mysql-apt-config_0.8.14-1_all.deb
27-
# - sudo apt-get update -q
28-
# - sudo apt-get install -q -y --allow-unauthenticated -o Dpkg::Options::=--force-confnew mysql-server
29-
# - sudo systemctl restart mysql
30-
# - sudo mysql_upgrade
31-
# - mysql --version
32-
# - mysql -e 'CREATE DATABASE pymatcha;'
33-
# - npm install newman
34-
# - node_modules/.bin/newman --version
35-
# - python backend/app.py &
36-
# - sleep 5
37-
# script: node_modules/.bin/newman run --delay-request 20 --color on --verbose PyMatcha.postman_collection.json
38-
# - stage: deploy
39-
# script: ./deploy
4043

4144
notifications:
4245
email:
@@ -45,12 +48,3 @@ notifications:
4548
- gmorer@student.42.fr
4649
on_success: change
4750
on_failure: always
48-
49-
50-
#deploy:
51-
# provider: heroku
52-
# api_key:
53-
# secure: kUtYCOzPTUlcJ8nicEynPq39xfVgUtl8LT2zdh/L1MQ6SRKYKT6V+TWSuGNXc9YRn7Sd6dVqYDimz3aK7eQrdBehZxuHy1FvL9qzdWsGeefrFDD5VKf5qyRFmX1+nSir/5WBsGRUhlcPiqMo2WvRWrrARiM+kscULJCpxUJ/rqk2XSxKY+UikWpKgmcgK8ONBdrmK0+ixEqwOHHLU/WfBPHOAdmZM7V3DIeWq75dYee7rfFSejHsUzm8nsMszy5kgsFWj82daYqUTWOVe92v/E5bwGHhqmX2qjXO9d5qm3dVwg7L7gUHB2cUL3sp5EXiH9OdmZhE+QHob155ApkwMqYJo5L7U7/4Az7i/6oiTOfbnUCyCK2g9D0Qng6T4OwlsfH1l182V5I4fWIN94sQuEhh2W+Auu5EjhmsSMwCdYYuI6K5V4ht2aCLVlQ5jdfG8rt78kjsrjLlw8Vu2aprkM1JrTiUFGr5legrAX40BpozOFl913waRScJc65BsBnVkrFeTrmlmWIXe63Gc4LKXc8XaAqVLl3cyhIIyQ4Q0km5UH8/nraKDzw0I0sLLmk2AXBDEnNHDt2E1QmacsfaX+XE2URT74YVBRmxRdpJv6vJsvZEtXpRMHrzf4DK4coS1q5rkHnUXpajf65tB//isrQkbtENnjFZ1EP0zE9OJwY=
54-
# app: pymatcha
55-
# on:
56-
# repo: Seluj78/PyMatcha

Dockerfile

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
1-
FROM node:14.3-alpine3.10 AS frontend
2-
WORKDIR /src
3-
ADD frontend .
4-
RUN npm i
5-
ADD .env .
6-
RUN export $(cat .env | xargs)
7-
RUN npm run build
8-
91
FROM python:3.8.3-buster
102
WORKDIR /www
113
ADD backend/requirements.txt .
124
ADD .env .
135
RUN export $(cat .env | xargs)
146
RUN pip install -r requirements.txt
157
ADD backend .
16-
COPY --from=frontend /src/build frontend
178
ENV PYTHONDONTWRITEBYTECODE 1
189
ENV IS_DOCKER_COMPOSE true
1910
EXPOSE 5000

0 commit comments

Comments
 (0)