Skip to content

Commit

Permalink
added: scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorgedavyd committed Jul 10, 2024
1 parent 6fbef5b commit 0c8942b
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 179 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel setuptools pipreqs pip-tools
chmod +x requirements.sh
./requirements.sh
pip install -r requirements.txt
sudo sh ./requirements.sh
- name: Extract tag name
id: extract_tag
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,21 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
- name: Setting up scripts
run: |
python -m pip install --upgrade pip
pip install pytest black pipreqs pip-tools
chmod +x requirements.sh
sh ./requirements.sh
pip install -r requirements.txt
chmod +x ./scripts/*.sh
- name: Installing requirements
run: |
sudo sh ./scripts/requirements.sh
- name: Run tests
run: |
pytest tests/
sudo sh ./scripts/test.sh
- name: Commit to repo
if: matrix.commit == true
run: |
black .
git config --global user.name 'Jorgedavyd'
git config --global user.email 'jorged.encyso@gmail.com'
git diff --exit-code || (git add . && git commit -m "Automatically formatted with black" && git push)
sudo sh ./scripts/autocommit.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 0 additions & 8 deletions requirements.sh

This file was deleted.

156 changes: 0 additions & 156 deletions requirements.txt

This file was deleted.

6 changes: 6 additions & 0 deletions scripts/autocommit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
black .
git config --global user.name 'Jorgedavyd'
git config --global user.email 'jorged.encyso@gmail.com'
git diff --exit-code || (git add . && git commit -m "Automatically formatted with black" && git push)

9 changes: 9 additions & 0 deletions scripts/requirements.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
python3 -m pip install --upgrade pip
pip3 install pytest black pipreqs pip-tools
pipreqs lightorch --savepath=./requirements.in
sed -i 's/==.*$//' requirements.in
sort requirements.in | uniq > requirements_unique.in
pip-compile ./requirements_unique.in
rm -f *.in
pip install -r requirements_unique.txt
4 changes: 4 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
pytest tests/
find . -type d -name "__pycache__" -exec rm -rf {} +

0 comments on commit 0c8942b

Please sign in to comment.