Skip to content

Commit

Permalink
Introduce Action to run install_requirement.py
Browse files Browse the repository at this point in the history
  • Loading branch information
rmartin16 committed May 28, 2024
1 parent eb2307a commit 4d25e38
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 4 deletions.
37 changes: 37 additions & 0 deletions .github/actions/install-requirement/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Install Project Requirements
description: Install requirements from a PEP 517 project

inputs:
requirements:
description: "Whitespace-delimited list of project requirements to install."
required: true
project-root:
description: "The filesystem path to the root of the project to install from; defaults to github.workspace."
default: ${{ github.workspace }}
extra:
description: "Name of the optional dependencies marker; e.g. dev."
required: false
default: ""

runs:
using: composite
steps:
- name: Checkout beeware/.github
uses: actions/[email protected]
with:
repository: beeware/.github
path: .github-beeware

- name: Install Dependencies
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools build wheel
- name: Install Requirements
working-directory: ./.github-beeware/scripts
shell: bash
run: >
python -m install_requirement ${{ inputs.requirements }}
--extra "${{ inputs.extra }}"
--project-root "$(printf -- "%q" "${{ inputs.project-root }}")"
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,73 @@ jobs:
repo: toga
build-subdir: android

test-install-requirements:
name: Install Requirements
needs: pre-commit
runs-on: ${{ matrix.runner-os }}
strategy:
fail-fast: false
matrix:
runner-os: [ macos-latest, windows-latest, ubuntu-latest ]
steps:
- name: Checkout beeware/.github
uses: actions/[email protected]
with:
path: repos/.github

- name: Checkout beeware/briefcase
uses: actions/[email protected]
with:
repository: beeware/briefcase

- name: Checkout beeware/briefcase to path
uses: actions/[email protected]
with:
repository: beeware/briefcase
path: repos/briefcase

- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.x"

- name: Test Install Requirements with Path
uses: ./repos/.github/.github/actions/install-requirement
with:
requirements: "pre-commit tox"
extra: "dev"
project-path: "repos/briefcase"

- name: Test Install Requirements
uses: ./repos/.github/.github/actions/install-requirement
with:
requirements: "coverage"
extra: "dev"

- name: Test Install Requirements
uses: ./repos/.github/.github/actions/install-requirement
with:
requirements: "cookiecutter"

- name: Verify Requirements Installed
run: |
if ! python -m pip list | grep tox; then
echo '::error::Failed to install tox'
exit 1
fi
if ! python -m pip list | grep pre-commit; then
echo '::error::Failed to install pre-commit'
exit 1
fi
if ! python -m pip list | grep coverage; then
echo '::error::Failed to install coverage'
exit 1
fi
if ! python -m pip list | grep cookiecutter; then
echo '::error::Failed to install cookiecutter'
exit 1
fi
test-verify-projects-briefcase:
name: Verify Project
needs: [ pre-commit, test-package-python ]
Expand Down
Binary file not shown.
5 changes: 1 addition & 4 deletions scripts/install_requirement.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
# Install one or more PEP 517 project defined requirements
#
# positional arguments:
# requirements List of project requirements to install. Any project
# requirements that start with any of these values will
# be installed. For instance, including 'pytest' in this
# list would install both pytest and pytest-xdist.
# requirements Whitespace-delimited list of project requirements to install.
#
# options:
# -h, --help show this help message and exit
Expand Down

0 comments on commit 4d25e38

Please sign in to comment.