Skip to content

Commit

Permalink
chore(test_and_publish.yml): Add publish step
Browse files Browse the repository at this point in the history
  • Loading branch information
Rizhiy committed Dec 18, 2023
1 parent e5050b5 commit d8f263b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Tests
name: Test and Publish

on:
push:
Expand All @@ -10,17 +10,18 @@ on:
branches: [ "master" ]

jobs:
check-format:
check-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -e ".[dev]"
- name: Check with ruff
- name: Check style with ruff
run: |
ruff check .
test:
runs-on: ubuntu-latest
strategy:
Expand All @@ -41,3 +42,21 @@ jobs:
- name: Test with pytest
run: |
pytest .
publish:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: [check-format, test]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install flit
- name: Publish with flit
run: |
flit publish
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ Library to define configurations using python files.
## Installation
Recommended installation with pip:
```bash
pip install cfg
pip install rizhiy-cfg
```

### Usage
1) Define config schema:

```python
# project/config.py
from cfg import CL, CN
from rizhiy_cfg import CL, CN

class BaseClass:
pass
Expand Down Expand Up @@ -52,7 +52,7 @@ cfg.add_hook(hook)
2) Set actual values for each leaf in the config, **the import has to be absolute**:
```python
# my_cfg.py
from cfg import CN
from rizhiy_cfg import CN

from project.config import cfg # Import has to be absolute

Expand Down Expand Up @@ -82,7 +82,7 @@ There a few restrictions on imports in configs:
3) Load actual config and use it in the code.
```python
# main.py
from ntc import CN
from rizhiy_cfg import CN

cfg = CN.load("my_cfg.py")
# Access values as attributes
Expand Down

0 comments on commit d8f263b

Please sign in to comment.