Skip to content

Commit

Permalink
Merge branch 'main' into feature/handling-txt
Browse files Browse the repository at this point in the history
  • Loading branch information
yesinkim authored Sep 18, 2024
2 parents 1df149c + 2ced12f commit ee058d9
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Publish Python 🐍 distributions 📦 to PyPI

on:
push:
tags:
- '*'
release:
types: [created]

jobs:
pypi-publish:
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Run test and Tag version

on:
pull_request:
branches:
- main

jobs:
test:
name: Run tests🏃
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest
- name: Run tests
run: |
python -m pytest
tag:
name: Tag version🔖
runs-on: ubuntu-latest
needs: test
if: ${{ success() }}
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Get version
id: get_version
run: |
VERSION=$(grep -oP '(?<=__version__ = ")[^"]*' ezpkl/__init__.py)
echo "::set-output name=VERSION::$VERSION"
echo "Current version: $VERSION"
- name: Create tag
run: |
git config --global user.name 'yesinkim'
git config --global user.email '[email protected]'
git tag -a v${{ steps.get_version.outputs.VERSION }} -m "Release version ${{ steps.get_version.outputs.VERSION }}"
git push origin v${{ steps.get_version.outputs.VERSION }}
13 changes: 13 additions & 0 deletions tests/test_ezpkl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest

from ezpkl import save_pkl, load_pkl

def test_save_pkl():
data = [1, 2, 3, (4), 5]
save_pkl(data)
assert load_pkl("data.pkl") == data

def test_save_pkl_with_filename():
data = [1, 2, 3, 4, 5]
save_pkl(data, file_name="test_data")
assert load_pkl("test_data.pkl") == data

0 comments on commit ee058d9

Please sign in to comment.