From fb83f670b13164406ea81dcfbf0928c818458397 Mon Sep 17 00:00:00 2001 From: Jayaram Kancherla Date: Tue, 10 Dec 2024 12:44:05 -0800 Subject: [PATCH] Fix issues with Github pages action to publish docs (#2) --- .github/workflows/pypi-publish.yml | 10 +++++----- .github/workflows/pypi-test.yml | 2 +- CHANGELOG.md | 2 +- setup.py | 10 +++++----- src/biocsetup/__init__.py | 2 +- .../templates/github_workflows/pypi-publish.yml | 4 ++-- tests/test_cli.py | 12 ++++++------ tests/test_create.py | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 090c3f6..5f5767c 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -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 jayaram.kancherla@gmail.com - name: Test with tox run: | @@ -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 @@ -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 }} diff --git a/.github/workflows/pypi-test.yml b/.github/workflows/pypi-test.yml index fbde7a6..f2887d5 100644 --- a/.github/workflows/pypi-test.yml +++ b/.github/workflows/pypi-test.yml @@ -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: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 711bc18..ebf2170 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,4 +10,4 @@ - Furo theme - Type hints documentation - Adds Ruff configuration for consistent code formatting -- Creates standardized README with PyPI and CI badges \ No newline at end of file +- Creates standardized README with PyPI and CI badges diff --git a/setup.py b/setup.py index 9fab6ea..1171e77 100644 --- a/setup.py +++ b/setup.py @@ -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 diff --git a/src/biocsetup/__init__.py b/src/biocsetup/__init__.py index c24532d..1eaf84a 100644 --- a/src/biocsetup/__init__.py +++ b/src/biocsetup/__init__.py @@ -15,4 +15,4 @@ finally: del version, PackageNotFoundError -from .create_repository import create_repository \ No newline at end of file +from .create_repository import create_repository diff --git a/src/biocsetup/templates/github_workflows/pypi-publish.yml b/src/biocsetup/templates/github_workflows/pypi-publish.yml index 995e5e6..72a5681 100644 --- a/src/biocsetup/templates/github_workflows/pypi-publish.yml +++ b/src/biocsetup/templates/github_workflows/pypi-publish.yml @@ -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 @@ -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 }} diff --git a/tests/test_cli.py b/tests/test_cli.py index 773c3c2..58bc6d7 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -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")) @@ -29,7 +29,7 @@ def test_cli_with_options(): runner = CliRunner() with runner.isolated_filesystem(): result = runner.invoke( - main, + main, [ "test-project", "--description", "Test project description", @@ -37,15 +37,15 @@ def test_cli_with_options(): ] ) 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 @@ -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 diff --git a/tests/test_create.py b/tests/test_create.py index 20facaa..2715425 100644 --- a/tests/test_create.py +++ b/tests/test_create.py @@ -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 \ No newline at end of file + assert license in content