Skip to content

Commit

Permalink
Set up GitHub Actions
Browse files Browse the repository at this point in the history
Co-authored-by: Austin Shalit <[email protected]>
  • Loading branch information
calcmogul and AustinShalit committed Jul 11, 2020
1 parent 203f02e commit f38b743
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 114 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: CI

on: [push, pull_request]

jobs:
test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
python-version: [3.6, 3.7, 3.8]
name: Test - ${{ matrix.os }}, ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2

- name: Fetch all history and metadata
run: |
git fetch --prune --unshallow
git checkout -b pr
git branch -f master origin/master
- name: Install clang-format
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install clang-format-10
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install llvm --version 10.0.0
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install clang-format
else
echo "$RUNNER_OS not supported"
exit 1
fi
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install wpiformat
run: |
cd wpiformat
pip install -e .
- name: Install test dependencies
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
# This pytest dependency is installed manually with bash because the
# installation prints to stderr. Prints to stderr cause Powershell to
# report a nonzero return code and cause the tests to fail.
pip install wheel iniconfig
fi
- name: Run unit tests
run: |
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
cd wpiformat
python setup.py test
- name: wpiformat - whole repo
run: |
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: |
if [ "$RUNNER_OS" == "Linux" ]; then
python -m wpiformat -f /home/runner/work/styleguide/styleguide/wpiformat/wpiformat/__init__.py -v
elif [ "$RUNNER_OS" == "Windows" ]; then
python -m wpiformat -f /d/a/styleguide/styleguide/wpiformat/wpiformat/__init__.py -v
elif [ "$RUNNER_OS" == "macOS" ]; then
python -m wpiformat -f /Users/runner/work/styleguide/styleguide/wpiformat/wpiformat/__init__.py -v
else
echo "$RUNNER_OS not supported"
exit 1
fi
- 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
- name: Ensure formatter made no changes
run: git --no-pager diff --exit-code HEAD
114 changes: 0 additions & 114 deletions azure-pipelines.yml

This file was deleted.

6 changes: 6 additions & 0 deletions wpiformat/wpiformat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ def main():
else:
files.append(name)

# Throw an error if any files or directories don't exist
for f in files:
if not os.path.exists(f):
print(f"error: {f}: No such file or directory")
sys.exit(1)

# Convert relative paths of files to absolute paths
files = [os.path.abspath(name) for name in files]

Expand Down

0 comments on commit f38b743

Please sign in to comment.