From 97852062f7a1b5d99cbf0ffec08fd8d56be35101 Mon Sep 17 00:00:00 2001 From: bsavitzky Date: Mon, 13 Nov 2023 12:12:32 -0800 Subject: [PATCH] rename linter actions --- .github/workflows/build-flake.yml | 40 ------------------------------- .github/workflows/linter.yml | 40 ++++++++++++++++++++----------- .github/workflows/superlinter.yml | 25 +++++++++++++++++++ 3 files changed, 51 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/build-flake.yml create mode 100644 .github/workflows/superlinter.yml diff --git a/.github/workflows/build-flake.yml b/.github/workflows/build-flake.yml deleted file mode 100644 index 3393b7908..000000000 --- a/.github/workflows/build-flake.yml +++ /dev/null @@ -1,40 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: Check module can be imported - -on: - push: - branches: [ "dev" ] - pull_request: - branches: [ "dev" ] - -permissions: - contents: read - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.10 - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest - 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,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test that the module imports - run: | - pip install . - python -c "import py4DSTEM; print(py4DSTEM.__version__)" diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 3e8071f6f..d5ad8c13c 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -1,4 +1,7 @@ -name: Check for errors with flake8 +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Lint with flake8 on: push: @@ -6,20 +9,29 @@ on: pull_request: branches: [ "dev" ] +permissions: + contents: read + jobs: - run-lint: + build: + runs-on: ubuntu-latest + steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + 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,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Lint Code Base - uses: github/super-linter@v4 - env: - VALIDATE_ALL_CODEBASE: false - VALIDATE_PYTHON_FLAKE8: true - DEFAULT_BRANCH: "dev" - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/superlinter.yml b/.github/workflows/superlinter.yml new file mode 100644 index 000000000..bc3fccf37 --- /dev/null +++ b/.github/workflows/superlinter.yml @@ -0,0 +1,25 @@ +name: Lint with super-linter@v4 + +on: + push: + branches: [ "dev" ] + pull_request: + branches: [ "dev" ] + +jobs: + run-lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: Lint Code Base + uses: github/super-linter@v4 + env: + VALIDATE_ALL_CODEBASE: false + VALIDATE_PYTHON_FLAKE8: true + DEFAULT_BRANCH: "dev" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}