diff --git a/.github/actions/prepare-tox/action.yml b/.github/actions/prepare-tox/action.yml new file mode 100644 index 0000000..2e0a409 --- /dev/null +++ b/.github/actions/prepare-tox/action.yml @@ -0,0 +1,15 @@ +# A composite action to prepare tox-based workflows + +name: "Prepare tox" + +description: "Prepare tox-based workflows" + +runs: + using: "composite" + steps: + - name: "Ensure upgraded pip" + run: pip install --upgrade pip + shell: bash + - name: "Install tox" + run: pip install tox + shell: bash diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 3aef287..85fca23 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,5 +1,4 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python +# This workflow will build and deploy the FIREWHEEL documentation name: Documentation @@ -38,9 +37,7 @@ jobs: with: python-version: '3.x' - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install tox + uses: ./.github/actions/prepare-tox - name: Build Documentation run: | tox -e dependencies,docs @@ -60,4 +57,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 \ No newline at end of file + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index abd0f5e..3ea30a7 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -1,4 +1,4 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# This workflow will install Python dependencies and lint with a variety of Python versions # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python name: Linting @@ -27,9 +27,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install tox + uses: ./.github/actions/prepare-tox - name: Lint code run: | tox -e lint diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml new file mode 100644 index 0000000..632aab0 --- /dev/null +++ b/.github/workflows/testing.yml @@ -0,0 +1,31 @@ +# This workflow will install Python dependencies and run tests with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Testing + +on: + push: + branches: [ "*" ] + pull_request: + branches: [ "main" ] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: | + 3.8 + 3.9 + 3.10 + 3.11 + 3.12 + 3.13 + - name: Install dependencies + uses: ./.github/actions/prepare-tox + - name: Run unit tests + run: | + tox -e py38,py39,py310,py311,py312,py313 diff --git a/src/firewheel/tests/unit/cli/test_cli_completion.py b/src/firewheel/tests/unit/cli/test_cli_completion.py index 58f5f32..b379ff1 100644 --- a/src/firewheel/tests/unit/cli/test_cli_completion.py +++ b/src/firewheel/tests/unit/cli/test_cli_completion.py @@ -3,6 +3,7 @@ from pathlib import Path from unittest.mock import Mock, patch, mock_open +from firewheel.config import config from firewheel.cli.completion import COMPLETION_SCRIPT_PATH from firewheel.cli.completion.actions import ( _keyboard_interruptable, @@ -95,8 +96,8 @@ def test_populate_template(self): mock_handle.write.assert_called_once() script_content = mock_handle.write.call_args.args[0] filled_placeholders = [ - 'fw_venv="/opt/firewheel/fwpy"', - 'python_bin="python3"', + f"fw_venv=\"{config['python']['venv']}\"", + f"python_bin=\"{config['python']['bin']}\"", ] assert all(_ in script_content for _ in filled_placeholders)