diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..33a1352 --- /dev/null +++ b/.flake8 @@ -0,0 +1,3 @@ +[flake8] +# E501: line too long +ignore = E501 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..6b0c235 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: ".github/workflows" # Location of package manifests + schedule: + interval: "weekly" + groups: + actions: + patterns: + - "*" diff --git a/.github/workflows/ci_workflows.yml b/.github/workflows/ci_workflows.yml new file mode 100644 index 0000000..a91a6dc --- /dev/null +++ b/.github/workflows/ci_workflows.yml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + pull_request: + schedule: + # Weekly Thursday 7AM build + # * is a special character in YAML so you have to quote this string + - cron: '0 7 * * 4' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Install dependencies + run: pip install PyGithub toml towncrier flake8 pytest pytest-cov --upgrade + - name: Tests + run: | + flake8 *.py --count + pytest --cov=./ --cov-report=xml + - name: Upload coverage to codecov + uses: codecov/codecov-action@v4 + with: + files: ./coverage.xml + verbose: true diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..468bb4f --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,69 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ main ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ main ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + language: [ 'python' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 diff --git a/README.md b/README.md index 4bddf9b..26191a9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # GitHub Action for Towncrier Changelog +TODO: CI badges here when we have them. + Check if a change log entry (fragment file) is present. If present, whether it is named correctly. If not present, whether it is allowed to be missing. Create a `.github/workflows/check_changelog_entry.yml` as follows. diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..ec7e817 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[tool:pytest] +flake8-ignore = E501 diff --git a/test_check_changelog.py b/test_check_changelog.py new file mode 100644 index 0000000..da1443f --- /dev/null +++ b/test_check_changelog.py @@ -0,0 +1,2 @@ +def test_me(): + raise NotImplementedError("But how to do meaningful tests without overcomplicating the script")