diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 79edd8a0..7388b0ba 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,6 @@ defaults: shell: bash jobs: - # Make sure the action works using the default settings test-install: name: default ${{ matrix.poetry-version }} ${{ matrix.os }} ${{ matrix.python-version }} @@ -16,7 +15,7 @@ jobs: matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ] - poetry-version: [ "1.1.14", "1.2.2" ] + poetry-version: [ "1.1.15", "1.2.2", "1.3.2" ] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -31,7 +30,6 @@ jobs: poetry install --no-interaction poetry run pytest --version - # Make sure the action sets config options correctly test-config-options: name: non-standard config - ${{ matrix.os }} ${{ matrix.python-version }} @@ -48,49 +46,18 @@ jobs: python-version: "${{ matrix.python-version }}" - uses: ./ with: - version: 1.2.1 + version: 1.3.2 virtualenvs-create: false virtualenvs-in-project: true virtualenvs-path: ~/.cache/test installer-parallel: false - run: | source .github/scripts/assert.sh - assert_in "1.2.1" "$(poetry --version)" - assert_in "false" "$(poetry config virtualenvs.create)" - assert_in "true" "$(poetry config virtualenvs.in-project)" - assert_in "test" "$(poetry config virtualenvs.path)" - assert_in "false" "$(poetry config installer.parallel)" - - - - # Make sure that install dir matches expectations - test-venv-in-project: - name: Check in-project install dir - ${{ matrix.os }} - strategy: - fail-fast: true - matrix: - os: [ ubuntu-latest, macos-latest, windows-latest ] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - uses: ./ - with: - virtualenvs-in-project: true - - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - run: | - source .github/scripts/assert.sh - - echo "Test actual installation directory matches expectations" - output="$(poetry install)" - assert_in "/install-poetry/install-poetry/.venv" "$output" - - echo "..and test that we can source the dir, just to double check" - source $VENV - pytest --version - - + assert_in "1.3.2" "$(poetry --version)" + assert_in "false" "$(poetry config virtualenvs.create)" + assert_in "true" "$(poetry config virtualenvs.in-project)" + assert_in "test" "$(poetry config virtualenvs.path)" + assert_in "false" "$(poetry config installer.parallel)" # Check that installation-arguments works test-installation-arguments: @@ -104,23 +71,20 @@ jobs: source .github/scripts/assert.sh assert_in "1.1.9" "$(poetry --version)" - - - - # Retrieve latest poetry version from PyPI + # Retrieve the latest poetry version from PyPI check-latest: runs-on: ubuntu-latest outputs: latest-poetry-version: ${{ steps.fetch.outputs.version }} steps: - - name: Fetch latest Poetry version from PyPI + - name: Fetch the latest Poetry version from PyPI id: fetch run: | curl -sf 'https://pypi.org/pypi/poetry/json' \ | jq -r '"version=" + .info.version' \ >> $GITHUB_OUTPUT - # Make sure the the action installs the latest version by default + # Make sure the action installs the latest version by default test-latest-version-when-unspecified: needs: check-latest runs-on: ubuntu-latest @@ -132,8 +96,6 @@ jobs: assert_in "." "${{ needs.check-latest.outputs.latest-poetry-version }}" assert_in "${{ needs.check-latest.outputs.latest-poetry-version }}" "$(poetry --version)" - - # Make sure we're able to run the action with both major and minor versions test-major-and-minor-versions: runs-on: ubuntu-latest @@ -141,15 +103,3 @@ jobs: - uses: snok/install-poetry@v1 - uses: snok/install-poetry@v1.1 - uses: snok/install-poetry@v1.2 - - # Legacy: make sure old scripts are not deleted - # The scripts folder contains scripts that are fetched by older versions of the - # action. They're unfortunately fetched from the main branch. - # If we delete these scripts, those versions of the action will fail. - test-scripts-exist: - runs-on: ubuntu-latest - steps: - # v1.1 script loaded in < 1.1.4 - - uses: snok/install-poetry@v1.1.4 - # v1.2 script loaded in > 1.1.4 - - uses: snok/install-poetry@v1.1.6 diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..485dee64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a4554112..3007c18a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-merge-conflict - id: check-case-conflict @@ -10,7 +10,7 @@ repos: - id: mixed-line-ending - repo: https://github.com/sirosen/check-jsonschema - rev: 0.18.3 + rev: 0.21.0 hooks: - id: check-github-actions - id: check-github-workflows diff --git a/poetry.lock b/poetry.lock deleted file mode 100644 index fec0ceac..00000000 --- a/poetry.lock +++ /dev/null @@ -1,207 +0,0 @@ -[[package]] -name = "atomicwrites" -version = "1.4.1" -description = "Atomic file writes." -category = "main" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" - -[[package]] -name = "attrs" -version = "22.1.0" -description = "Classes Without Boilerplate" -category = "main" -optional = false -python-versions = ">=3.5" - -[package.extras] -dev = ["cloudpickle", "coverage[toml] (>=5.0.2)", "furo", "hypothesis", "mypy (>=0.900,!=0.940)", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "sphinx", "sphinx-notfound-page", "zope.interface"] -docs = ["furo", "sphinx", "sphinx-notfound-page", "zope.interface"] -tests = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "zope.interface"] -tests_no_zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy (>=0.900,!=0.940)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins"] - -[[package]] -name = "colorama" -version = "0.4.5" -description = "Cross-platform colored terminal text." -category = "main" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" - -[[package]] -name = "importlib-metadata" -version = "4.12.0" -description = "Read metadata from Python packages" -category = "main" -optional = false -python-versions = ">=3.7" - -[package.dependencies] -typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} -zipp = ">=0.5" - -[package.extras] -docs = ["jaraco.packaging (>=9)", "rst.linker (>=1.9)", "sphinx"] -perf = ["ipython"] -testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)"] - -[[package]] -name = "iniconfig" -version = "1.1.1" -description = "iniconfig: brain-dead simple config-ini parsing" -category = "main" -optional = false -python-versions = "*" - -[[package]] -name = "packaging" -version = "21.3" -description = "Core utilities for Python packages" -category = "main" -optional = false -python-versions = ">=3.6" - -[package.dependencies] -pyparsing = ">=2.0.2,<3.0.5 || >3.0.5" - -[[package]] -name = "pluggy" -version = "1.0.0" -description = "plugin and hook calling mechanisms for python" -category = "main" -optional = false -python-versions = ">=3.6" - -[package.dependencies] -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} - -[package.extras] -dev = ["pre-commit", "tox"] -testing = ["pytest", "pytest-benchmark"] - -[[package]] -name = "py" -version = "1.11.0" -description = "library with cross-python path, ini-parsing, io, code, log facilities" -category = "main" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" - -[[package]] -name = "pyparsing" -version = "3.0.9" -description = "pyparsing module - Classes and methods to define and execute parsing grammars" -category = "main" -optional = false -python-versions = ">=3.6.8" - -[package.extras] -diagrams = ["jinja2", "railroad-diagrams"] - -[[package]] -name = "pytest" -version = "6.2.5" -description = "pytest: simple powerful testing with Python" -category = "main" -optional = false -python-versions = ">=3.6" - -[package.dependencies] -atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} -attrs = ">=19.2.0" -colorama = {version = "*", markers = "sys_platform == \"win32\""} -importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} -iniconfig = "*" -packaging = "*" -pluggy = ">=0.12,<2.0" -py = ">=1.8.2" -toml = "*" - -[package.extras] -testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] - -[[package]] -name = "toml" -version = "0.10.2" -description = "Python Library for Tom's Obvious, Minimal Language" -category = "main" -optional = false -python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" - -[[package]] -name = "typing-extensions" -version = "4.3.0" -description = "Backported and Experimental Type Hints for Python 3.7+" -category = "main" -optional = false -python-versions = ">=3.7" - -[[package]] -name = "zipp" -version = "3.8.1" -description = "Backport of pathlib-compatible object wrapper for zip files" -category = "main" -optional = false -python-versions = ">=3.7" - -[package.extras] -docs = ["jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx"] -testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] - -[metadata] -lock-version = "1.1" -python-versions = ">=3.7" -content-hash = "f4ba9720bbc37743a8770f25deed0e2290d89fc791a8c6ff58b38acfd7b5645a" - -[metadata.files] -atomicwrites = [ - {file = "atomicwrites-1.4.1.tar.gz", hash = "sha256:81b2c9071a49367a7f770170e5eec8cb66567cfbbc8c73d20ce5ca4a8d71cf11"}, -] -attrs = [ - {file = "attrs-22.1.0-py2.py3-none-any.whl", hash = "sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c"}, - {file = "attrs-22.1.0.tar.gz", hash = "sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6"}, -] -colorama = [ - {file = "colorama-0.4.5-py2.py3-none-any.whl", hash = "sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da"}, - {file = "colorama-0.4.5.tar.gz", hash = "sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4"}, -] -importlib-metadata = [ - {file = "importlib_metadata-4.12.0-py3-none-any.whl", hash = "sha256:7401a975809ea1fdc658c3aa4f78cc2195a0e019c5cbc4c06122884e9ae80c23"}, - {file = "importlib_metadata-4.12.0.tar.gz", hash = "sha256:637245b8bab2b6502fcbc752cc4b7a6f6243bb02b31c5c26156ad103d3d45670"}, -] -iniconfig = [ - {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, - {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, -] -packaging = [ - {file = "packaging-21.3-py3-none-any.whl", hash = "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522"}, - {file = "packaging-21.3.tar.gz", hash = "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb"}, -] -pluggy = [ - {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, - {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, -] -py = [ - {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, - {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, -] -pyparsing = [ - {file = "pyparsing-3.0.9-py3-none-any.whl", hash = "sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"}, - {file = "pyparsing-3.0.9.tar.gz", hash = "sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"}, -] -pytest = [ - {file = "pytest-6.2.5-py3-none-any.whl", hash = "sha256:7310f8d27bc79ced999e760ca304d69f6ba6c6649c0b60fb0e04a4a77cacc134"}, - {file = "pytest-6.2.5.tar.gz", hash = "sha256:131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89"}, -] -toml = [ - {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, - {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, -] -typing-extensions = [ - {file = "typing_extensions-4.3.0-py3-none-any.whl", hash = "sha256:25642c956049920a5aa49edcdd6ab1e06d7e5d467fc00e0506c44ac86fbfca02"}, - {file = "typing_extensions-4.3.0.tar.gz", hash = "sha256:e6d2677a32f47fc7eb2795db1dd15c1f34eff616bcaf2cfb5e997f854fa1c4a6"}, -] -zipp = [ - {file = "zipp-3.8.1-py3-none-any.whl", hash = "sha256:47c40d7fe183a6f21403a199b3e4192cca5774656965b0a4988ad2f8feb5f009"}, - {file = "zipp-3.8.1.tar.gz", hash = "sha256:05b45f1ee8f807d0cc928485ca40a07cb491cf092ff587c0df9cb1fd154848d2"}, -] diff --git a/scripts/README.md b/scripts/README.md deleted file mode 100644 index eb305387..00000000 --- a/scripts/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The scripts in the scripts folder should not ever change. - -Previous versions of the action would curl scripts from the repos main branch, -meaning that if we remove them, old pinned versions of the action will break. diff --git a/scripts/v1.1/main.sh b/scripts/v1.1/main.sh deleted file mode 100755 index 2a7eb90b..00000000 --- a/scripts/v1.1/main.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -# Give inputs sensible names -os=$1 -venv_create=$2 -venv_in_project=$3 -venv_path=$4 - -# Define OS specific help text -if [ "$os" == "Windows" ]; then - conf="\033[33mConfiguring Poetry for Windows!\033[0m" - act="source .venv/scripts/activate" - echo "VENV=.venv/scripts/activate" >>"$GITHUB_ENV" -else - conf="\033[33mConfiguring Poetry!\033[0m" - act="source .venv/bin/activate" - echo "VENV=.venv/bin/activate" >>"$GITHUB_ENV" -fi - -# Echo help texts -echo -e "\n\n-------------------------------------------------------------------------------\n\n$conf 🎉" -if [ "$venv_create" == true ] || [ "$venv_create" == "true" ]; then - # If user is creating a venv in-project we tell them how to activate venv - echo -e "\n\n\033[33mIf you are creating a venv in your project, you can activate it by running '$act'\033[0m" - echo -e "\n\033[33mIf you're running this in an OS matrix, use 'source \$VENV'\033[0m" -fi -if [ "$os" == "Windows" ]; then - # If $SHELL isn't some variation of bash, output a yellow-texted warning - echo -e "\n\n\033[33mMake sure to set your default shell to bash when on Windows.\033[0m" - echo -e "\n\033[33mSee the package docs for more information and examples.\033[0m" -fi -echo -e '\n-------------------------------------------------------------------------------\n' - -# Configure Poetry -if [ "$os" == "Windows" ]; then - ln -s "$HOME/.poetry/bin/poetry.bat" "poetry" - "$HOME/.poetry/bin/poetry.bat" config virtualenvs.create "$venv_create" - "$HOME/.poetry/bin/poetry.bat" config virtualenvs.in-project "$venv_in_project" - "$HOME/.poetry/bin/poetry.bat" config virtualenvs.path "$venv_path" -else - source "$HOME"/.poetry/env - poetry config virtualenvs.create "$venv_create" - poetry config virtualenvs.in-project "$venv_in_project" - poetry config virtualenvs.path "$venv_path" -fi diff --git a/scripts/v1.2/main.sh b/scripts/v1.2/main.sh deleted file mode 100644 index 37ee2cd4..00000000 --- a/scripts/v1.2/main.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -# Give inputs sensible names -os=$1 -venv_create=$2 -venv_in_project=$3 -venv_path=$4 -version=$5 -installation_script=$6 - -# Set path for each OS - done because Poetry inference is inconsistent -# on mac-runners, and we need to know the install path so we can add it to $GITHUB_PATH -if [ "$os" == "Windows" ]; then - path="C:/Users/runneradmin/AppData/Roaming/Python/Scripts/" -else - path="$HOME/.local/" -fi - -# Install Poetry -POETRY_HOME=$path python3 $installation_script --yes --version=$version - -# Add to path -echo "$path/bin" >>$GITHUB_PATH -export PATH="$path/bin:$PATH" - -# Configure Poetry -if [ "$os" == "Windows" ]; then - # Adding to path on windows doesn't immediately take effect - # so calling the executable directly here - should be available - # in next steps regardless. - "$path/bin/poetry.exe" config virtualenvs.create "$venv_create" - "$path/bin/poetry.exe" config virtualenvs.in-project "$venv_in_project" - "$path/bin/poetry.exe" config virtualenvs.path "$venv_path" -else - poetry config virtualenvs.create "$venv_create" - poetry config virtualenvs.in-project "$venv_in_project" - poetry config virtualenvs.path "$venv_path" -fi - -# Define OS specific help texts -if [ "$os" == "Windows" ]; then - conf="\033[33mConfiguring Poetry for Windows!\033[0m" - act="source .venv/scripts/activate" - echo "VENV=.venv/scripts/activate" >>"$GITHUB_ENV" -else - conf="\033[33mConfiguring Poetry!\033[0m" - act="source .venv/bin/activate" - echo "VENV=.venv/bin/activate" >>"$GITHUB_ENV" -fi - -# Output help texts -echo -e "\n\n-------------------------------------------------------------------------------\n\n$conf 🎉" -if [ "$venv_create" == true ] || [ "$venv_create" == "true" ]; then - # If user is creating a venv in-project we tell them how to activate venv - echo -e "\n\n\033[33mIf you are creating a venv in your project, you can activate it by running '$act'\033[0m" - echo -e "\n\033[33mIf you're running this in an OS matrix, use 'source \$VENV'\033[0m" -fi -if [ "$os" == "Windows" ]; then - # If $SHELL isn't some variation of bash, output a yellow-texted warning - echo -e "\n\n\033[33mMake sure to set your default shell to bash when on Windows.\033[0m" - echo -e "\n\033[33mSee the github action docs for more information and examples.\033[0m" -fi -echo -e '\n-------------------------------------------------------------------------------\n'