Skip to content

Commit

Permalink
Added CI workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
hari0205 committed Jul 5, 2024
1 parent 3beefbf commit 6b12465
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 2 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: "Porunga-CI"

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint_build_publish:
runs-on: ubuntu-latest

steps:
- name: "Checkout Code"
uses: actions/checkout@v3

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

- name: Cache Poetry
id: cache-poetry
uses: actions/cache@v2
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}

- name: "Install Poetry"
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo 'export PATH="$HOME/.local/bin:$PATH"' >> $GITHUB_ENV
- name: Cache dependencies
id: cache-dependencies
if: steps.cache-poetry.outputs.cache-hit != 'true'
uses: actions/cache@v2
with:
path: ~/.cache/pypoetry/cache
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}-cache
restore-keys: |
${{ runner.os }}-poetry-
- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
export PATH="$HOME/.local/bin:$PATH"
poetry install
- name: Run linting
run: |
export PATH="$HOME/.local/bin:$PATH"
poetry run make lint
- name: Build file
run: |
export PATH="$HOME/.local/bin:$PATH"
poetry run make build
- name: Config poetry for PyPi
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_token }}
- name: Publish
run: |
export PATH="$HOME/.local/bin:$PATH"
poetry run make publish
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# For Linting
.PHONY: lint
lint:
@echo "Running flake8 linter"
@flake8 porunga/
@echo "Running flake8"
@flake8 ./porunga

# Clean pyc and pycache
.PHONY: clean
Expand All @@ -11,6 +11,17 @@ clean:
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -exec rm -r {} +

# For building
.PHONY: build
build:
@echo "Building package"
@poetry build

# For publishing
.PHONY: publish
publish:
@echo "Publishing package"
@poetry publish
# Define a help target to show usage
.PHONY: help
help:
Expand Down

0 comments on commit 6b12465

Please sign in to comment.