|
| 1 | +name: Test Installation Script |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - 'install-poetry.py' |
| 7 | + - '.github/workflows/installer.yml' |
| 8 | + branches: |
| 9 | + - master |
| 10 | + pull_request: |
| 11 | + paths: |
| 12 | + - 'install-poetry.py' |
| 13 | + - '.github/workflows/installer.yml' |
| 14 | + branches: |
| 15 | + - '**' |
| 16 | + |
| 17 | +jobs: |
| 18 | + default: |
| 19 | + name: ${{ matrix.os }} / ${{ matrix.python-version }} / install-poetry.py ${{ matrix.args }} |
| 20 | + runs-on: ${{ matrix.os }}-latest |
| 21 | + strategy: |
| 22 | + matrix: |
| 23 | + os: [ Ubuntu, MacOS, Windows ] |
| 24 | + python-version: [ "3.6", "3.7", "3.8", "3.9", "3.10" ] |
| 25 | + args: |
| 26 | + - "" |
| 27 | + - "--preview" |
| 28 | + - "--git https://github.com/python-poetry/poetry.git" |
| 29 | + - "--version 1.1.11" |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v2 |
| 32 | + |
| 33 | + - name: Set up Python ${{ matrix.python-version }} |
| 34 | + uses: actions/setup-python@v2 |
| 35 | + with: |
| 36 | + python-version: ${{ matrix.python-version }} |
| 37 | + |
| 38 | + - name: Update PATH |
| 39 | + if: ${{ matrix.os != 'Windows' }} |
| 40 | + shell: bash |
| 41 | + run: echo "$HOME/.local/bin" >> $GITHUB_PATH |
| 42 | + |
| 43 | + - name: Update PATH for Windows |
| 44 | + if: ${{ matrix.os == 'Windows' }} |
| 45 | + shell: bash |
| 46 | + run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH |
| 47 | + |
| 48 | + - name: Install Poetry |
| 49 | + shell: bash |
| 50 | + run: python install-poetry.py -y |
| 51 | + |
| 52 | + - name: Verify Installation |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + set -e |
| 56 | + poetry new foobar |
| 57 | + cd foobar |
| 58 | + poetry config virtualenvs.in-project true |
| 59 | + poetry env use python |
| 60 | + [ "$(poetry run python --version)" == "$(python --version)" ] \ |
| 61 | + || { echo >&2 "ERROR: Virtual environment Python version do not match system version." && exit 1; } |
| 62 | +
|
| 63 | + - name: Uninstall Poetry |
| 64 | + shell: bash |
| 65 | + run: | |
| 66 | + python install-poetry.py -y --uninstall |
| 67 | + { type poetry 2>/dev/null >&2 && exit 1; } || exit 0 |
0 commit comments