Add code python-syntax-checker and other github actions

This commit is contained in:
Ircama
2023-07-27 05:17:05 +02:00
parent bfd8e4a402
commit 604745de2d
4 changed files with 206 additions and 61 deletions

68
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@@ -0,0 +1,68 @@
# 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: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '39 8 * * 0'
jobs:
analyze:
permissions: write-all
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@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
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@v1
# 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@v1

View File

@@ -0,0 +1,40 @@
# from https://docs.github.com/en/actions/guides/building-and-testing-python
name: Python syntax checker
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# version range and latest minor release (possibly 3.9.1)
python-version: ['3.7', '3.8', '3.9', '3.10', '3.x']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
# next line is alternative to the previous one, for future use of pytest
# pip install flake8 pytest
# next line is for future use of requirements file
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F72,F82 --show-source --statistics
# next lines is for future use of more accurate statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=40 --max-line-length=127 --statistics
# next lines is for future use of pytest
#- name: Test with pytest
# run: |
# pytest

26
.github/workflows/stale.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: Mark stale issues and automatically close them
on:
schedule:
- cron: '00 23 * * *'
jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v4 # https://github.com/actions/stale
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue becomed stale because of no feedback for 30 days. Remove the stale label or add a comment; otherwise, this will be automatically closed in 60 days.'
stale-pr-message: 'This PR becomed stale because of no feedback for 60 days.'
days-before-stale: 30
days-before-close: 60
close-issue-message: 'This issue was closed because it has been stalled for 60 days with no activity.'
days-before-pr-close: -1
any-of-labels: answered,needs-rebase,inactive,Awaiting-Response,question,invalid,duplicate,wontfix
exempt-all-pr-assignees: true