Skip to content

Fix cidentlist handling of single quotes in numeric literals (#288) #351

Fix cidentlist handling of single quotes in numeric literals (#288)

Fix cidentlist handling of single quotes in numeric literals (#288) #351

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [macos-14, windows-2022, ubuntu-22.04]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
exclude:
- os: macos-14
python-version: '3.8'
- os: macos-14
python-version: '3.9'
name: Test - ${{ matrix.os }}, ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch all history and metadata
run: |
git checkout -b pr
git branch -f main origin/main
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: pip install build
- name: Install wpiformat
run: |
cd wpiformat
python -m build --wheel
pip install dist/*.whl
shell: bash
- name: Install test dependencies
run: pip install tox
- name: Run unit tests
run: |
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
cd wpiformat
tox
- name: wpiformat - whole repo
run: |
cd wpiformat
python -m wpiformat -v
- name: wpiformat - one file
run: |
cd wpiformat
python -m wpiformat -f wpiformat/__init__.py -v
- name: wpiformat - absolute path to file
shell: bash
run: |
cd wpiformat
python -m wpiformat -f $GITHUB_WORKSPACE/wpiformat/wpiformat/__init__.py -v
- name: wpiformat - multiple files
run: |
cd wpiformat
python -m wpiformat -f wpiformat/__init__.py wpiformat/__main__.py -v
- name: wpiformat - directory
run: |
cd wpiformat
python -m wpiformat -f wpiformat -v
# Verify wpiformat reports an error if no master or main branch exists
- name: Git repo with no branches
shell: bash
run: |
rm -rf branch-test
mkdir branch-test && cd branch-test && git init
if wpiformat; then
exit 1
fi
# Verify wpiformat reports success if "master" exists
- name: Git repo with master branch
shell: bash
run: |
rm -rf branch-test
mkdir branch-test && cd branch-test && git init
git checkout -b master
touch .styleguide
git add .styleguide && git commit -q -m "Initial commit"
wpiformat
# Verify wpiformat reports success if "main" exists
- name: Git repo with main branch
shell: bash
run: |
rm -rf branch-test
mkdir branch-test && cd branch-test && git init
git checkout -b main
touch .styleguide
git add .styleguide && git commit -q -m "Initial commit"
wpiformat
- name: Delete branch-test folder
shell: bash
run: rm -rf branch-test
- name: Ensure formatter made no changes
run: git --no-pager diff --exit-code HEAD
publish:
name: Publish
runs-on: ubuntu-latest
needs: [test]
if: ${{ github.repository_owner == 'wpilibsuite' && github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Python dependencies
run: pip install build
- name: Build package
run: python -m build
working-directory: wpiformat
- name: Upload package to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: wpiformat/dist
password: ${{ secrets.PYPI_PASSWORD }}