Skip to content

Commit

Permalink
chore: Add failing tests to reproduce #94
Browse files Browse the repository at this point in the history
  • Loading branch information
sondrelg committed Oct 11, 2022
1 parent 1b4b0b9 commit e3319e0
Showing 1 changed file with 151 additions and 127 deletions.
278 changes: 151 additions & 127 deletions .github/workflows/test.yml
Expand Up @@ -7,144 +7,168 @@ 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 }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11.0-rc.2" ]
poetry-version: [ "1.1.14", "1.2.2" ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: ./
with:
version: "${{ matrix.poetry-version }}"
- uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python-version }}"
- run: |
poetry install --no-root --no-interaction
poetry install --no-interaction
poetry run pytest --version
# Make sure the action sets config options correctly
test-config-options:
name: Set non-standard config options - ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
failing:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: ./
python-version: 3.8
- uses: snok/install-poetry@main
with:
version: 1.2.1
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 }}
working:
runs-on: windows-latest
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
# Check that installation-arguments works
test-installation-arguments:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
python-version: 3.8
- uses: ./
with:
installation-arguments: --git https://github.com/python-poetry/poetry.git@69bd6820e320f84900103fdf867e24b355d6aa5d
- run: |
source .github/scripts/assert.sh
assert_in "1.1.9" "$(poetry --version)"
# Retrieve 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
id: fetch
run: echo "::set-output name=version::$(python -c "import requests;response = requests.get(f'https://pypi.org/pypi/poetry/json');latest_version = response.json()['info']['version'];print(latest_version)")"

# Make sure the the action installs the latest version by default
test-latest-version-when-unspecified:
needs: check-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./
- run: |
source .github/scripts/assert.sh
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
steps:
- 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
version: 1.2.1
virtualenvs-create: false
#
# # Make sure the action works using the default settings
# test-install:
# name: default ${{ matrix.poetry-version }} ${{ matrix.os }} ${{ matrix.python-version }}
# strategy:
# fail-fast: true
# matrix:
# os: [ ubuntu-latest, macos-latest, windows-latest ]
# python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11.0-rc.2" ]
# poetry-version: [ "1.1.14", "1.2.2" ]
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v3
# - uses: ./
# with:
# version: "${{ matrix.poetry-version }}"
# - uses: actions/setup-python@v4
# with:
# python-version: "${{ matrix.python-version }}"
# - run: |
# poetry install --no-root --no-interaction
# poetry install --no-interaction
# poetry run pytest --version
#
#
# # Make sure the action sets config options correctly
# test-config-options:
# name: Set non-standard config options - ${{ matrix.os }}
# strategy:
# fail-fast: true
# matrix:
# os: [ ubuntu-latest, macos-latest, windows-latest ]
# runs-on: ${{ matrix.os }}
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: "3.10"
# - uses: ./
# with:
# version: 1.2.1
# 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
#
#
#
# # Check that installation-arguments works
# test-installation-arguments:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: ./
# with:
# installation-arguments: --git https://github.com/python-poetry/poetry.git@69bd6820e320f84900103fdf867e24b355d6aa5d
# - run: |
# source .github/scripts/assert.sh
# assert_in "1.1.9" "$(poetry --version)"
#
#
#
#
# # Retrieve 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
# id: fetch
# run: echo "::set-output name=version::$(python -c "import requests;response = requests.get(f'https://pypi.org/pypi/poetry/json');latest_version = response.json()['info']['version'];print(latest_version)")"
#
# # Make sure the the action installs the latest version by default
# test-latest-version-when-unspecified:
# needs: check-latest
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: ./
# - run: |
# source .github/scripts/assert.sh
# 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
# steps:
# - 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

0 comments on commit e3319e0

Please sign in to comment.