Skip to content

Commit b35b55f

Browse files
committed
Update CodeQL workflow
1 parent 6b91271 commit b35b55f

File tree

4 files changed

+25
-21
lines changed

4 files changed

+25
-21
lines changed
Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
name: "CodeQL"
1+
name: CodeQL
22

33
on:
44
push:
5-
branches: [ "master" ]
5+
branches: [master]
66
pull_request:
77
# The branches below must be a subset of the branches above
8-
branches: [ "master" ]
8+
branches: [master]
99
schedule:
10-
- cron: '45 13 * * 6'
10+
- cron: 45 13 * * 6
1111

1212
jobs:
1313
analyze:
@@ -25,16 +25,18 @@ jobs:
2525
- name: Set up Python ${{ matrix.python-version }}
2626
uses: actions/setup-python@v4
2727
with:
28-
python-version: "3.10"
28+
python-version: '3.10'
2929

3030
- name: Cache pip
3131
uses: actions/cache@v3
3232
with:
3333
path: ~/.cache/pip
34-
key: ${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ hashFiles('requirements*.txt') }}
34+
key: ${{ runner.os }}-python-${{ matrix.python-version }}-codeql-${{ hashFiles('requirements*.txt') }}
3535
restore-keys: |
36-
${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ hashFiles('requirements*.txt') }}
37-
${{ runner.os }}-python-${{ matrix.python-version }}-pip-
36+
${{ runner.os }}-python-${{ matrix.python-version }}-codeql-${{ hashFiles('requirements*.txt') }}
37+
${{ runner.os }}-python-${{ matrix.python-version }}-tests-${{ hashFiles('requirements*.txt') }}
38+
${{ runner.os }}-python-${{ matrix.python-version }}-codeql-
39+
${{ runner.os }}-python-${{ matrix.python-version }}-tests-
3840
${{ runner.os }}-python
3941
${{ runner.os }}-
4042
@@ -43,10 +45,13 @@ jobs:
4345

4446
- name: Install dependencies
4547
run: |
46-
pip install -I -r requirements.txt
47-
# Set the `CODEQL-PYTHON` environment variable to the Python executable
48-
# that includes the dependencies
49-
echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV
48+
pip install -I -r requirements.txt -r requirements-dev.txt
49+
# Set the `CODEQL-PYTHON` environment variable to the Python executable
50+
# that includes the dependencies
51+
echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV
52+
53+
- name: Run flake8
54+
run: flake8 --count --max-line-length=120 .
5055

5156
# Initializes the CodeQL tools for scanning.
5257
- name: Initialize CodeQL
@@ -56,11 +61,11 @@ jobs:
5661
# If you wish to specify custom queries, you can do so here or in a config file.
5762
# By default, queries listed here will override any specified in a config file.
5863
# Prefix the list here with "+" to use these queries and those in the config file.
59-
64+
6065
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
6166
# queries: security-extended,security-and-quality
6267

6368
- name: Perform CodeQL Analysis
6469
uses: github/codeql-action/analyze@v2
6570
with:
66-
category: "/language:python"
71+
category: /language:python

.github/workflows/test.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,12 @@ jobs:
6565
uses: actions/cache@v3
6666
with:
6767
path: ~/.cache/pip
68-
key: ${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ hashFiles('requirements*.txt') }}
68+
key: ${{ runner.os }}-python-${{ matrix.python-version }}-tests-${{ hashFiles('requirements*.txt') }}
6969
restore-keys: |
70-
${{ runner.os }}-python-${{ matrix.python-version }}-pip-${{ hashFiles('requirements*.txt') }}
71-
${{ runner.os }}-python-${{ matrix.python-version }}-pip-
70+
${{ runner.os }}-python-${{ matrix.python-version }}-tests-${{ hashFiles('requirements*.txt') }}
71+
${{ runner.os }}-python-${{ matrix.python-version }}-codeql-${{ hashFiles('requirements*.txt') }}
72+
${{ runner.os }}-python-${{ matrix.python-version }}-tests-
73+
${{ runner.os }}-python-${{ matrix.python-version }}-codeql-
7274
${{ runner.os }}-python
7375
${{ runner.os }}-
7476
@@ -78,9 +80,6 @@ jobs:
7880
- name: Install dependencies
7981
run: pip install -I -r requirements.txt -r requirements-test.txt
8082

81-
- name: Run flake8
82-
run: flake8 --count --max-line-length=120 .
83-
8483
- name: Build package
8584
run: |
8685
git version

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
flake8>=3.8
12
pre-commit

requirements-test.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
build
22
coverage
3-
flake8>=3.8
43
pytest
54
pytest-rerunfailures
65
wheel

0 commit comments

Comments
 (0)