From 45b74feedd76f8ceadc9e839a73e07b997137086 Mon Sep 17 00:00:00 2001 From: nebay-abraha Date: Thu, 31 Jul 2025 07:18:38 +0100 Subject: [PATCH 1/3] ci: refactor workflow to run CodeQL and unit tests - Renames workflow file to ci-codeql-tests.yml for clarity - Upgrades CodeQL actions to v3 - Adds Poetry-based unit test job using pytest --- .github/workflows/ci-codeql-test.yml | 54 +++++++++++++++++++++ .github/workflows/codeql-analysis.yml | 70 --------------------------- 2 files changed, 54 insertions(+), 70 deletions(-) create mode 100644 .github/workflows/ci-codeql-test.yml delete mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/workflows/ci-codeql-test.yml b/.github/workflows/ci-codeql-test.yml new file mode 100644 index 0000000..02afe95 --- /dev/null +++ b/.github/workflows/ci-codeql-test.yml @@ -0,0 +1,54 @@ +name: CodeQL, and unit Test + +on: + pull_request: + branches: [ master ] + workflow_dispatch: # allow manual trigger + +jobs: + analyze: + name: CodeQL Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + strategy: + fail-fast: false + matrix: + language: [ 'python' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + + test: + name: Unit Test + runs-on: ubuntu-latest + needs: analyze + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Poetry + run: | + curl -sSL https://install.python-poetry.org | python3 - + echo 'export PATH="$HOME/.local/bin:$PATH"' >> $GITHUB_ENV + + - name: Install dependencies + run: poetry install + + - name: Run Unit Test + run: poetry run pytest rspace_client/tests diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index dd737d8..0000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,70 +0,0 @@ -# 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: '30 14 * * 3' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'python' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://git.io/codeql-language-support - - 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 From 095e710252304470f3fdacea4dcc17d98daa9d48 Mon Sep 17 00:00:00 2001 From: nebay-abraha Date: Thu, 31 Jul 2025 07:35:29 +0100 Subject: [PATCH 2/3] ci: fix workflow name --- .github/workflows/ci-codeql-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-codeql-test.yml b/.github/workflows/ci-codeql-test.yml index 02afe95..77ae1db 100644 --- a/.github/workflows/ci-codeql-test.yml +++ b/.github/workflows/ci-codeql-test.yml @@ -1,4 +1,4 @@ -name: CodeQL, and unit Test +name: CodeQL and Unit Test on: pull_request: From 5d081da955d71eb847d96c2c359337b97b8c6230 Mon Sep 17 00:00:00 2001 From: nebay-abraha Date: Thu, 31 Jul 2025 07:52:47 +0100 Subject: [PATCH 3/3] ci: rename workflow file to codeql-and-tests.yml --- .github/workflows/{ci-codeql-test.yml => codeql-and-tests.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{ci-codeql-test.yml => codeql-and-tests.yml} (100%) diff --git a/.github/workflows/ci-codeql-test.yml b/.github/workflows/codeql-and-tests.yml similarity index 100% rename from .github/workflows/ci-codeql-test.yml rename to .github/workflows/codeql-and-tests.yml