Skip to content

Commit

Permalink
chore: Upgrade project to Python 3.8 (#5563)
Browse files Browse the repository at this point in the history
* upgrade project to Python 3.8

* remove pyston build

* fix 3.7 tests

* fix mypy
  • Loading branch information
gruebel authored Sep 18, 2023
1 parent 864532b commit 3c87d15
Show file tree
Hide file tree
Showing 12 changed files with 629 additions and 587 deletions.
44 changes: 14 additions & 30 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ jobs:
pipenv run pytest integration_tests
prisma-tests:
runs-on: [ self-hosted, public, linux, x64 ]
env:
PYTHON_VERSION: "3.8"
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v3
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4
with:
python-version: 3.7
python-version: ${{ env.PYTHON_VERSION }}
- name: Install pipenv
run: |
python -m pip install --no-cache-dir --upgrade pipenv
Expand All @@ -107,7 +109,7 @@ jobs:
run: |
# remove venv, if exists
pipenv --rm || true
pipenv --python 3.7
pipenv --python ${{ env.PYTHON_VERSION }}
pipenv run pip install pytest pytest-xdist
pipenv run python setup.py sdist bdist_wheel
pipenv run pip install dist/checkov-*.whl
Expand All @@ -122,12 +124,14 @@ jobs:
unit-tests:
timeout-minutes: 30
runs-on: ubuntu-latest
env:
PYTHON_VERSION: "3.8"
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v3
- name: Set up Python 3.7
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4
with:
python-version: 3.7
python-version: ${{ env.PYTHON_VERSION }}
- uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -141,7 +145,7 @@ jobs:
run: |
# remove venv, if exists
pipenv --rm || true
pipenv --python 3.7
pipenv --python ${{ env.PYTHON_VERSION }}
pipenv install --dev
- name: Test with pytest
env:
Expand All @@ -157,6 +161,8 @@ jobs:
# IMPORTANT: this permission is mandatory for trusted publishing to pypi
id-token: write
timeout-minutes: 30
env:
PYTHON_VERSION: "3.8"
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v3
with:
Expand All @@ -167,18 +173,18 @@ jobs:
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Set up Python 3.7
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4
with:
python-version: 3.7
python-version: ${{ env.PYTHON_VERSION }}
- name: Install pipenv
run: |
python -m pip install --no-cache-dir --upgrade pipenv
- name: Install dependencies
run: |
# remove venv, if exists
pipenv --rm || true
pipenv --python 3.7
pipenv --python ${{ env.PYTHON_VERSION }}
pipenv install
- name: Calculate version
run: |
Expand Down Expand Up @@ -300,28 +306,6 @@ jobs:
BC_API_KEY: ${{ secrets.BC_API_KEY }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
publish-checkov-pyston-dockerhub:
runs-on: [self-hosted, public, linux, x64]
needs: bump-version
environment: release
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v3
- name: Get release version
id: versions
run: |
checkov_version=${{ needs.bump-version.outputs.version }}
checkov_major_version=$(echo "${checkov_version}" | head -c1)
echo "version=$checkov_version" >> "$GITHUB_OUTPUT"
echo "major_version=$checkov_major_version" >> "$GITHUB_OUTPUT"
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@43dc228e327224b2eda11c8883232afd5b34943b # v5
with:
name: bridgecrew/checkov
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
tags: "pyston,${{ steps.versions.outputs.version }}-pyston,${{ steps.versions.outputs.major_version }}-pyston"
dockerfile: Dockerfile.pyston
buildoptions: "--no-cache"
update-bridgecrew-projects:
needs: publish-checkov-dockerhub
runs-on: [self-hosted, public, linux, x64]
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
permissions:
contents: write
environment: release
env:
PYTHON_VERSION: "3.8"
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v3
with:
Expand All @@ -24,10 +26,10 @@ jobs:
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Set up Python 3.7
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4
with:
python-version: 3.7
python-version: ${{ env.PYTHON_VERSION }}
- uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -41,7 +43,7 @@ jobs:
run: |
# remove venv, if exists
pipenv --rm || true
pipenv --python 3.7
pipenv --python ${{ env.PYTHON_VERSION }}
pipenv install --dev
pipenv run pip install pytest
- name: Test with pytest
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,16 @@ jobs:
runs-on: ${{ matrix.os }}
permissions:
contents: write
env:
PYTHON_VERSION: "3.8"
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4
with:
python-version: 3.7
python-version: ${{ env.PYTHON_VERSION }}
- name: Install pipenv
run: |
python -m pip install --no-cache-dir --upgrade pipenv
Expand Down Expand Up @@ -124,7 +126,7 @@ jobs:
if: needs.github-release.outputs.upload_url != ''
runs-on: [self-hosted, public, linux, arm64]
container:
image: arm64v8/python:3.7
image: arm64v8/python:3.8
permissions:
contents: write
steps:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pipenv-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
permissions:
contents: write
pull-requests: write
env:
PYTHON_VERSION: "3.8"
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v3
with:
Expand All @@ -26,7 +28,7 @@ jobs:
passphrase: ${{ secrets.PASSPHRASE }}
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4
with:
python-version: 3.7
python-version: ${{ env.PYTHON_VERSION }}
- name: Install pipenv
run: |
python -m pip install --no-cache-dir --upgrade pipenv
Expand Down
27 changes: 17 additions & 10 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ jobs:
danger ci --verbose --failOnErrors
cfn-lint:
runs-on: ubuntu-latest
env:
PYTHON_VERSION: "3.8"
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v3
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4
with:
python-version: 3.7
python-version: ${{ env.PYTHON_VERSION }}
- name: Install cfn-lint
run: |
pip install -U cfn-lint
Expand All @@ -45,12 +47,14 @@ jobs:
mypy:
uses: bridgecrewio/gha-reusable-workflows/.github/workflows/mypy.yaml@main
with:
python-version: "3.8"

unit-tests:
strategy:
fail-fast: true
matrix:
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python: ["3.7", "3.8", "3.9", "3.10", "3.11"] # TODO: remove 3.7 end of September
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
Expand All @@ -75,7 +79,13 @@ jobs:
# remove venv, if exists
pipenv --rm || true
pipenv --python ${{ matrix.python }}
pipenv install --dev -v
# TODO: remove 3.7 end of September
if [ ${{ matrix.python }} == '3.7' ]; then
pipenv install --skip-lock --dev -v
else
pipenv install --dev -v
fi
- name: Unit tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -135,18 +145,15 @@ jobs:
pipenv run pytest integration_tests -k 'not api_key'
performance-tests:
strategy:
fail-fast: false
matrix:
python: ["3.7"]
env:
PYTHON_VERSION: "3.8"
working-directory: ./performance_tests
runs-on: [self-hosted, public, linux, x64]
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v3
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # v4
with:
python-version: ${{ matrix.python }}
python-version: ${{ env.PYTHON_VERSION }}
cache: "pipenv"
cache-dependency-path: "Pipfile.lock"
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3
Expand All @@ -163,7 +170,7 @@ jobs:
run: |
# remove venv, if exists
pipenv --rm || true
pipenv --python ${{ matrix.python }}
pipenv --python ${{ env.PYTHON_VERSION }}
# 'py' package is used in 'pytest-benchmark', but 'pytest' removed it in their latest version
pipenv run pip install pytest pytest-benchmark py
pipenv run python setup.py sdist bdist_wheel
Expand All @@ -185,7 +192,7 @@ jobs:
dogfood-tests:
runs-on: ubuntu-latest
env:
PYTHON_VERSION: "3.7"
PYTHON_VERSION: "3.8"
WORKING_DIRECTORY: ./dogfood_tests
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v3
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10-slim
FROM python:3.11-slim

ENV RUN_IN_DOCKER=True

Expand Down
41 changes: 0 additions & 41 deletions Dockerfile.pyston

This file was deleted.

2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ spdx-tools = ">=0.8.0,<0.9.0"
license-expression = "*"

[requires]
python_version = "3.7"
python_version = "3.8"
Loading

0 comments on commit 3c87d15

Please sign in to comment.