-
Notifications
You must be signed in to change notification settings - Fork 0
Standardize project workflows and testing #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b9a5ca7
Standardize project with workflows and testing
oscarvalenzuelab 282ef1d
Fix test configuration and add proper test files
oscarvalenzuelab 658989b
Simplify test matrix to Python 3.13+ on Linux/macOS
oscarvalenzuelab 37cbe52
Add required permissions to workflows
oscarvalenzuelab File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| [run] | ||
| source = purl2src | ||
| omit = | ||
| */tests/* | ||
| */test_*.py | ||
| */__pycache__/* | ||
| */site-packages/* | ||
|
|
||
| [report] | ||
| exclude_lines = | ||
| pragma: no cover | ||
| def __repr__ | ||
| raise AssertionError | ||
| raise NotImplementedError | ||
| if __name__ == .__main__.: | ||
| if TYPE_CHECKING: | ||
| @abstractmethod |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| name: PR Validation | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
|
|
||
| jobs: | ||
| test-and-lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.13' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install pytest ruff black | ||
| pip install -e . || pip install . | ||
|
|
||
| - name: Format check with black | ||
| run: | | ||
| black --check . || echo "Formatting issues found (non-blocking)" | ||
|
|
||
| - name: Lint with ruff | ||
| run: | | ||
| ruff check . || echo "Linting issues found (non-blocking)" | ||
|
|
||
| - name: Run tests | ||
| run: | | ||
| pytest tests/ -v --tb=short | ||
|
|
||
| documentation: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Check required files | ||
| run: | | ||
| required_files="README.md LICENSE AUTHORS.md CONTRIBUTING.md pyproject.toml" | ||
| for file in $required_files; do | ||
| if [ -f "$file" ]; then | ||
| echo "✓ $file exists" | ||
| else | ||
| echo "✗ $file is missing" | ||
| exit 1 | ||
| fi | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,90 +1,46 @@ | ||
| name: Release | ||
|
|
||
| permissions: | ||
| contents: write | ||
| id-token: write | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: 'Version to release (e.g., 1.2.3)' | ||
| required: true | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| test: | ||
| uses: ./.github/workflows/test.yml | ||
|
|
||
| build: | ||
| needs: test | ||
| build-and-publish: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
| python-version: '3.13' | ||
|
|
||
| - name: Install build dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install build twine | ||
|
|
||
| - name: Build package | ||
| run: | | ||
| python -m build | ||
| run: python -m build | ||
|
|
||
| - name: Check package | ||
| run: | | ||
| twine check dist/* | ||
|
|
||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
| run: twine check dist/* | ||
|
|
||
| release: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Download artifacts | ||
| uses: actions/download-artifact@v4 | ||
| - name: Publish to PyPI | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
| skip-existing: true | ||
|
|
||
| - name: Create Release | ||
| - name: Create GitHub Release | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
| files: dist/* | ||
| generate_release_notes: true | ||
| draft: false | ||
| prerelease: false | ||
|
|
||
| publish-pypi: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| if: startsWith(github.ref, 'refs/tags/') | ||
| environment: | ||
| name: pypi | ||
| url: https://pypi.org/project/purl2src/ | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - name: Download artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
|
|
||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| verbose: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,121 +1,45 @@ | ||
| name: Test | ||
| name: Tests | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| branches: [ main, develop ] | ||
| pull_request: | ||
| branches: [ main ] | ||
| workflow_dispatch: | ||
| workflow_call: | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest] | ||
| python-version: ["3.13"] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
| python-version: ${{ matrix.python-version }} | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -e .[dev] | ||
|
|
||
| - name: Lint with flake8 | ||
| run: | | ||
| flake8 src/ tests/ --count --select=E9,F63,F7,F82 --show-source --statistics | ||
| flake8 src/ tests/ --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics | ||
|
|
||
| - name: Format check with black | ||
| run: | | ||
| black --check src/ tests/ | ||
|
|
||
| - name: Type check with mypy | ||
| run: | | ||
| mypy src/ | ||
| pip install pytest pytest-cov | ||
| pip install -e . || pip install . | ||
|
|
||
| - name: Test with pytest | ||
| - name: Run tests | ||
| run: | | ||
| pytest -v --cov=purl2src --cov-report=term-missing --cov-report=xml | ||
| pytest tests/ -v --tb=short | ||
|
|
||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v4 | ||
| - name: Upload coverage | ||
| if: matrix.os == 'ubuntu-latest' | ||
| uses: codecov/codecov-action@v3 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| files: ./coverage.xml | ||
| flags: unittests | ||
| name: codecov-umbrella | ||
| fail_ci_if_error: false | ||
|
|
||
| test-package-managers: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18' | ||
|
|
||
| - name: Setup Ruby | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: '3.0' | ||
|
|
||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: '7.0.x' | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.21' | ||
|
|
||
| - name: Setup Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - name: Install package managers | ||
| run: | | ||
| # Maven is pre-installed on GitHub runners | ||
| mvn --version | ||
| # NPM comes with Node.js | ||
| npm --version | ||
| # Gem comes with Ruby | ||
| gem --version | ||
| # NuGet comes with .NET | ||
| dotnet nuget --version | ||
| # Go is installed | ||
| go version | ||
| # Cargo comes with Rust | ||
| cargo --version | ||
| # Install pip packages | ||
| pip --version | ||
| # Install Conda | ||
| wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh | ||
| bash miniconda.sh -b -p $HOME/miniconda | ||
| export PATH="$HOME/miniconda/bin:$PATH" | ||
| conda --version | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -e .[dev] | ||
|
|
||
| - name: Run integration tests | ||
| run: | | ||
| export PATH="$HOME/miniconda/bin:$PATH" | ||
| pytest tests/ -v -m "not slow" --cov=purl2src --cov-report=term-missing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Authors | ||
|
|
||
| ## Project Lead | ||
|
|
||
| * Oscar Valenzuela B. - Project creator and lead developer | ||
|
|
||
| --- | ||
|
|
||
| For a complete list of all contributors, please see the [GitHub contributors page](https://github.com/SemClone/purl2src/graphs/contributors). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # Support | ||
|
|
||
| ## How to Get Help | ||
|
|
||
| Thank you for using this project! Here are the best ways to get help: | ||
|
|
||
| ### Documentation | ||
|
|
||
| - Check the [README](README.md) for basic usage and setup instructions | ||
| - Review the [CONTRIBUTING](CONTRIBUTING.md) guide for development setup | ||
| - Look through existing documentation in the `/docs` folder (if available) | ||
|
|
||
| ### Getting Answers | ||
|
|
||
| **Before opening an issue:** | ||
| 1. Search existing [GitHub Issues](../../issues) to see if your question has been answered | ||
| 2. Check closed issues as well - your question might have been resolved | ||
| 3. Review the project's documentation thoroughly | ||
|
|
||
| ### Reporting Issues | ||
|
|
||
| If you've found a bug or have a feature request: | ||
|
|
||
| 1. **Search first**: Check if someone else has already reported the same issue | ||
| 2. **Create a detailed report**: Use our issue templates when available | ||
| 3. **Include context**: Provide OS, Python version, and relevant configuration | ||
| 4. **Share reproducible steps**: Help us understand how to reproduce the issue | ||
|
|
||
| ### Feature Requests | ||
|
|
||
| We welcome feature suggestions! Please: | ||
| - Check existing issues for similar requests | ||
| - Clearly describe the feature and its use case | ||
| - Explain why this feature would be valuable to the project | ||
|
|
||
| ### Security Issues | ||
|
|
||
| For security vulnerabilities, please refer to our [SECURITY](SECURITY.md) policy for responsible disclosure guidelines. | ||
|
|
||
| ## Community Guidelines | ||
|
|
||
| Please review our [Code of Conduct](CODE_OF_CONDUCT.md) before participating in discussions. | ||
|
|
||
| ## Response Times | ||
|
|
||
| This project is maintained by a small team. While we strive to respond quickly: | ||
| - Issues: Initial response within 7 days | ||
| - Pull requests: Review within 14 days | ||
| - Security issues: Within 48 hours | ||
|
|
||
| ## Additional Resources | ||
|
|
||
| - **Project Homepage**: [GitHub Repository](../../) | ||
| - **License**: See [LICENSE](LICENSE) file | ||
| - **Contributing**: See [CONTRIBUTING](CONTRIBUTING.md) guide | ||
|
|
||
| --- | ||
|
|
||
| **Note**: This is an open-source project maintained by volunteers. Response times may vary based on contributor availability. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.