Skip to content

Commit

Permalink
solved: ci cd
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorgedavyd committed Jul 8, 2024
1 parent 7a60edd commit 3a3af4d
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 24 deletions.
30 changes: 27 additions & 3 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,35 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'


- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel setuptools
pip install wheel setuptools pipreqs pip-tools
chmod +x requirements.sh
./requirements.sh
pip install -r requirements.txt
- name: Extract tag name
id: extract_tag
run: echo "TAG_NAME=$(echo $GITHUB_REF | cut -d/ -f3)" >> $GITHUB_ENV

- name: Update version
- name: Update version in setup.py and corkit/_version.py
run: |
sed -i "s/{{VERSION_PLACEHOLDER}}/${{ env.TAG_NAME }}/g" corkit/_version.py
Expand All @@ -43,3 +56,14 @@ jobs:

- name: Clean up
run: rm -rf build dist *.egg-info

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
release_name: ${{ env.TAG_NAME }}
draft: false
prerelease: false
32 changes: 20 additions & 12 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@ jobs:

strategy:
matrix:
python-version: [3.8, 3.9, 3.11, 3.12]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
include:
- python-version: '3.12'
commit: false
- python-version: '3.8'
commit: false
- python-version: '3.9'
commit: false
- python-version: '3.11'
commit: false
- python-version: '3.10'
commit: true

steps:
- name: Checkout repository
Expand All @@ -23,27 +34,24 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Set up dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pipreqs pip-tools
pip install pytest black pipreqs pip-tools
chmod +x requirements.sh
sh ./requirements.sh
- name: Install dependencies
run: |
pip install pytest black
pip install -r requirements.txt
- name: Run black
- name: Run tests
run: |
pytest tests/test.py
- 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)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run tests
run: |
pytest tests/
10 changes: 1 addition & 9 deletions requirements.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
#!/bin/bash

# Remove existing requirements.txt if it exists
rm -f requirements.txt

# Generate requirements.in from the lightorch directory
pipreqs corkit/ --savepath=requirements.in

# Compile requirements.in to requirements.txt
pip-compile requirements.in

# Clean up
rm -f requirements.in
rm -f requirements.in
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a

0 comments on commit 3a3af4d

Please sign in to comment.