Skip to content

Commit

Permalink
Add code quality workflows for main branch and pull requests (AllenCe…
Browse files Browse the repository at this point in the history
  • Loading branch information
elisim authored Jul 10, 2022
1 parent fcbe5eb commit 890723b
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 10 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/code-quality-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Same as `code-quality-pr.yaml` but triggered on commit
# to main branch and runs on all files (instead of only the changed ones)

name: Code Quality On Push

on:
push:
branches: [main]

jobs:
code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]
27 changes: 27 additions & 0 deletions .github/workflows/code-quality-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This workflow finds which files were changed, prints them, and then
# runs `pre-commit` on those files.

# Inspired by the sktime library:
# https://github.com/alan-turing-institute/sktime/blob/main/.github/workflows/test.yml

name: Code Quality On PR

on:
pull_request:
branches: [main, "release/*"]

jobs:
code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- id: file_changes
uses: trilom/[email protected]
with:
output: " "
- name: List changed files
run: echo '${{ steps.file_changes.outputs.files}}'
- uses: pre-commit/[email protected]
with:
extra_args: --files ${{ steps.file_changes.outputs.files}}
11 changes: 1 addition & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: |
pytest -v
# upload code coverate report
# upload code coverage report
code-coverage:
runs-on: ubuntu-latest

Expand All @@ -67,12 +67,3 @@ jobs:

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3

# check code formatting
pre-commit:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]

0 comments on commit 890723b

Please sign in to comment.