Skip to content

Commit

Permalink
enable github actions for PRs on all branches
Browse files Browse the repository at this point in the history
Major changes
- update github actions to run building and type check actions for PRs on **all branches**
- separate actions for building and sonarcloud
- delete unused github action documentation.yml
  • Loading branch information
CunliangGeng authored Mar 21, 2024
1 parent a892925 commit 28ae40b
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 81 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ on:
- setup.py
- .github/workflows/build.yml
pull_request:
branches:
- main
- dev
paths:
- bin/**
- src/**
Expand Down Expand Up @@ -89,37 +86,3 @@ jobs:
install-nplinker-deps --run-on-github
- name: Run unit tests
run: pytest -v

sonarcloud:
name: SonarCloud
needs: smoke_test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Python info
shell: bash -l {0}
run: |
which python3
python3 --version
- name: Upgrade pip and setuptools
run: |
python3 -m pip install --upgrade pip setuptools wheel
- name: Install nplinker and its dependencies
run: |
python3 -m pip install .[dev]
install-nplinker-deps --run-on-github
- name: Check style against standards using ruff
run: ruff .
- name: Run unit tests with coverage
run: pytest --cov --cov-report term --cov-report xml --junitxml=xunit-result.xml tests/
- name: Correct coverage paths
run: sed -i "s+$PWD/++g" coverage.xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{secrets.SONAR_TOKEN }}
40 changes: 0 additions & 40 deletions .github/workflows/documentation.yml

This file was deleted.

63 changes: 63 additions & 0 deletions .github/workflows/sonar-cloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Check format and coverage, then upload to SonarCloud

on:
push:
branches:
- main
- dev
paths:
- bin/**
- src/**
- tests/**
- setup.py
- .github/workflows/build.yml
pull_request:
branches:
- main
- dev
paths:
- bin/**
- src/**
- tests/**
- setup.py
- .github/workflows/build.yml
types:
- opened
- reopened
- synchronize
- ready_for_review

jobs:

sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Python info
shell: bash -l {0}
run: |
which python3
python3 --version
- name: Upgrade pip and setuptools
run: |
python3 -m pip install --upgrade pip setuptools wheel
- name: Install nplinker and its dependencies
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
run: sed -i "s+$PWD/++g" coverage.xml
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{secrets.SONAR_TOKEN }}
3 changes: 0 additions & 3 deletions .github/workflows/typing-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
- src/**
- tests/**
pull_request:
branches:
- main
- dev
paths:
- src/**
- tests/**
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ ignore_missing_imports = true
[tool.ruff]
target-version = "py310"
line-length = 100

[tool.ruff.lint]
select = [
"D", # pydocstyle
"E", # pycodestyle (error)
Expand Down Expand Up @@ -100,7 +102,7 @@ fixable = ["A", "B", "C", "D", "E", "F", "I"]
ignore-init-module-imports = true


[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ["nplinker"]
force-single-line = true
lines-after-imports = 2
Expand Down

0 comments on commit 28ae40b

Please sign in to comment.