From 617a639e18411a7e141ab6ce614a52c830ef9fed Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 21 Feb 2021 20:23:14 +0100 Subject: CI - Add new windows jobs --- .github/workflows/ci.yaml | 78 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4273a07ac..483894eb0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -346,6 +346,84 @@ jobs: path: .benchmarks/ + 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 + - name: Set up Python ${{ matrix.python-version }} + id: python + uses: actions/setup-python@v2 + 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('pylint/__pkg_info__.py', 'requirements_test_pypy.txt') }}" + - name: Restore Python virtual environment + id: cache-venv + uses: actions/cache@v2 + 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_pypy.txt + pip install -e . + + 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 + - name: Set up Python ${{ matrix.python-version }} + id: python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Restore Python virtual environment + id: cache-venv + uses: actions/cache@v2 + 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 --benchmark-disable tests/ + + prepare-tests-pypy: name: Prepare tests for Python ${{ matrix.python-version }} runs-on: ubuntu-latest -- cgit v1.2.1