Skip to content

Guard lock analysis against Pip-cached artifacts. #1810

Guard lock analysis against Pip-cached artifacts.

Guard lock analysis against Pip-cached artifacts. #1810

Workflow file for this run

name: CI
on: [push, pull_request]
defaults:
run:
shell: bash
env:
_PEX_TEST_PYENV_ROOT: .pyenv_test
# We use this to skip exposing same-versioned Pythons present on Linux hosts. These otherwise can
# collide when attempting to load libpython<major>.<minor><flags>.so and lead to mysterious errors
# importing builtins like `fcntl` as outlined in https://github.com/pantsbuild/pex/issues/1391.
_PEX_TEST_PYENV_VERSIONS: "2.7 3.7 3.10"
concurrency:
group: CI-${{ github.ref }}
# Queue on all branches and tags, but only cancel overlapping PR burns.
cancel-in-progress: ${{ github.ref != 'refs/heads/main' || !startsWith(github.ref, 'refs/tags/') }}
jobs:
org-check:
name: Check GitHub Organization
if: github.repository_owner == 'pantsbuild'
runs-on: ubuntu-20.04
steps:
- name: Noop
run: "true"
checks:
name: TOXENV=format-check,typecheck,vendor-check,package -- --additional-format sdist --additional-format wheel
needs: org-check
runs-on: ubuntu-20.04
steps:
- name: Checkout Pex
uses: actions/checkout@v3
with:
# We need branches and tags since package leans on `git describe`. Passing 0 gets us
# complete history.
fetch-depth: 0
- name: Setup Python 3.8
uses: actions/setup-python@v4
with:
# We need to keep Python 3.8 for consistent vendoring with tox.
python-version: "3.8"
- name: Check Formatting, Types, Vendoring and Packaging
uses: pantsbuild/actions/run-tox@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
tox-env: format-check,typecheck,vendor-check,package -- --additional-format sdist --additional-format wheel
cpython-unit-tests:
name: (${{ matrix.os }}) Pip ${{ matrix.pip-version }} TOXENV=py${{ matrix.python-version[0] }}${{ matrix.python-version[1] }}
needs: org-check
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-11
python-version: [ 2, 7 ]
pip-version: 20
- os: ubuntu-20.04
python-version: [ 2, 7 ]
pip-version: 20
- os: ubuntu-20.04
python-version: [ 3, 5 ]
pip-version: 20
- os: macos-11
python-version: [ 3, 11 ]
pip-version: 20
- os: ubuntu-20.04
python-version: [ 3, 11 ]
pip-version: 20
- os: ubuntu-20.04
python-version: [ 3, 11 ]
pip-version: 22_3_1
- os: ubuntu-20.04
python-version: [ 3, 11 ]
pip-version: 23_0_1
steps:
- name: Calculate Pythons to Expose
id: calculate-pythons-to-expose
run: |
skip=""
if [[ "$(uname -s)" == "Linux" ]]; then
skip="${{ env._PEX_TEST_PYENV_VERSIONS }}"
fi
echo "skip=${skip}" >> $GITHUB_OUTPUT
- name: Checkout Pex
uses: actions/checkout@v3
- name: Setup Python ${{ join(matrix.python-version, '.') }}
uses: actions/setup-python@v4
with:
python-version: "${{ join(matrix.python-version, '.') }}"
- name: Expose Pythons
uses: pantsbuild/actions/expose-pythons@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
skip: "${{ steps.calculate-pythons-to-expose.outputs.skip }}"
- name: Cache Pyenv Interpreters
uses: actions/cache@v3
with:
path: ${{ env._PEX_TEST_PYENV_ROOT }}
key: ${{ runner.os }}-pyenv-root-v9
- name: Run Unit Tests
uses: pantsbuild/actions/run-tox@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
tox-env: py${{ matrix.python-version[0] }}${{ matrix.python-version[1] }}-pip${{ matrix.pip-version }}
pypy-unit-tests:
name: (PyPy ${{ join(matrix.pypy-version, '.') }}) Pip ${{ matrix.pip-version }} TOXENV=pypy${{ join(matrix.pypy-version, '') }}
needs: org-check
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- pypy-version: [ 2, 7 ]
pip-version: 20
- pypy-version: [ 3, 9 ]
pip-version: 20
- pypy-version: [ 3, 9 ]
pip-version: 22_3_1
- pypy-version: [ 3, 9 ]
pip-version: 23_0_1
steps:
- name: Calculate Pythons to Expose
id: calculate-pythons-to-expose
run: |
skip=""
if [[ "$(uname -s)" == "Linux" ]]; then
skip="${{ env._PEX_TEST_PYENV_VERSIONS }}"
fi
echo "skip=${skip}" >> $GITHUB_OUTPUT
- name: Checkout Pex
uses: actions/checkout@v3
- name: Setup PyPy ${{ join(matrix.pypy-version, '.') }}
uses: actions/setup-python@v4
with:
python-version: "pypy-${{ join(matrix.pypy-version, '.') }}"
- name: Expose Pythons
uses: pantsbuild/actions/expose-pythons@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
skip: "${{ steps.calculate-pythons-to-expose.outputs.skip }}"
- name: Cache Pyenv Interpreters
uses: actions/cache@v3
with:
path: ${{ env._PEX_TEST_PYENV_ROOT }}
key: ${{ runner.os }}-pyenv-root-v9
- name: Run Unit Tests
uses: pantsbuild/actions/run-tox@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
tox-env: pypy${{ join(matrix.pypy-version, '') }}-pip${{ matrix.pip-version }}
cpython-integration-tests:
name: (${{ matrix.os }}) Pip ${{ matrix.pip-version }} TOXENV=py${{ matrix.python-version[0] }}${{ matrix.python-version[1] }}-integration
needs: org-check
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-11
python-version: [ 2, 7 ]
pip-version: 20
- os: ubuntu-20.04
python-version: [ 2, 7 ]
pip-version: 20
- os: ubuntu-20.04
python-version: [ 3, 7 ]
pip-version: 22_3_1
- os: ubuntu-20.04
python-version: [ 3, 7 ]
pip-version: 23_0_1
- os: macos-11
python-version: [ 3, 11 ]
pip-version: 20
- os: ubuntu-20.04
python-version: [ 3, 11 ]
pip-version: 20
- os: ubuntu-20.04
python-version: [ 3, 11 ]
pip-version: 22_3_1
- os: ubuntu-20.04
python-version: [ 3, 11 ]
pip-version: 23_0_1
steps:
- name: Calculate Pythons to Expose
id: calculate-pythons-to-expose
run: |
skip=""
if [[ "$(uname -s)" == "Linux" ]]; then
skip="${{ env._PEX_TEST_PYENV_VERSIONS }}"
fi
echo "skip=${skip}" >> $GITHUB_OUTPUT
- name: Checkout Pex
uses: actions/checkout@v3
with:
# We need branches and tags for some ITs.
fetch-depth: 0
- name: Setup Python ${{ join(matrix.python-version, '.') }}
uses: actions/setup-python@v4
with:
python-version: "${{ join(matrix.python-version, '.') }}"
- name: Expose Pythons
uses: pantsbuild/actions/expose-pythons@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
skip: "${{ steps.calculate-pythons-to-expose.outputs.skip }}"
- name: Cache Pyenv Interpreters
uses: actions/cache@v3
with:
path: ${{ env._PEX_TEST_PYENV_ROOT }}
key: ${{ runner.os }}-pyenv-root-v9
- name: Setup SSH Agent
uses: webfactory/ssh-agent@v0.5.4
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
if: env.SSH_PRIVATE_KEY != ''
with:
ssh-private-key: ${{ env.SSH_PRIVATE_KEY }}
- name: Run Integration Tests
uses: pantsbuild/actions/run-tox@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
tox-env: py${{ matrix.python-version[0] }}${{ matrix.python-version[1] }}-pip${{ matrix.pip-version }}-integration
pypy-integration-tests:
name: (PyPy ${{ join(matrix.pypy-version, '.') }}) Pip ${{ matrix.pip-version }} TOXENV=pypy${{ join(matrix.pypy-version, '') }}-integration
needs: org-check
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- pypy-version: [ 2, 7 ]
pip-version: 20
- pypy-version: [ 3, 9 ]
pip-version: 20
- pypy-version: [ 3, 9 ]
pip-version: 22_3_1
- pypy-version: [ 3, 9 ]
pip-version: 23_0_1
steps:
- name: Calculate Pythons to Expose
id: calculate-pythons-to-expose
run: |
skip=""
if [[ "$(uname -s)" == "Linux" ]]; then
skip="${{ env._PEX_TEST_PYENV_VERSIONS }}"
fi
echo "skip=${skip}" >> $GITHUB_OUTPUT
- name: Checkout Pex
uses: actions/checkout@v3
with:
# We need branches and tags for some ITs.
fetch-depth: 0
- name: Setup PyPy ${{ join(matrix.pypy-version, '.') }}
uses: actions/setup-python@v4
with:
python-version: "pypy-${{ join(matrix.pypy-version, '.') }}"
- name: Expose Pythons
uses: pantsbuild/actions/expose-pythons@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
skip: "${{ steps.calculate-pythons-to-expose.outputs.skip }}"
- name: Install Packages
run: |
# This is needed for `test_requirement_file_from_url` for building `lxml`.
sudo apt install --yes libxslt-dev
- name: Cache Pyenv Interpreters
uses: actions/cache@v3
with:
path: ${{ env._PEX_TEST_PYENV_ROOT }}
key: ${{ runner.os }}-pyenv-root-v9
- name: Setup SSH Agent
uses: webfactory/ssh-agent@v0.5.4
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
if: env.SSH_PRIVATE_KEY != ''
with:
ssh-private-key: ${{ env.SSH_PRIVATE_KEY }}
- name: Run Integration Tests
uses: pantsbuild/actions/run-tox@e63d2d0e3c339bdffbe5e51e7c39550e3bc527bb
with:
tox-env: pypy${{ join(matrix.pypy-version, '') }}-pip${{ matrix.pip-version }}-integration
final-status:
name: Gather Final Status
needs:
- checks
- cpython-unit-tests
- pypy-unit-tests
- cpython-integration-tests
- pypy-integration-tests
runs-on: ubuntu-20.04
steps:
- name: Check Non-Success
if: |
contains(needs.*.result, 'cancelled') ||
contains(needs.*.result, 'failure') ||
contains(needs.*.result, 'skipped')
run: "false"
- name: Success
run: "true"