From 3a190a8fb250d2f0c608e16109108510ce6abe67 Mon Sep 17 00:00:00 2001 From: black-sliver <59490463+black-sliver@users.noreply.github.com> Date: Tue, 14 Mar 2023 19:29:20 +0100 Subject: [PATCH] CI: more filters, update CodeQL (#1540) * CI: fix and more greedy filtering * CI: only run lint if *.py changed * CI: only run CodeQL if supported file changed * CI: fix unittests still triggering for build.yml * CI: update CodeQL action * CI: trigger codeql when changing the workflow --- .github/workflows/build.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 14 +++++++++++--- .github/workflows/lint.yml | 8 +++++++- .github/workflows/unittests.yml | 26 ++++++++++++++++---------- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 378dc87b..d4e1efd4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,12 +5,12 @@ name: Build on: push: paths: - - '.github/workflows/build.yaml' + - '.github/workflows/build.yml' - 'setup.py' - 'requirements.txt' pull_request: paths: - - '.github/workflows/build.yaml' + - '.github/workflows/build.yml' - 'setup.py' - 'requirements.txt' workflow_dispatch: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d42ad493..6aeb477a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -14,9 +14,17 @@ name: "CodeQL" on: push: branches: [ main ] + paths: + - '**.py' + - '**.js' + - '.github/workflows/codeql-analysis.yml' pull_request: # The branches below must be a subset of the branches above branches: [ main ] + paths: + - '**.py' + - '**.js' + - '.github/workflows/codeql-analysis.yml' schedule: - cron: '44 8 * * 1' @@ -39,7 +47,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -50,7 +58,7 @@ jobs: # 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 + uses: github/codeql-action/autobuild@v2 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -64,4 +72,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b2aa9a84..7ecda45e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,7 +3,13 @@ name: lint -on: [push, pull_request] +on: + push: + paths: + - '**.py' + pull_request: + paths: + - '**.py' jobs: build: diff --git a/.github/workflows/unittests.yml b/.github/workflows/unittests.yml index c3969ee2..93be745a 100644 --- a/.github/workflows/unittests.yml +++ b/.github/workflows/unittests.yml @@ -5,17 +5,23 @@ name: unittests on: push: - paths-ignore: - - 'docs/**' - - 'setup.py' - - '*.iss' - - '.gitignore' + paths: + - '**' + - '!docs/**' + - '!setup.py' + - '!*.iss' + - '!.gitignore' + - '!.github/workflows/**' + - '.github/workflows/unittests.yml' pull_request: - paths-ignore: - - 'docs/**' - - 'setup.py' - - '*.iss' - - '.gitignore' + paths: + - '**' + - '!docs/**' + - '!setup.py' + - '!*.iss' + - '!.gitignore' + - '!.github/workflows/**' + - '.github/workflows/unittests.yml' jobs: build: