From f9fd8cfc85473c88021a0d99fc10ca0378de402f Mon Sep 17 00:00:00 2001 From: jan iversen Date: Fri, 14 Jul 2023 10:16:00 +0200 Subject: [PATCH 1/4] test codeql --- .github/workflows/ci.yml | 61 ++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e4250952..02c360d8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,8 +11,7 @@ on: branches: - dev schedule: - # Sunday at 02:10 UTC. - - cron: '10 2 * * 0' + - cron: '10 2 * * *' workflow_dispatch: @@ -28,19 +27,33 @@ jobs: uses: actions/checkout@v3 - name: Set up python + id: setupPython uses: actions/setup-python@v4 with: python-version: 3.8 - - name: venv restore - id: cache-venv - uses: syphar/restore-virtualenv@v1 + - name: cache virtualenv + id: cacheVenv + uses: actions/cache@v3 with: - requirement_files: requirements.txt - - - name: venv create - if: steps.cache-venv.outputs.cache-hit != 'true' - run: pip install -e . -r requirements.txt + path: ./venv/ + key: ${{ runner.os }}-${{ steps.setupPython.outputs.python-version }}-venv-${{ hashFiles('requirements.txt') }} + restore-keys: | + ${{ runner.os }}-${{ steps.setupPython.outputs.python-version }}-venv- + + - name: Install requirements + if: steps.cacheVenv.outputs.cache-hit != 'true' + run: | + python -m venv venv + source venv/bin/activate + pip install -U -e . -r requirements.txt + echo PATH=$PATH >> $GITHUB_ENV + + - name: Activate venv + if: steps.cacheVenv.outputs.cache-hit == 'true' + run: | + source venv/bin/activate + echo PATH=$PATH >> $GITHUB_ENV - name: codespell run: codespell @@ -57,11 +70,22 @@ jobs: - name: mypy run: mypy pymodbus + analyze: + name: Analyze Python + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + - uses: github/codeql-action/init@v2 + with: + languages: python + - uses: github/codeql-action/autobuild@v2 + - uses: github/codeql-action/analyze@v2 + integreation_test: name: pytest - ${{ matrix.os.on }} - ${{ matrix.python.version }} runs-on: ${{ matrix.os.on }} - needs: linters timeout-minutes: 10 strategy: fail-fast: false @@ -78,20 +102,19 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - - name: Set up ${{ matrix.python.version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python.version }} - - name: venv restore - id: cache-venv - uses: syphar/restore-virtualenv@v1 - with: - requirement_files: requirements.txt + # - name: venv restore + # id: cache-venv + # uses: syphar/restore-virtualenv@v1 + # with: + # requirement_files: requirements.txt - name: venv create - if: steps.cache-venv.outputs.cache-hit != 'true' + # if: steps.cache-venv.outputs.cache-hit != 'true' run: pip install -e . -r requirements.txt - name: pytest @@ -101,7 +124,9 @@ jobs: name: ci_complete runs-on: ubuntu-latest needs: + - linters - integreation_test + - analyze timeout-minutes: 1 steps: - name: Dummy From 2945900778230479afd040b5fd96e53bbbe01832 Mon Sep 17 00:00:00 2001 From: jan iversen Date: Fri, 14 Jul 2023 15:19:22 +0200 Subject: [PATCH 2/4] test with cache again. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02c360d8e..eb3209f90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: id: cacheVenv uses: actions/cache@v3 with: - path: ./venv/ + path: venv/ key: ${{ runner.os }}-${{ steps.setupPython.outputs.python-version }}-venv-${{ hashFiles('requirements.txt') }} restore-keys: | ${{ runner.os }}-${{ steps.setupPython.outputs.python-version }}-venv- From 78a1abd2c3e25d6adeab37f4be1a73c373c1f974 Mon Sep 17 00:00:00 2001 From: jan iversen Date: Fri, 14 Jul 2023 15:25:43 +0200 Subject: [PATCH 3/4] total cache. --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb3209f90..103b56071 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,10 +76,13 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: github/codeql-action/init@v2 with: languages: python + - uses: github/codeql-action/autobuild@v2 + - uses: github/codeql-action/analyze@v2 @@ -102,20 +105,35 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + - name: Set up ${{ matrix.python.version }} + id: setupPython uses: actions/setup-python@v4 with: python-version: ${{ matrix.python.version }} - # - name: venv restore - # id: cache-venv - # uses: syphar/restore-virtualenv@v1 - # with: - # requirement_files: requirements.txt + - name: cache virtualenv + id: cacheVenv + uses: actions/cache@v3 + with: + path: venv/ + key: ${{ runner.os }}-${{ steps.setupPython.outputs.python-version }}-venv-${{ hashFiles('requirements.txt') }} + restore-keys: | + ${{ runner.os }}-${{ steps.setupPython.outputs.python-version }}-venv- + + - name: Install requirements + if: steps.cacheVenv.outputs.cache-hit != 'true' + run: | + python -m venv venv + source venv/bin/activate + pip install -U -e . -r requirements.txt + echo PATH=$PATH >> $GITHUB_ENV - - name: venv create - # if: steps.cache-venv.outputs.cache-hit != 'true' - run: pip install -e . -r requirements.txt + - name: Activate venv + if: steps.cacheVenv.outputs.cache-hit == 'true' + run: | + source venv/bin/activate + echo PATH=$PATH >> $GITHUB_ENV - name: pytest run: pytest --cov=pymodbus --cov=test --cov-report=term-missing --cov-report=xml -v --full-trace --timeout=20 From 16844f8545a927cdc3d9fd917f1353b08942aa6a Mon Sep 17 00:00:00 2001 From: jan iversen Date: Fri, 14 Jul 2023 15:38:52 +0200 Subject: [PATCH 4/4] simple. --- .github/workflows/ci.yml | 95 ++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 61 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 103b56071..7648da177 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,8 @@ on: branches: - dev schedule: - - cron: '10 2 * * *' + # Sunday at 02:10 UTC. + - cron: '10 2 * * 0' workflow_dispatch: @@ -27,33 +28,19 @@ jobs: uses: actions/checkout@v3 - name: Set up python - id: setupPython uses: actions/setup-python@v4 with: python-version: 3.8 - - name: cache virtualenv - id: cacheVenv - uses: actions/cache@v3 + - name: venv restore + id: cache-venv + uses: syphar/restore-virtualenv@v1 with: - path: venv/ - key: ${{ runner.os }}-${{ steps.setupPython.outputs.python-version }}-venv-${{ hashFiles('requirements.txt') }} - restore-keys: | - ${{ runner.os }}-${{ steps.setupPython.outputs.python-version }}-venv- - - - name: Install requirements - if: steps.cacheVenv.outputs.cache-hit != 'true' - run: | - python -m venv venv - source venv/bin/activate - pip install -U -e . -r requirements.txt - echo PATH=$PATH >> $GITHUB_ENV - - - name: Activate venv - if: steps.cacheVenv.outputs.cache-hit == 'true' - run: | - source venv/bin/activate - echo PATH=$PATH >> $GITHUB_ENV + requirement_files: requirements.txt + + - name: venv create + if: steps.cache-venv.outputs.cache-hit != 'true' + run: pip install -e . -r requirements.txt - name: codespell run: codespell @@ -70,21 +57,6 @@ jobs: - name: mypy run: mypy pymodbus - analyze: - name: Analyze Python - runs-on: ubuntu-22.04 - - steps: - - uses: actions/checkout@v3 - - - uses: github/codeql-action/init@v2 - with: - languages: python - - - uses: github/codeql-action/autobuild@v2 - - - uses: github/codeql-action/analyze@v2 - integreation_test: name: pytest - ${{ matrix.os.on }} - ${{ matrix.python.version }} @@ -107,44 +79,45 @@ jobs: uses: actions/checkout@v3 - name: Set up ${{ matrix.python.version }} - id: setupPython uses: actions/setup-python@v4 with: python-version: ${{ matrix.python.version }} - - name: cache virtualenv - id: cacheVenv - uses: actions/cache@v3 + - name: venv restore + id: cache-venv + uses: syphar/restore-virtualenv@v1 with: - path: venv/ - key: ${{ runner.os }}-${{ steps.setupPython.outputs.python-version }}-venv-${{ hashFiles('requirements.txt') }} - restore-keys: | - ${{ runner.os }}-${{ steps.setupPython.outputs.python-version }}-venv- - - - name: Install requirements - if: steps.cacheVenv.outputs.cache-hit != 'true' - run: | - python -m venv venv - source venv/bin/activate - pip install -U -e . -r requirements.txt - echo PATH=$PATH >> $GITHUB_ENV - - - name: Activate venv - if: steps.cacheVenv.outputs.cache-hit == 'true' - run: | - source venv/bin/activate - echo PATH=$PATH >> $GITHUB_ENV + requirement_files: requirements.txt + + - name: venv create + if: steps.cache-venv.outputs.cache-hit != 'true' + run: pip install -e . -r requirements.txt - name: pytest run: pytest --cov=pymodbus --cov=test --cov-report=term-missing --cov-report=xml -v --full-trace --timeout=20 + analyze: + name: Analyze Python + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v3 + + - uses: github/codeql-action/init@v2 + with: + languages: python + + - uses: github/codeql-action/autobuild@v2 + + - uses: github/codeql-action/analyze@v2 + ci_complete: name: ci_complete runs-on: ubuntu-latest needs: - linters - - integreation_test - analyze + - integreation_test timeout-minutes: 1 steps: - name: Dummy