Skip to content

Commit

Permalink
Add poetry dependency instalation for ci build testing pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
dotpep committed Feb 29, 2024
1 parent 68c984f commit 4b641cb
Showing 1 changed file with 39 additions and 10 deletions.
49 changes: 39 additions & 10 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build and Deploy Code
on: [push, pull_request]

jobs:
build:
build-ci:
environment:
name: testing
env:
Expand Down Expand Up @@ -40,15 +40,43 @@ jobs:
with:
python-version: '3.10'

- name: Update pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: pip install -r requirements.txt
#- name: Update pip
# run: python -m pip install --upgrade pip
#- name: Install dependencies
# run: pip install -r requirements.txt

- name: Run tests with PyTest
#- name: Run tests with PyTest
# run: |
# pip install pytest
# pytest -v

#- name: Install Poetry version 1.7.1
# uses: abatilo/actions-poetry@v2
# with:
# poetry-version: '1.7.1'
#- name: View poetry --help
# run: poetry --help
#- name: Run poetry install
# run: poetry install

- name: Install Poetry version 1.7.1
uses: abatilo/actions-poetry@v2
with:
poetry-version: '1.7.1'
- name: Setup a local virtual environment (if no poetry.toml file)
run: |
pip install pytest
pytest -v
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v3
name: Define a cache for the virtual environment based on the dependencies lock file
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
run: poetry install
- name: Run the automated tests with PyTest
run: poetry run pytest -v


#- name: Login to Docker Hub
# uses: docker/login-action@v3
Expand All @@ -69,11 +97,11 @@ jobs:
#- name: Image digest
# run: echo ${{ steps.docker_build.outputs.digest }}

deploy:
deploy-cd:
environment:
name: production
runs-on: ubuntu-20.04
needs: build
needs: build-ci
steps:
- name: Checkout Pulling Git Repo
uses: actions/checkout@v4
Expand All @@ -87,6 +115,7 @@ jobs:
script: |
cd api/src
git pull
poetry install
echo ${{ secrets.PROD_PASSWORD }} | sudo -S systemctl restart api
# login to our vps ubuntu server with ssh
# cd api/src
Expand Down

0 comments on commit 4b641cb

Please sign in to comment.