Skip to content

Commit

Permalink
check format and typing only on changed files
Browse files Browse the repository at this point in the history
Update github actions to check code format and static typing only on changed files.
  • Loading branch information
CunliangGeng authored Apr 9, 2024
1 parent 010ce34 commit 9dc315d
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 41 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/format-typing-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Check format and static typing

on:
push:
branches:
- dev
- main
paths:
- '**.py'
- '.github/workflows/format-typing-check.yml'
pull_request:
branches:
- dev
- main
paths:
- '**.py'
- '.github/workflows/format-typing-check.yml'
types:
- opened
- reopened
- synchronize
- ready_for_review

jobs:
format-check:
name: Check code format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install ruff
run: |
pip install ruff mypy types-toml types-Deprecated typing_extensions
- name: Get all changed python files
id: changed-python-files
uses: tj-actions/changed-files@v44
with:
files: |
**.py
- name: Check format using ruff
if: steps.changed-python-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-python-files.outputs.all_changed_files }}
run: |
ruff check ${ALL_CHANGED_FILES}
- name: Check static typing using mypy
if: steps.changed-python-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-python-files.outputs.all_changed_files }}
run: |
mypy ${ALL_CHANGED_FILES}
4 changes: 1 addition & 3 deletions .github/workflows/sonar-cloud.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check format and coverage, then upload to SonarCloud
name: Check coverage

on:
push:
Expand Down Expand Up @@ -50,8 +50,6 @@ jobs:
run: |
python3 -m pip install .[dev]
install-nplinker-deps --run-on-github
- name: Check style against standards using ruff
run: ruff check .
- name: Run unit tests with coverage
run: pytest --cov --cov-report term --cov-report xml --junitxml=xunit-result.xml tests/unit
- name: Correct coverage paths
Expand Down
38 changes: 0 additions & 38 deletions .github/workflows/typing-check.yml

This file was deleted.

0 comments on commit 9dc315d

Please sign in to comment.