Skip to content

Commit

Permalink
Merge pull request #36 from skwashd/fix-ci
Browse files Browse the repository at this point in the history
Migrate CI from Travis to GitHub Actions
  • Loading branch information
tylerwince authored Aug 19, 2022
2 parents 4043bc5 + 136fe4e commit 8acbf4c
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 29 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI

on:
push:

pull_request:
branches: [main]

pull_request_target:
types:
- opened
- synchronize
- reopened
- ready_for_review

jobs:
test:
runs-on: ubuntu-22.04

strategy:
max-parallel: 8
fail-fast: false
matrix:
python-version: # Only supported versions of CPython are tested.
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11.0-rc.1" # Our one exception to the rule

steps:
- name: Checkout Code
if: ${{ github.event_name != 'pull_request_target' }}
uses: actions/checkout@v3

- name: Checkout PR
if: ${{ github.event_name == 'pull_request_target' }}
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: pip install -e .

- name: Run Tests
run: |
ERROR_COUNT="$(flake8 --select=S tests | wc -l)"
if [ "$ERROR_COUNT" != "495" ]; then
echo "Unexpected error count: ${ERROR_COUNT}"
exit 1
fi
32 changes: 32 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release

on:
push:
branches: [main]

jobs:
release:
runs-on: ubuntu-22.04
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')

steps:
- name: Checkout Code
if: ${{ github.event_name != 'pull_request_target' }}
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install pypa/build
run: pip install build

- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/ .

- name: Publish Package on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true
28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def get_version(fname="flake8_bandit.py"):
VERSION = get_version()

# What packages are required for this module to be executed?
REQUIRED = ["flake8", "bandit>=1.7.3", "flake8-polyfill", "pycodestyle"]
REQUIRED = ["flake8<5", "bandit>=1.7.3"]

# What packages are optional?
EXTRAS = {
Expand Down
Binary file removed tests/nonsense2.py
Binary file not shown.

0 comments on commit 8acbf4c

Please sign in to comment.