Skip to content

Merge pull request #256 from KapJI/type-add-argument-to-container #1345

Merge pull request #256 from KapJI/type-add-argument-to-container

Merge pull request #256 from KapJI/type-add-argument-to-container #1345

Workflow file for this run

name: ci
on:
push:
pull_request:
schedule: [{cron: '0 9 * * 1'}] # M H d m w (Mondays at 9:00)
workflow_dispatch:
jobs:
test:
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
strategy:
matrix:
python: ['3.x']
os: [ubuntu, macos, windows]
include: [{python: 3.9, os: ubuntu}] # min supported (see pyproject.toml)
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v7
with: {fetch-depth: 0}
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python }}
- if: matrix.os == 'ubuntu'
run: sudo apt-get update && sudo apt-get install -y zsh fish tcsh # generated-script tests
- run: pip install -e .[dev]
- run: env PYTHONPATH=. pytest --cov-report=xml --cov-report=term ${{ matrix.os == 'windows' && '-k "not bash" --cov-fail-under=75' || '' }}
- uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ matrix.python }}-${{ matrix.os }}
diff:
if: (github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)) && github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with: {fetch-depth: 0}
- uses: actions/setup-python@v7
with: {python-version: '3.x'}
- name: diff examples
run: |
pip install -e .
git checkout main
SHELLS=$(python -c "import shtab; print(' '.join(shtab.SUPPORTED_SHELLS))")
git checkout -
ref=$(git rev-parse --abbrev-ref HEAD)
mkdir -p "$ref" main
for s in $SHELLS; do
echo "::group::$s"
for r in main "$ref"; do
git checkout -
python examples/pathcomplete.py -s $s > "$r/pathcomplete.$s" || :
python examples/customcomplete.py completion $s > "$r/customcomplete.$s" || :
done
for ex in pathcomplete customcomplete; do
d=$(diff {main,"$ref"}/$ex.$s || :)
if test -n "$d"; then
echo "::warning file=examples/$ex.py,line=1,title=$s::changes detected"
cat <<EOF >> "$GITHUB_STEP_SUMMARY"
# warning: $ex.$s
\`\`\`diff
$d
\`\`\`
EOF
fi
done
echo "::endgroup::"
done
cat "$GITHUB_STEP_SUMMARY"
test -z "$(cat "$GITHUB_STEP_SUMMARY")"
deploy:
needs: test
runs-on: ubuntu-latest
environment: pypi
permissions: {contents: write, id-token: write}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN || github.token }}
- uses: actions/setup-python@v7
with: {python-version: '3.x'}
- id: dist
uses: casperdcl/deploy-pypi@v3
with:
build: true
upload: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
name: gh release create --draft
run: |
changelog=$(git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD)
tag="${GITHUB_REF#refs/tags/}"
gh release create --title "shtab $tag stable" --draft --notes "$changelog" "$tag" dist/${{ steps.dist.outputs.whl }} dist/${{ steps.dist.outputs.targz }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: build docs
run: |
pushd docs
pip install -U -r requirements.txt
PYTHONPATH=. pydoc-markdown --build --site-dir=../../../dist/site
popd
- if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') || github.event_name == 'workflow_dispatch' }}
uses: casperdcl/push-dir@v1
with:
message: update static site
branch: gh-pages
history: false
dir: dist/site
nojekyll: true
name: tqdm[bot]
email: 68520887+tqdm-bot@users.noreply.github.com