try fix rtd build #259
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
push: # runs on everything | |
pull_request: # runs on everything | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
django-version: | |
- '3.2' # LTS April 2024 | |
- '4.2' # LTS April 2026 | |
- '5.0' # April 2025 | |
exclude: | |
- python-version: '3.8' | |
django-version: '5.0' | |
- python-version: '3.9' | |
django-version: '5.0' | |
- python-version: '3.11' | |
django-version: '3.2' | |
- python-version: '3.12' | |
django-version: '3.2' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Install Release Dependencies | |
run: | | |
poetry config virtualenvs.in-project true | |
poetry run pip install --upgrade pip | |
poetry install | |
poetry run pip install -U "Django~=${{ matrix.django-version }}" | |
# - name: Setup tmate session | |
# uses: mxschmitt/action-tmate@v3 | |
# with: | |
# detached: true | |
# timeout-minutes: 60 | |
- name: Run Unit Tests | |
run: | | |
poetry run pip install colorama | |
poetry run pytest | |
poetry run pip uninstall -y rich | |
poetry run pytest --cov-append | |
poetry run pip uninstall -y colorama | |
poetry run pytest -k test_ctor_params --cov-append | |
mv .coverage py${{ matrix.python-version }}-dj${{ matrix.django-version }}.coverage | |
- name: Store coverage files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-py${{ matrix.python-version }}-dj${{ matrix.django-version }} | |
path: py${{ matrix.python-version }}-dj${{ matrix.django-version }}.coverage | |
linux-shell-completion: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.12'] | |
django-version: | |
- '3.2' # LTS April 2024 | |
- '5.0' # April 2025 | |
exclude: | |
- python-version: '3.8' | |
django-version: '5.0' | |
- python-version: '3.12' | |
django-version: '3.2' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Install Release Dependencies | |
run: | | |
poetry config virtualenvs.in-project true | |
poetry run pip install --upgrade pip | |
poetry install | |
poetry run pip install -U "Django~=${{ matrix.django-version }}" | |
- name: Install Fish shell | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y fish | |
- name: Run Unit Tests | |
run: | | |
poetry run pytest django_typer/tests/completion_tests.py | |
mv .coverage linux-complete-py${{ matrix.python-version }}-dj${{ matrix.django-version }}.coverage | |
- name: Store coverage files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-linux-complete-py${{ matrix.python-version }}-dj${{ matrix.django-version }} | |
path: linux-complete-py${{ matrix.python-version }}-dj${{ matrix.django-version }}.coverage | |
macos-shell-completion: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.12'] | |
django-version: | |
- '3.2' # LTS April 2024 | |
- '5.0' # April 2025 | |
exclude: | |
- python-version: '3.8' | |
django-version: '5.0' | |
- python-version: '3.12' | |
django-version: '3.2' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Homebrew and Zshell Completion | |
shell: zsh {0} | |
run: | | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" | |
touch ~/.zshrc | |
(echo; echo 'eval "$(brew shellenv)"') >> ~/.zshrc | |
eval "$(brew shellenv)" | |
brew install zsh-completions | |
echo "if type brew &>/dev/null; then" >> ~/.zshrc | |
echo " FPATH=~/.zfunc:$(brew --prefix)/share/zsh-completions:$FPATH" >> ~/.zshrc | |
echo " autoload -Uz compinit" >> ~/.zshrc | |
echo " compinit" >> ~/.zshrc | |
echo "fi" >> ~/.zshrc | |
echo "fpath+=~/.zfunc" >> ~/.zshrc | |
chmod go-w /usr/local/share | |
chmod -R go-w /usr/local/share/zsh | |
source ~/.zshrc | |
sudo chsh -s /bin/zsh runner | |
- name: Install Bash Completions | |
shell: bash | |
run: | | |
brew install bash-completion@2 | |
touch ~/.bashrc | |
echo "\n[[ -r "$(brew --prefix)/etc/profile.d/bash_completion.sh" ]] && . "$(brew --prefix)/etc/profile.d/bash_completion.sh" || true" >> ~/.bash_profile | |
source ~/.bashrc | |
- name: Install Fish shell | |
run: | | |
brew install fish | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Install Release Dependencies | |
run: | | |
poetry config virtualenvs.in-project true | |
poetry run pip install --upgrade pip | |
poetry install | |
poetry run pip install -U "Django~=${{ matrix.django-version }}" | |
- name: Run Unit Tests | |
shell: zsh {0} | |
run: | | |
poetry run pytest django_typer/tests/completion_tests.py::ZshShellTests || exit 1 | |
mv .coverage macos-complete-py${{ matrix.python-version }}-dj${{ matrix.django-version }}.coverage | |
- name: Store coverage files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-macos-complete-py${{ matrix.python-version }}-dj${{ matrix.django-version }} | |
path: macos-complete-py${{ matrix.python-version }}-dj${{ matrix.django-version }}.coverage | |
# windows-shell-completion: | |
# runs-on: windows-latest | |
# strategy: | |
# matrix: | |
# python-version: ['3.8', '3.12'] | |
# django-version: | |
# - '3.2' # LTS April 2024 | |
# - '5.0' # April 2025 | |
# exclude: | |
# - python-version: '3.8' | |
# django-version: '5.0' | |
# - python-version: '3.12' | |
# django-version: '3.2' | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Set up Python ${{ matrix.python-version }} | |
# uses: actions/setup-python@v5 | |
# with: | |
# python-version: ${{ matrix.python-version }} | |
# - name: Install Poetry | |
# uses: snok/install-poetry@v1 | |
# with: | |
# virtualenvs-create: true | |
# virtualenvs-in-project: true | |
# - name: Add to Poetry to PATH | |
# run: echo "C:\Users\runneradmin\.local\bin" >> $env:GITHUB_PATH | |
# shell: powershell | |
# - name: Install Release Dependencies | |
# run: | | |
# poetry config virtualenvs.in-project true | |
# poetry run pip install --upgrade pip | |
# poetry install | |
# poetry run pip install -U "Django~=${{ matrix.django-version }}" | |
# shell: powershell | |
# - name: Run Unit Tests | |
# run: | | |
# poetry run pytest django_typer/tests/completion_tests.py::PowerShellTests | |
# mv .coverage windows-complete-py${{ matrix.python-version }}-dj${{ matrix.django-version }}.coverage | |
# shell: powershell | |
# - name: Store coverage files | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: coverage-windows-complete-py${{ matrix.python-version }}-dj${{ matrix.django-version }} | |
# path: windows-complete-py${{ matrix.python-version }}-dj${{ matrix.django-version }}.coverage | |
coverage-combine: | |
needs: [test, linux-shell-completion, macos-shell-completion] #, windows-shell-completion] | |
runs-on: ubuntu-latest | |
steps: | |
# - name: Setup tmate session | |
# uses: mxschmitt/action-tmate@v3 | |
# with: | |
# detached: true | |
# timeout-minutes: 15 | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Install Release Dependencies | |
run: | | |
poetry config virtualenvs.in-project true | |
poetry run pip install --upgrade pip | |
poetry install | |
- name: Get coverage files | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: coverage-* | |
merge-multiple: true | |
- run: ls -la *.coverage | |
- run: poetry run coverage combine --keep *.coverage | |
- run: poetry run coverage report | |
- run: poetry run coverage xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
verbose: true |