diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000000..ae92dff462 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,388 @@ +name: CI + +on: + push: + branches: + - master + - 2.* + pull_request: ~ + +env: + CACHE_VERSION: 1 + DEFAULT_PYTHON: 3.6 + PRE_COMMIT_CACHE: ~/.cache/pre-commit + +jobs: + prepare-base: + name: Prepare base dependencies + runs-on: ubuntu-latest + outputs: + python-key: ${{ steps.generate-python-key.outputs.key }} + pre-commit-key: ${{ steps.generate-pre-commit-key.outputs.key }} + steps: + - name: Check out code from GitHub + uses: actions/checkout@v2.3.4 + - name: Set up Python ${{ env.DEFAULT_PYTHON }} + id: python + uses: actions/setup-python@v2.2.1 + with: + python-version: ${{ env.DEFAULT_PYTHON }} + - name: Generate partial Python venv restore key + id: generate-python-key + run: >- + echo "::set-output name=key::base-venv-${{ env.CACHE_VERSION }}-${{ + hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt', + 'requirements_test_brain.txt', 'requirements_test_pre_commit.txt') }}" + - name: Restore Python virtual environment + id: cache-venv + uses: actions/cache@v2.1.4 + with: + path: venv + key: >- + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + steps.generate-python-key.outputs.key }} + restore-keys: | + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-base-venv-${{ env.CACHE_VERSION }}- + - name: Create Python virtual environment + if: steps.cache-venv.outputs.cache-hit != 'true' + run: | + python -m venv venv + . venv/bin/activate + python -m pip install -U pip setuptools wheel + pip install -U -r requirements_test.txt -r requirements_test_brain.txt + - name: Generate pre-commit restore key + id: generate-pre-commit-key + run: >- + echo "::set-output name=key::pre-commit-${{ env.CACHE_VERSION }}-${{ + hashFiles('.pre-commit-config.yaml') }}" + - name: Restore pre-commit environment + id: cache-precommit + uses: actions/cache@v2.1.4 + with: + path: ${{ env.PRE_COMMIT_CACHE }} + key: >- + ${{ runner.os }}-${{ steps.generate-pre-commit-key.outputs.key }} + restore-keys: | + ${{ runner.os }}-pre-commit-${{ env.CACHE_VERSION }}- + - name: Install pre-commit dependencies + if: steps.cache-precommit.outputs.cache-hit != 'true' + run: | + . venv/bin/activate + pre-commit install --install-hooks + + formatting: + name: Run pre-commit checks + runs-on: ubuntu-latest + needs: prepare-base + steps: + - name: Check out code from GitHub + uses: actions/checkout@v2.3.4 + - name: Set up Python ${{ env.DEFAULT_PYTHON }} + id: python + uses: actions/setup-python@v2.2.1 + with: + python-version: ${{ env.DEFAULT_PYTHON }} + - name: Restore Python virtual environment + id: cache-venv + uses: actions/cache@v2.1.4 + with: + path: venv + key: + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + needs.prepare-base.outputs.python-key }} + - name: Fail job if Python cache restore failed + if: steps.cache-venv.outputs.cache-hit != 'true' + run: | + echo "Failed to restore Python venv from cache" + exit 1 + - name: Restore pre-commit environment + id: cache-precommit + uses: actions/cache@v2.1.4 + with: + path: ${{ env.PRE_COMMIT_CACHE }} + key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }} + - name: Fail job if pre-commit cache restore failed + if: steps.cache-precommit.outputs.cache-hit != 'true' + run: | + echo "Failed to restore pre-commit environment from cache" + exit 1 + - name: Run formatting check + run: | + . venv/bin/activate + pip install -e . + pre-commit run --all-files + + prepare-tests-linux: + name: Prepare tests for Python ${{ matrix.python-version }} (Linux) + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9] + outputs: + python-key: ${{ steps.generate-python-key.outputs.key }} + steps: + - name: Check out code from GitHub + uses: actions/checkout@v2.3.4 + - name: Set up Python ${{ matrix.python-version }} + id: python + uses: actions/setup-python@v2.2.1 + with: + python-version: ${{ matrix.python-version }} + - name: Generate partial Python venv restore key + id: generate-python-key + run: >- + echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ + hashFiles('setup.cfg', 'requirements_test.txt', 'requirements_test_min.txt', + 'requirements_test_brain.txt') }}" + - name: Restore Python virtual environment + id: cache-venv + uses: actions/cache@v2.1.4 + with: + path: venv + key: >- + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + steps.generate-python-key.outputs.key }} + restore-keys: | + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}- + - name: Create Python virtual environment + if: steps.cache-venv.outputs.cache-hit != 'true' + run: | + python -m venv venv + . venv/bin/activate + python -m pip install -U pip setuptools wheel + pip install -U -r requirements_test.txt + + pytest-linux: + name: Run tests Python ${{ matrix.python-version }} (Linux) + runs-on: ubuntu-latest + needs: prepare-tests-linux + strategy: + fail-fast: false + matrix: + python-version: [3.6, 3.7, 3.8, 3.9] + steps: + - name: Check out code from GitHub + uses: actions/checkout@v2.3.4 + - name: Set up Python ${{ matrix.python-version }} + id: python + uses: actions/setup-python@v2.2.1 + with: + python-version: ${{ matrix.python-version }} + - name: Restore Python virtual environment + id: cache-venv + uses: actions/cache@v2.1.4 + with: + path: venv + key: + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + needs.prepare-tests-linux.outputs.python-key }} + - name: Fail job if Python cache restore failed + if: steps.cache-venv.outputs.cache-hit != 'true' + run: | + echo "Failed to restore Python venv from cache" + exit 1 + - name: Run pytest + run: | + . venv/bin/activate + pytest --cov --cov-report= tests/ + - name: Upload coverage artifact + uses: actions/upload-artifact@v2.2.3 + with: + name: coverage-${{ matrix.python-version }} + path: .coverage + + coverage: + name: Process test coverage + runs-on: ubuntu-latest + needs: ["prepare-tests-linux", "pytest-linux"] + strategy: + matrix: + python-version: [3.8] + env: + COVERAGERC_FILE: .coveragerc + steps: + - name: Check out code from GitHub + uses: actions/checkout@v2.3.4 + - name: Set up Python ${{ matrix.python-version }} + id: python + uses: actions/setup-python@v2.2.1 + with: + python-version: ${{ matrix.python-version }} + - name: Restore Python virtual environment + id: cache-venv + uses: actions/cache@v2.1.4 + with: + path: venv + key: + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + needs.prepare-tests-linux.outputs.python-key }} + - name: Fail job if Python cache restore failed + if: steps.cache-venv.outputs.cache-hit != 'true' + run: | + echo "Failed to restore Python venv from cache" + exit 1 + - name: Download all coverage artifacts + uses: actions/download-artifact@v2.0.9 + - name: Combine coverage results + run: | + . venv/bin/activate + coverage combine coverage*/.coverage + coverage report --rcfile=${{ env.COVERAGERC_FILE }} + - name: Upload coverage to Coveralls + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + . venv/bin/activate + coveralls --rcfile=${{ env.COVERAGERC_FILE }} --service=github + + prepare-tests-windows: + name: Prepare tests for Python ${{ matrix.python-version }} (Windows) + runs-on: windows-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9] + outputs: + python-key: ${{ steps.generate-python-key.outputs.key }} + steps: + - name: Check out code from GitHub + uses: actions/checkout@v2.3.4 + - name: Set up Python ${{ matrix.python-version }} + id: python + uses: actions/setup-python@v2.2.1 + with: + python-version: ${{ matrix.python-version }} + - name: Generate partial Python venv restore key + id: generate-python-key + run: >- + echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ + hashFiles('setup.cfg', 'requirements_test_min.txt', + 'requirements_test_brain.txt') }}" + - name: Restore Python virtual environment + id: cache-venv + uses: actions/cache@v2.1.4 + with: + path: venv + key: >- + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + steps.generate-python-key.outputs.key }} + restore-keys: | + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}- + - name: Create Python virtual environment + if: steps.cache-venv.outputs.cache-hit != 'true' + run: | + python -m venv venv + . venv\\Scripts\\activate + python -m pip install -U pip setuptools wheel + pip install -U -r requirements_test_min.txt -r requirements_test_brain.txt + + pytest-windows: + name: Run tests Python ${{ matrix.python-version }} (Windows) + runs-on: windows-latest + needs: prepare-tests-windows + strategy: + fail-fast: false + matrix: + python-version: [3.6, 3.7, 3.8, 3.9] + steps: + - name: Set temp directory + run: echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV + # Workaround to set correct temp directory on Windows + # https://github.com/actions/virtual-environments/issues/712 + - name: Check out code from GitHub + uses: actions/checkout@v2.3.4 + - name: Set up Python ${{ matrix.python-version }} + id: python + uses: actions/setup-python@v2.2.1 + with: + python-version: ${{ matrix.python-version }} + - name: Restore Python virtual environment + id: cache-venv + uses: actions/cache@v2.1.4 + with: + path: venv + key: + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + needs.prepare-tests-windows.outputs.python-key }} + - name: Fail job if Python cache restore failed + if: steps.cache-venv.outputs.cache-hit != 'true' + run: | + echo "Failed to restore Python venv from cache" + exit 1 + - name: Run pytest + run: | + . venv\\Scripts\\activate + pytest tests/ + + prepare-tests-pypy: + name: Prepare tests for Python ${{ matrix.python-version }} + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["pypy3"] + outputs: + python-key: ${{ steps.generate-python-key.outputs.key }} + steps: + - name: Check out code from GitHub + uses: actions/checkout@v2.3.4 + - name: Set up Python ${{ matrix.python-version }} + id: python + uses: actions/setup-python@v2.2.1 + with: + python-version: ${{ matrix.python-version }} + - name: Generate partial Python venv restore key + id: generate-python-key + run: >- + echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ + hashFiles('setup.cfg', 'requirements_test_min.txt', + 'requirements_test_brain.txt', 'requirements_test_pre_commit.txt') }}" + - name: Restore Python virtual environment + id: cache-venv + uses: actions/cache@v2.1.4 + with: + path: venv + key: >- + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + steps.generate-python-key.outputs.key }} + restore-keys: | + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}- + - name: Create Python virtual environment + if: steps.cache-venv.outputs.cache-hit != 'true' + run: | + python -m venv venv + . venv/bin/activate + python -m pip install -U pip setuptools wheel + pip install -U -r requirements_test_min.txt + + pytest-pypy: + name: Run tests Python ${{ matrix.python-version }} + runs-on: ubuntu-latest + needs: prepare-tests-pypy + strategy: + fail-fast: false + matrix: + python-version: ["pypy3"] + steps: + - name: Check out code from GitHub + uses: actions/checkout@v2.3.4 + - name: Set up Python ${{ matrix.python-version }} + id: python + uses: actions/setup-python@v2.2.1 + with: + python-version: ${{ matrix.python-version }} + - name: Restore Python virtual environment + id: cache-venv + uses: actions/cache@v2.1.4 + with: + path: venv + key: + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + needs.prepare-tests-pypy.outputs.python-key }} + - name: Fail job if Python cache restore failed + if: steps.cache-venv.outputs.cache-hit != 'true' + run: | + echo "Failed to restore Python venv from cache" + exit 1 + - name: Run pytest + run: | + . venv/bin/activate + pytest tests/ diff --git a/.travis.yml b/.travis.yml index ec293d0b20..d046b2ef0d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,21 +4,14 @@ stages: - tests jobs: include: - - stage: prechecks - python: 3.6 - env: TOXENV=pylint - python: 3.6 - env: TOXENV=formatting - - python: pypy3 - env: TOXENV=pypy - - python: 3.6 - env: TOXENV=py36,py36-six + env: TOXENV=py36-six - python: 3.7 - env: TOXENV=py37,py37-six + env: TOXENV=py37-six - python: 3.8 - env: TOXENV=py38,py38-six + env: TOXENV=py38-six - python: 3.9 - env: TOXENV=py39,py39-six + env: TOXENV=py39-six before_install: - python --version - uname -a @@ -47,7 +40,7 @@ deploy: provider: pypi user: Claudiu.Popa password: - secure: YElO/mU+n8JcHdOkbD7Q14XqQce7ydu9/zbm6gpqEOvI/CMXyjsBaWKTg9LFAm8HtRMsaRfa4FElmFOXmY4LPqkRAIKNvxOzWnD76lsPlrIpHF7oHlxPQcLAO0YXcrCCwQh5NYm06KX8n5Wv2ypHqfDJv8QuPSl8v+2PCDwx2jeCLeo8GfuAmGJWxNn7IIAmAD3U0Gyc1FZ2KGtKcS9mNoLYRO9zZykomOVfhgQjZw6x7NJTg8x7vm5QOEe1nwoc8/5m7brI7ZeF+eFFaXrQOu+OMRSJnt8W0dr4mgNa71CEDVBAJxqQzy8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--git a/ChangeLog b/ChangeLog index 1f6f8dea8c..f3aade4714 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,8 @@ Release Date: TBA * COPYING was removed in favor of COPYING.LESSER and the latter was renamed to LICENSE to make more apparent that the code is licensed under LGPLv2. +* Moved from appveyor and travis to Github Actions for continuous integration. + What's New in astroid 2.5.3? ============================ Release Date: 2021-04-10 diff --git a/appveyor.yml b/appveyor.yml index 0973d2146d..ad1d9a1f73 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,31 +1,5 @@ version: "{branch}-{build}" build: off -cache: - - 'C:\\tmp' -environment: - matrix: - - PYTHON: "C:\\Python36" - TOXENV: "py36,py36-six" - - - PYTHON: "C:\\Python37" - TOXENV: "py37,py37-six" - - - PYTHON: "C:\\Python38" - TOXENV: "py38,py38-six" - -init: - - ps: echo $env:TOXENV - - ps: ls C:\Python* - - ps: mkdir C:\tmp -install: - - "powershell ./appveyor/install.ps1" - - "python -m pip install -U setuptools pip tox wheel virtualenv" - - "python -m pip --version" - - "python -m tox --version" test_script: - - "python -m tox" - -on_failure: - - ps: dir "env:" - - ps: get-content .tox\*\log\* + - echo "Skip" diff --git a/appveyor/install.ps1 b/appveyor/install.ps1 deleted file mode 100644 index 0ab6f085cc..0000000000 --- a/appveyor/install.ps1 +++ /dev/null @@ -1,27 +0,0 @@ -# Sample script to install pip under Windows -# Authors: Olivier Grisel, Jonathan Helmus and Kyle Kastner -# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ - -$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py" -$GET_PIP_PATH = "C:\get-pip.py" -$ErrorActionPreference = "Stop" - -function InstallPip ($python_home) { - $pip_path = $python_home + "\Scripts\pip.exe" - $python_path = $python_home + "\python.exe" - if (-not(Test-Path $pip_path)) { - Write-Host "Installing pip..." - $webclient = New-Object System.Net.WebClient - $webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH) - Write-Host "Executing:" $python_path $GET_PIP_PATH - Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru - } else { - Write-Host "pip already installed." - } -} - -function main () { - InstallPip $env:PYTHON -} - -main diff --git a/requirements_test.txt b/requirements_test.txt new file mode 100644 index 0000000000..940f8cfa21 --- /dev/null +++ b/requirements_test.txt @@ -0,0 +1,6 @@ +-r requirements_test_pre_commit.txt +-r requirements_test_min.txt +coveralls~=3.0 +coverage~=5.5 +pre-commit~=2.12 +pytest-cov~=2.11