remove circular dependency on export plugin #8574
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
paths-ignore: | |
- 'docs/**' | |
- '.cirrus.yml' | |
- '.github/workflows/docs.yml' | |
branches: | |
- master | |
- develop | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
- '.cirrus.yml' | |
- '.github/workflows/docs.yml' | |
branches: | |
- '**' | |
concurrency: | |
group: tests-${{ github.head_ref || github.ref }} | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
jobs: | |
tests: | |
name: ${{ matrix.os }} / ${{ matrix.python-version }} | |
runs-on: ${{ matrix.image }} | |
strategy: | |
matrix: | |
os: [Ubuntu, macOS, Windows] | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
include: | |
- os: Ubuntu | |
image: ubuntu-22.04 | |
- os: Windows | |
image: windows-2022 | |
- os: macOS | |
image: macos-12 | |
fail-fast: false | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: poetry | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get full Python version | |
id: full-python-version | |
run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT | |
- name: Bootstrap poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python - -y | |
- name: Update PATH | |
if: ${{ matrix.os != 'Windows' }} | |
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- name: Update Path for Windows | |
if: ${{ matrix.os == 'Windows' }} | |
run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH | |
- name: Enable long paths for git on Windows | |
if: ${{ matrix.os == 'Windows' }} | |
# Enable handling long path names (+260 char) on the Windows platform | |
# https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation | |
run: git config --system core.longpaths true | |
- name: Configure poetry | |
run: poetry config virtualenvs.in-project true | |
- name: Set up cache | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Ensure cache is healthy | |
if: steps.cache.outputs.cache-hit == 'true' | |
working-directory: ./poetry | |
run: | | |
# `timeout` is not available on macOS, so we define a custom function. | |
[ "$(command -v timeout)" ] || function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; } | |
# Using `timeout` is a safeguard against the Poetry command hanging for some reason. | |
timeout 10s poetry run pip --version || rm -rf .venv | |
- name: Check lock file | |
working-directory: ./poetry | |
run: poetry check --lock | |
- name: Install dependencies | |
working-directory: ./poetry | |
run: poetry install --with github-actions | |
- name: Run mypy | |
working-directory: ./poetry | |
run: poetry run mypy | |
- name: Run pytest | |
working-directory: ./poetry | |
env: | |
POETRY_TEST_INTEGRATION_GIT_USERNAME: ${GITHUB_ACTOR} | |
POETRY_TEST_INTEGRATION_GIT_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
run: poetry run pytest --integration -v | |
- name: Get Plugin Version (poetry-plugin-export) | |
id: poetry-plugin-export-version | |
run: | | |
PLUGIN_VERSION=$(curl -s https://pypi.org/pypi/poetry-plugin-export/json | python -c 'import json, sys ; print(json.load(sys.stdin)["info"]["version"])') | |
echo "Found version ${PLUGIN_VERSION}" | |
echo version=${PLUGIN_VERSION} >> $GITHUB_OUTPUT | |
- name: Checkout Plugin Source (poetry-plugin-export) | |
uses: actions/checkout@v4 | |
with: | |
path: poetry-plugin-export | |
repository: python-poetry/poetry-plugin-export | |
ref: refs/tags/${{ steps.poetry-plugin-export-version.outputs.version }} | |
- name: Update poetry version (poetry-plugin-export) | |
working-directory: poetry-plugin-export | |
run: | | |
poetry add --lock --dev ../poetry | |
git diff | |
- name: Install (poetry-plugin-export) | |
working-directory: ./poetry-plugin-export | |
run: poetry install | |
- name: Run pytest (poetry-plugin-export) | |
working-directory: ./poetry-plugin-export | |
run: poetry run python -m pytest -p no:sugar -q tests/ | |
- name: Check for clean working tree | |
working-directory: ./poetry | |
run: git diff --exit-code --stat HEAD | |
- name: Check for clean working tree (poetry-plugin-export) | |
working-directory: ./poetry-plugin-export | |
run: | | |
git checkout -- pyproject.toml poetry.lock | |
git diff --exit-code --stat HEAD |