Skip to content

Commit

Permalink
test without break packages
Browse files Browse the repository at this point in the history
TEST TESTS VIA DOCKER
  • Loading branch information
milinsoft committed Apr 27, 2024
1 parent 261f1f3 commit 231a935
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 71 deletions.
23 changes: 0 additions & 23 deletions .github/actions/run_tests.yaml

This file was deleted.

22 changes: 5 additions & 17 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
---
name: Docker build
name: Docker build and tests
on:
push:
branches:
- main
env:
DOCKER_IMAGE_NAME: parseltongist/bank_app
DOCKERFILE_DIRECTORY: ./
jobs:
build:
build-and-run-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build Docker Image
run: |
docker build -t $DOCKER_IMAGE_NAME:latest .
working-directory: ${{ env.DOCKERFILE_DIRECTORY }}
- name: Log in to Docker Hub
if: success()
run: |
echo ${{ secrets.DOCKER_PASSWORD }} |
docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Docker image to the Docker Hub
if: success()
run: |
docker push $DOCKER_IMAGE_NAME:latest
docker build -t test-tag .
working-directory: ${{ env.DOCKERFILE_DIRECTORY }}
- name: TEST VIA DOCKER
run: docker run test-tag
52 changes: 26 additions & 26 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
name: pre-commit
on:
pull_request:
push:
env:
DOCKER_IMAGE_NAME: parseltongist/bank_app
DOCKERFILE_DIRECTORY: ./
jobs:
pre-commit:
name: pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11
- uses: pre-commit/[email protected]
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build Docker Image
run: |
docker build -t $DOCKER_IMAGE_NAME:latest .
working-directory: ${{ env.DOCKERFILE_DIRECTORY }}
#name: pre-commit
#on:
# pull_request:
# push:
#env:
# DOCKER_IMAGE_NAME: parseltongist/bank_app
# DOCKERFILE_DIRECTORY: ./
#jobs:
# pre-commit:
# name: pre-commit
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: 3.11
# - uses: pre-commit/[email protected]
# docker-build:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Build Docker Image
# run: |
# docker build -t $DOCKER_IMAGE_NAME:latest .
# working-directory: ${{ env.DOCKERFILE_DIRECTORY }}
23 changes: 23 additions & 0 deletions .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#---
#name: Run unit tests
#on:
# push:
# branches:
# - "*"
# pull_request:
# branches:
# - "*"
#jobs:
# build:
# runs-on: ubuntu-latest
# steps:
# - name: Set up Python 3.11
# uses: actions/setup-python@v5
# with:
# python-version: 3.11
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Install dependencies
# run: pip install -r requirements.txt
# - name: Run tests
# run: python -m unittest discover
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ WORKDIR /app

RUN set -ex \
&& apk add --update --no-cache git python3 py3-pip \
&& git clone $GIT_REPO_URL $PROJECT_FOLDER -b main --depth=1\
&& python3 -m venv venv \
&& source venv/bin/activate \
&& pip install -r $PROJECT_FOLDER/requirements.txt\
&& git clone $GIT_REPO_URL $PROJECT_FOLDER -b refactor-workflow --depth=1 \
&& python3 -m venv venv \
&& chmod +x ./venv/bin/activate \
&& ./venv/bin/pip install -r $PROJECT_FOLDER/requirements.txt \
&& ln -sf /usr/bin/python3.11 /usr/bin/python \
&& apk del git \
&& rm -rf /var/cache/apk/* /root/.cache $PROJECT_FOLDER/.git

CMD ["python3", "bank_app"]
CMD ["./venv/bin/python", "-m", "unittest", "discover", "bank_app"]
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
SQLAlchemy==2.0.20
tabulate==0.9.0
sqlalchemy

0 comments on commit 231a935

Please sign in to comment.