diff --git a/.github/actions/install-requirement/action.yml b/.github/actions/install-requirement/action.yml new file mode 100644 index 00000000..7698c494 --- /dev/null +++ b/.github/actions/install-requirement/action.yml @@ -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/checkout@v4.1.6 + 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 }}")" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f361ded..e17a2826 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -184,6 +184,77 @@ 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/checkout@v4.1.6 + with: + repository: beeware/.github + path: repos/.github + +# - name: Checkout beeware/briefcase +# uses: actions/checkout@v4.1.6 +# with: +# repository: beeware/briefcase +# +# - name: Checkout beeware/briefcase to path +# uses: actions/checkout@v4.1.6 +# with: +# repository: beeware/briefcase +# path: repos/briefcase + + - name: Tree + run: tree -a ./ + + - name: Set up Python + uses: actions/setup-python@v5.1.0 + 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 ] diff --git a/scripts/__pycache__/install_requirement.cpython-312.pyc b/scripts/__pycache__/install_requirement.cpython-312.pyc new file mode 100644 index 00000000..f7db9741 Binary files /dev/null and b/scripts/__pycache__/install_requirement.cpython-312.pyc differ diff --git a/scripts/install_requirement.py b/scripts/install_requirement.py index 0c604a2f..623edcec 100644 --- a/scripts/install_requirement.py +++ b/scripts/install_requirement.py @@ -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