Created
August 5, 2021 11:39
-
-
Save ZipFile/7a5a2cb5fd5b5303f30fa6a138be6889 to your computer and use it in GitHub Desktop.
GitHub Actions
This file contains hidden or 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: Git history | |
on: pull_request | |
jobs: | |
git-history: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 25 | |
- name: "No fixup! commits" | |
run: | | |
git log --oneline HEAD ^${{ github.event.pull_request.base.sha }} --grep '^fixup!' -- > log | |
if [ -s log ]; then | |
echo 'fixup! commits detected:' | |
cat log | |
exit 1 | |
fi | |
- name: "No merge commits" | |
# https://github.com/actions/checkout/issues/27 | |
run: | | |
git log --oneline HEAD^ ^${{ github.event.pull_request.base.sha }} --merges -- > log | |
if [ -s log ]; then | |
echo 'Merge commits detected:' | |
cat log | |
exit 1 | |
fi |
This file contains hidden or 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: Linting | |
on: push | |
jobs: | |
linting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.8" | |
- name: Cache pip | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y python3-all-dev build-essential libpcre3-dev libpq-dev libcurl4-openssl-dev libssl-dev | |
python -m pip install -U pip wheel | |
pip install -r requirements/linting.txt -r requirements/testing.txt | |
pip install --no-deps -e . | |
- name: layer-enforcer | |
run: layer-enforcer myproj --ignore myproj.celery.app,myproj.containers,myproj.web.app,myproj.cli.app | |
- name: flake8 | |
run: flake8 src/myproj/ tests/ alembic/ | |
- name: isort | |
run: isort --check-only src/myproj/ tests/ alembic/ | |
- name: black | |
run: black --check src/myproj/ tests/ alembic/ | |
- name: mypy | |
run: | | |
mypy --show-error-codes --strict src/myproj/ | |
mypy tests/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment