From 3f65de43d843611a2d6c028962f5d218488eb7ce Mon Sep 17 00:00:00 2001 From: Yeison Vargas Date: Wed, 11 Oct 2023 15:56:59 -0500 Subject: [PATCH] Add and fix workflows --- .github/CODEOWNERS | 1 + .github/ISSUE_TEMPLATE.md | 15 ---- .github/ISSUE_TEMPLATE/01_BUG_REPORT.md | 37 +++++++++ .github/ISSUE_TEMPLATE/02_FEATURE_REQUEST.md | 35 ++++++++ .../ISSUE_TEMPLATE/03_CODEBASE_IMPROVEMENT.md | 7 ++ .github/ISSUE_TEMPLATE/04_SUPPORT_QUESTION.md | 9 ++ .github/ISSUE_TEMPLATE/config.yml | 2 + .github/PULL_REQUEST_TEMPLATE.md | 40 +++++++++ .github/labels.yml | 82 +++++++++++++++++++ .github/workflows/labels.yml | 21 +++++ .github/workflows/main.yml | 39 +++++---- .github/workflows/pr-labels.yml | 20 +++++ .github/workflows/security.yml | 21 +++++ pyproject.toml | 13 ++- test-requirements.txt | 5 ++ test_requirements.txt | 7 -- 16 files changed, 313 insertions(+), 41 deletions(-) create mode 100644 .github/CODEOWNERS delete mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/ISSUE_TEMPLATE/01_BUG_REPORT.md create mode 100644 .github/ISSUE_TEMPLATE/02_FEATURE_REQUEST.md create mode 100644 .github/ISSUE_TEMPLATE/03_CODEBASE_IMPROVEMENT.md create mode 100644 .github/ISSUE_TEMPLATE/04_SUPPORT_QUESTION.md create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/labels.yml create mode 100644 .github/workflows/labels.yml create mode 100644 .github/workflows/pr-labels.yml create mode 100644 .github/workflows/security.yml create mode 100644 test-requirements.txt delete mode 100644 test_requirements.txt diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..f179cd8 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @pyupio/maintainers diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 7e1f83f..0000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,15 +0,0 @@ -* Dependency Parser version: -* Python version: -* Operating System: - -### Description - -Describe what you were trying to get done. -Tell us what happened, what went wrong, and what you expected to happen. - -### What I Did - -``` -Paste the command(s) you ran and the output. -If there was a crash, please include the traceback here. -``` diff --git a/.github/ISSUE_TEMPLATE/01_BUG_REPORT.md b/.github/ISSUE_TEMPLATE/01_BUG_REPORT.md new file mode 100644 index 0000000..9a684d5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/01_BUG_REPORT.md @@ -0,0 +1,37 @@ +--- +name: Bug Report +about: Create a report to help dparse to improve +title: "bug: " +labels: "bug" +assignees: "" +--- + +# Bug Report + +**dparse version:** + + + +**Current behavior:** + + + +**Expected behavior:** + + + +**Steps to reproduce:** + + + +**Related code:** + + + +``` +insert short code snippets here +``` + +**Other information:** + + diff --git a/.github/ISSUE_TEMPLATE/02_FEATURE_REQUEST.md b/.github/ISSUE_TEMPLATE/02_FEATURE_REQUEST.md new file mode 100644 index 0000000..5719147 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/02_FEATURE_REQUEST.md @@ -0,0 +1,35 @@ +--- +name: Feature Request +about: Suggest an idea for this project +title: "feat: " +labels: "enhancement" +assignees: "" +--- + +# Feature Request + +**Describe the Feature Request** + + + +**Describe Preferred Solution** + + + +**Describe Alternatives** + + + +**Related Code** + + + +**Additional Context** + + + +**If the feature request is approved, would you be willing to submit a PR?** +_(Help can be provided if you need assistance submitting a PR)_ + +- [ ] Yes +- [ ] No diff --git a/.github/ISSUE_TEMPLATE/03_CODEBASE_IMPROVEMENT.md b/.github/ISSUE_TEMPLATE/03_CODEBASE_IMPROVEMENT.md new file mode 100644 index 0000000..bcd6cb7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/03_CODEBASE_IMPROVEMENT.md @@ -0,0 +1,7 @@ +--- +name: Codebase improvement +about: Provide your feedback for the existing codebase. Suggest a better solution for algorithms, development tools, etc. +title: "dev: " +labels: "enhancement" +assignees: "" +--- diff --git a/.github/ISSUE_TEMPLATE/04_SUPPORT_QUESTION.md b/.github/ISSUE_TEMPLATE/04_SUPPORT_QUESTION.md new file mode 100644 index 0000000..ca89bc0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/04_SUPPORT_QUESTION.md @@ -0,0 +1,9 @@ +--- +name: Support Question +about: Question on how to use this project +title: "support: " +labels: "question" +assignees: "" +--- + +# Support Question diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..bd9dfe4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,2 @@ +--- +blank_issues_enabled: false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..5d0b0b3 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,40 @@ + + +## Pull Request type + + + +Please check the type of change your PR introduces: + +- [ ] Bugfix +- [ ] Feature +- [ ] Code style update (formatting, renaming) +- [ ] Refactoring (no functional changes, no API changes) +- [ ] Build-related changes +- [ ] Documentation content changes +- [ ] Other (please describe): + +## What is the current behavior? + + + +Issue Number: N/A + +## What is the new behavior? + + + +- +- +- + +## Does this introduce a breaking change? + +- [ ] Yes +- [ ] No + + + +## Other information + + diff --git a/.github/labels.yml b/.github/labels.yml new file mode 100644 index 0000000..65c5920 --- /dev/null +++ b/.github/labels.yml @@ -0,0 +1,82 @@ +--- +- name: "breaking-change" + color: ee0701 + description: "A change that changes the API or breaks backward compatibility for users." +- name: "bugfix" + color: ee0701 + description: "Inconsistencies or issues which will cause a problem for users or implementors." +- name: "documentation" + color: 0052cc + description: "Solely about the documentation of the project." +- name: "enhancement" + color: 1d76db + description: "Enhancement of the code, not introducing new features." +- name: "refactor" + color: 1d76db + description: "Updating the code with simpler, easier to understand or more efficient syntax or methods, but not introducing new features." +- name: "performance" + color: 1d76db + description: "Improving performance of the project, not introducing new features." +- name: "new-feature" + color: 0e8a16 + description: "New features or options." +- name: "maintenance" + color: 2af79e + description: "Generic maintenance tasks." +- name: "ci" + color: 1d76db + description: "Work that improves the continuous integration." +- name: "dependencies" + color: 1d76db + description: "Change in project dependencies." + +- name: "in-progress" + color: fbca04 + description: "Issue is currently being worked on by a developer." +- name: "stale" + color: fef2c0 + description: "No activity for quite some time." +- name: "no-stale" + color: fef2c0 + description: "This is exempt from the stale bot." + +- name: "security" + color: ee0701 + description: "Addressing a vulnerability or security risk in this project." +- name: "incomplete" + color: fef2c0 + description: "Missing information." +- name: "invalid" + color: fef2c0 + description: "This is off-topic, spam, or otherwise doesn't apply to this project." + +- name: "beginner-friendly" + color: 0e8a16 + description: "Good first issue for people wanting to contribute to this project." +- name: "help-wanted" + color: 0e8a16 + description: "We need some extra helping hands or expertise in order to resolve this!" + +- name: "priority-critical" + color: ee0701 + description: "Must be addressed as soon as possible." +- name: "priority-high" + color: b60205 + description: "After critical issues are fixed, these should be dealt with before any further issues." +- name: "priority-medium" + color: 0e8a16 + description: "This issue may be useful, and needs some attention." +- name: "priority-low" + color: e4ea8a + description: "Nice addition, maybe... someday..." + +- name: "major" + color: b60205 + description: "This PR causes a major bump in the version number." +- name: "minor" + color: 0e8a16 + description: "This PR causes a minor bump in the version number." + +- name: "cd" + color: FBCA04 + description: "Work that improves the continuous deployment." diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml new file mode 100644 index 0000000..a204bf6 --- /dev/null +++ b/.github/workflows/labels.yml @@ -0,0 +1,21 @@ +--- +name: Sync labels + +on: + push: + branches: + - main + paths: + - .github/labels.yml + +jobs: + labels: + name: ♻️ Sync labels + runs-on: ubuntu-latest + steps: + - name: ⤵️ Check out code from GitHub + uses: actions/checkout@v3 + - name: 🚀 Run Label Syncer + uses: micnncim/action-label-syncer@v1.3.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c5e36cf..7cf5ee3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,22 +7,31 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - python-version: [ "3.6", "3.7", "3.8", "3.9", "3.10", "3.11" ] + python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Display Python version - run: python -c "import sys; print(sys.version)" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r test_requirements.txt - - name: Test with pytest - run: | - pytest -rP tests/ --cov=dparse/ --cov-report=xml --cov-report=html + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Cache dependencies + uses: actions/cache@v3 + id: cache-dependencies + with: + path: ${{ env.pythonLocation }} + key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'test-requirements.txt') }} + + - name: Install dependencies + if: steps.cache-dependencies.outputs.cache-hit != 'true' + run: | + python -m pip install --upgrade pip + pip install -r test-requirements.txt + + - name: Test with pytest + run: | + pytest -rP tests/ --cov=dparse/ --cov-report=xml --cov-report=html deploy: needs: test diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml new file mode 100644 index 0000000..8fd7ccf --- /dev/null +++ b/.github/workflows/pr-labels.yml @@ -0,0 +1,20 @@ +--- +name: PR Labels + +on: + pull_request: + types: [opened, labeled, unlabeled, synchronize] + +jobs: + pr_labels: + name: 🏭 Verify + runs-on: ubuntu-latest + steps: + - name: 🏷 Verify PR has a valid label + uses: jesusvasquez333/verify-pr-label-action@v1.4.0 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + valid-labels: >- + breaking-change, bugfix, documentation, enhancement, + refactor, performance, new-feature, maintenance, ci, cd, dependencies + disable-reviews: true diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml new file mode 100644 index 0000000..0ef67ed --- /dev/null +++ b/.github/workflows/security.yml @@ -0,0 +1,21 @@ +name: Dependencies scanning + +on: + push: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: '3.9' + + - run: pip install -e . + + - uses: pyupio/safety@2.3.5 + with: + api-key: ${{ secrets.SAFETY_API_KEY }} + scan: 'env' diff --git a/pyproject.toml b/pyproject.toml index e493ac0..a1d13fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,4 +1,8 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + [project] name = "dparse" version = "0.6.3" @@ -14,13 +18,14 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ] -requires-python = ">=3.6" +requires-python = ">=3.7" dependencies = [ "packaging", "tomli; python_version < '3.11'", @@ -32,7 +37,7 @@ Homepage = "https://github.com/pyupio/dparse" [project.optional-dependencies] pipenv = [ - "pipenv<=2022.12.19", + "pipenv", ] conda = [ "pyyaml", diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..8d51bd9 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,5 @@ +-e .[pipenv,conda] +pytest==7.4.2 +pytest-cov==4.1.0 +codecov==2.1.13 +ruff==0.0.292 \ No newline at end of file diff --git a/test_requirements.txt b/test_requirements.txt deleted file mode 100644 index da7a7b7..0000000 --- a/test_requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ -pipenv<=2022.12.19 -pyyaml -pytest -pytest-cov -codecov -tomli; python_version < "3.11" -packaging