Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8db4af5
Enhance error handling, update dependencies, and implement CI/CD work…
Sep 9, 2025
8d1450f
Enhance GitHub Actions workflow to auto-format code with Black and co…
Sep 9, 2025
efee035
Refactor GitHub Actions workflow to simplify auto-formatting commit m…
Sep 9, 2025
28dbb62
Improve GitHub Actions workflow to conditionally commit formatted cod…
Sep 9, 2025
7c0979c
Add permissions and token configuration for test job in GitHub Action…
Sep 9, 2025
5d9f78b
Merge 7c0979cd127daf2c9621ed4367433a999372dbd2 into 36c59fe59aff9ed9a…
SoundsSerious Sep 9, 2025
7c6a4ea
Auto-format code with Black
actions-user Sep 9, 2025
3903090
Update Python version matrix in GitHub Actions workflows for consistency
Sep 9, 2025
2f890c6
Merge branch 'test' of https://github.com/Ottermatics/dropbox-ignore-…
Sep 9, 2025
9cd8492
Fix path resolution in wildcard tests for cross-platform compatibility
Sep 9, 2025
de38f48
Add Linux ignore functionality check for attr command availability
Sep 9, 2025
f3c9876
Merge de38f48b320ebf3085b6529f8e1423fa5daf51eb into 36c59fe59aff9ed9a…
SoundsSerious Sep 9, 2025
2e9b156
Auto-format code with Black
actions-user Sep 9, 2025
7e96214
Update attr command path in conflict detection test for consistency
Sep 9, 2025
15e2c56
Merge branch 'test' of https://github.com/Ottermatics/dropbox-ignore-…
Sep 9, 2025
d240289
Refactor Black formatting check in CI workflow to provide warning ins…
Sep 9, 2025
b4c179d
Update integration-test job to exclude ubuntu-latest due to missing `…
Sep 9, 2025
16fb029
Fix wildcard test command to handle paths with quotes
Sep 9, 2025
f2bebc2
Revert "Fix wildcard test command to handle paths with quotes"
Sep 9, 2025
af94621
Refactor integration test job to create platform-specific test direct…
Sep 9, 2025
7d8a6f2
Add directory creation for integration tests on Windows
Sep 9, 2025
fa4f72a
Update test commands to use Python script for execution and remove cl…
Sep 11, 2025
28770c8
Update test commands to use module syntax for Python execution
Sep 11, 2025
5b20294
Add Unblock Feature
Sep 11, 2025
3c0d2e3
Auto-format code with Black
actions-user Sep 11, 2025
5e5a4b3
Remove macOS-specific test for file provider path in TestDropblockPla…
Sep 11, 2025
385faea
Refactor constructor and argument parsing for improved readability
Sep 11, 2025
c9a1a4f
Merge branch 'test' of https://github.com/Ottermatics/dropbox-ignore-…
Sep 11, 2025
fb033d4
Fix argument assertion in test for dropbox ignore command
Sep 11, 2025
60d5e30
Fix argument order in test for dropbox ignore command
Sep 11, 2025
73bf630
Fix argument order in test for cross-platform ignore command
Sep 11, 2025
5816076
Add detailed output for subprocess commands in ignore methods
Sep 11, 2025
9e7a962
Auto-format code with Black
actions-user Sep 11, 2025
aa4d094
Remove obsolete unit tests for dropblock CLI tool
Sep 11, 2025
0b9bec8
Merge branch 'test' of https://github.com/Ottermatics/dropbox-ignore-…
Sep 11, 2025
73d25d0
Remove test job from publish workflow and adjust push triggers
Sep 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
181 changes: 181 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
name: Build and Test

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]

jobs:
check-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check if version needs updating
run: |
# Check if Python or TOML files have changed
if git diff --name-only HEAD^ HEAD | grep -E '\.(py|toml)$'; then
echo "Python or TOML files have changed"

# Extract version from pyproject.toml
VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
echo "Current version: $VERSION"

# Check if a release with this version already exists
if git tag | grep -q "^v$VERSION$"; then
echo "::error::Version $VERSION already exists as a release. Please update the version in pyproject.toml"
exit 1
fi
fi

format-check:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install Black
run: |
python -m pip install --upgrade pip
pip install black

- name: Check formatting with Black
id: black_check
continue-on-error: true
run: |
black --check dropblock.py test/

- name: Format code with Black and commit (if needed)
if: steps.black_check.outcome == 'failure' && github.event_name == 'pull_request'
run: |
black dropblock.py test/
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
if git diff --staged --quiet; then
echo "No changes to commit after formatting"
else
git commit -m "Auto-format code with Black"
# Pull any changes that might have been pushed by other jobs
git pull origin ${{ github.head_ref }} --rebase
git push origin HEAD:${{ github.head_ref }}
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test:
needs: [check-version, format-check]
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [ '3.9', '3.10', '3.11', '3.12']

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev,test]"

- name: Run tests
run: |
python -m pytest test/ -v

- name: Upload coverage reports
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml, if
flags: unittests
name: codecov-umbrella

integration-test:
needs: test
strategy:
matrix:
os: [windows-latest, macos-latest]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install package
run: |
python -m pip install --upgrade pip
pip install -e .

- name: Test CLI installation
run: |
dropblock --help

- name: Create test directory structure (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path test_dropbox_ignore
New-Item -ItemType Directory -Force -Path test_dropbox_ignore\folder1
New-Item -ItemType Directory -Force -Path test_dropbox_ignore\folder2
"test" | Out-File -FilePath test_dropbox_ignore\file1.txt
"test" | Out-File -FilePath test_dropbox_ignore\folder1\file2.txt
"test" | Out-File -FilePath test_dropbox_ignore\folder2\file3.txt

- name: Create test directory structure (macOS)
if: runner.os == 'macOS'
run: |
mkdir -p test_dropbox_ignore/folder1
mkdir -p test_dropbox_ignore/folder2
echo "test" > test_dropbox_ignore/file1.txt
echo "test" > test_dropbox_ignore/folder1/file2.txt
echo "test" > test_dropbox_ignore/folder2/file3.txt

- name: Test basic ignore functionality (Windows)
if: runner.os == 'Windows'
run: |
python -m dropblock test_dropbox_ignore\file1.txt --no-output

- name: Test basic ignore functionality (macOS)
if: runner.os == 'macOS'
run: |
dropblock test_dropbox_ignore/file1.txt --no-output

- name: Test wildcard functionality (Windows)
if: runner.os == 'Windows'
run: |
# Let dropblock handle the wildcard expansion
python -m dropblock test_dropbox_ignore\folder*\* --no-output

- name: Test wildcard functionality (macOS)
if: runner.os == 'macOS'
run: |
for file in test_dropbox_ignore/folder*/*; do
dropblock "$file" --no-output
done
153 changes: 153 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: Publish to PyPI and Create Release

on:
workflow_dispatch:
push:
[main]

jobs:
check-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get version from pyproject.toml
id: get_version
run: |
VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"

- name: Check if version already released
run: |
VERSION=${{ steps.get_version.outputs.version }}

# Check if Python or TOML files have changed
if git diff --name-only HEAD^ HEAD 2>/dev/null | grep -E '\.(py|toml)$' || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "Python or TOML files have changed or manual trigger"

# Check if a release with this version already exists
if git tag | grep -q "^v$VERSION$"; then
echo "::error::Version $VERSION already exists as a release. Please update the version in pyproject.toml"
exit 1
fi
fi

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: |
python -m build

- name: Check package
run: |
twine check dist/*

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/

publish-pypi:
needs: [build, check-version]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/dropblock/
permissions:
id-token: write

steps:
- uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
print-hash: true

create-release:
needs: [publish-pypi, check-version]
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist/

- name: Create Release Notes
id: release_notes
run: |
VERSION=${{ needs.check-version.outputs.version }}
echo "# Release v$VERSION" > release_notes.md
echo "" >> release_notes.md
echo "## Changes" >> release_notes.md
echo "" >> release_notes.md

# Get commit messages since last tag
if git describe --tags --abbrev=0 HEAD^ 2>/dev/null; then
LAST_TAG=$(git describe --tags --abbrev=0 HEAD^)
git log --pretty=format:"- %s" $LAST_TAG..HEAD >> release_notes.md
else
git log --pretty=format:"- %s" >> release_notes.md
fi

echo "" >> release_notes.md
echo "" >> release_notes.md
echo "## Installation" >> release_notes.md
echo "" >> release_notes.md
echo '```bash' >> release_notes.md
echo "pip install dropblock==$VERSION" >> release_notes.md
echo '```' >> release_notes.md

echo "" >> release_notes.md
echo "## Platform Support" >> release_notes.md
echo "" >> release_notes.md
echo "- ✅ Windows" >> release_notes.md
echo "- ✅ macOS" >> release_notes.md
echo "- ✅ Linux" >> release_notes.md

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.check-version.outputs.version }}
name: Release v${{ needs.check-version.outputs.version }}
body_path: release_notes.md
files: |
dist/*.whl
dist/*.tar.gz
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading