Skip to content

Commit

Permalink
Fix issues with Github pages action to publish docs (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkanche authored Dec 10, 2024
1 parent 98e536e commit fb83f67
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest tox
pip install tox
- name: Setup git creds
run: |
git config --global user.email "gituser@biocpy"
git config --global user.name "Biocpy test user"
git config --global user.name jkanche
git config --global user.email [email protected]
- name: Test with tox
run: |
Expand All @@ -37,7 +37,7 @@ jobs:
- run: touch ./docs/_build/html/.nojekyll

- name: GH Pages Deployment
uses: JamesIves/github-pages-deploy-action@4.1.3
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: ./docs/_build/html
Expand All @@ -48,7 +48,7 @@ jobs:
python -m tox -e clean,build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
uses: pypa/gh-action-pypi-publish@v1.12.2
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
2 changes: 1 addition & 1 deletion .github/workflows/pypi-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest tox
pip install tox
- name: Test with tox
run: |
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
- Furo theme
- Type hints documentation
- Adds Ruff configuration for consistent code formatting
- Creates standardized README with PyPI and CI badges
- Creates standardized README with PyPI and CI badges
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
Setup file for biocsetup.
Use setup.cfg to configure your project.
Setup file for biocsetup.
Use setup.cfg to configure your project.
This file was generated with PyScaffold 4.6.
PyScaffold helps you to put up the scaffold of your new Python project.
Learn more under: https://pyscaffold.org/
This file was generated with PyScaffold 4.6.
PyScaffold helps you to put up the scaffold of your new Python project.
Learn more under: https://pyscaffold.org/
"""

from setuptools import setup
Expand Down
2 changes: 1 addition & 1 deletion src/biocsetup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
finally:
del version, PackageNotFoundError

from .create_repository import create_repository
from .create_repository import create_repository
4 changes: 2 additions & 2 deletions src/biocsetup/templates/github_workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- run: touch ./docs/_build/html/.nojekyll

- name: GH Pages Deployment
uses: JamesIves/github-pages-deploy-action@4.1.3
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: ./docs/_build/html
Expand All @@ -46,7 +46,7 @@ jobs:
python -m tox -e clean,build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
uses: pypa/gh-action-pypi-publish@v1.12.2
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
12 changes: 6 additions & 6 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_cli_basic():
with runner.isolated_filesystem():
result = runner.invoke(main, ["test-project"])
assert result.exit_code == 0

# Check if project was created
assert os.path.exists("test-project")
assert os.path.exists(os.path.join("test-project", "src"))
Expand All @@ -29,23 +29,23 @@ def test_cli_with_options():
runner = CliRunner()
with runner.isolated_filesystem():
result = runner.invoke(
main,
main,
[
"test-project",
"--description", "Test project description",
"--license", "BSD",
]
)
assert result.exit_code == 0

# Check if project was created
project_dir = Path("test-project")
assert project_dir.exists()

# Check if description was added to README
readme_content = (project_dir / "README.md").read_text()
assert "Test project description" in readme_content

# Check if license was set correctly
setup_cfg = (project_dir / "setup.cfg").read_text()
assert "BSD" in setup_cfg
Expand All @@ -57,7 +57,7 @@ def test_cli_invalid_path():
# Create a file that will conflict with the project path
with open("existing-file", "w") as f:
f.write("test")

result = runner.invoke(main, ["existing-file"])
assert result.exit_code != 0

Expand Down
2 changes: 1 addition & 1 deletion tests/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ def test_create_repository_with_license(temp_dir):
setup_cfg = Path(project_path) / "setup.cfg"
with open(setup_cfg, "r") as f:
content = f.read()
assert license in content
assert license in content

0 comments on commit fb83f67

Please sign in to comment.