From e204b6212f1a9b1a5cf9c3245a9cea48010383ad Mon Sep 17 00:00:00 2001 From: Cunliang Geng Date: Mon, 18 Mar 2024 10:45:34 +0100 Subject: [PATCH 1/4] run building and type check actions for PRs on all branches --- .github/workflows/build.yml | 3 --- .github/workflows/typing-check.yml | 3 --- 2 files changed, 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1533b2f9..e95bcade 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,9 +12,6 @@ on: - setup.py - .github/workflows/build.yml pull_request: - branches: - - main - - dev paths: - bin/** - src/** diff --git a/.github/workflows/typing-check.yml b/.github/workflows/typing-check.yml index 1993530b..fdfbb657 100644 --- a/.github/workflows/typing-check.yml +++ b/.github/workflows/typing-check.yml @@ -9,9 +9,6 @@ on: - src/** - tests/** pull_request: - branches: - - main - - dev paths: - src/** - tests/** From d6bf0d4beeff77c59542a93966480e1dd6f85a7f Mon Sep 17 00:00:00 2001 From: Cunliang Geng Date: Mon, 18 Mar 2024 10:46:56 +0100 Subject: [PATCH 2/4] Delete documentation.yml --- .github/workflows/documentation.yml | 40 ----------------------------- 1 file changed, 40 deletions(-) delete mode 100644 .github/workflows/documentation.yml diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml deleted file mode 100644 index 5e9999f0..00000000 --- a/.github/workflows/documentation.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: documentation - -on: - push: - branches: - - main - - dev - paths: - - docs/** - pull_request: - branches: - - main - - dev - paths: - - docs/** - -jobs: - build-documentation: - name: Build documentation - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.10 - uses: actions/setup-python@v2 - with: - python-version: 3.10 - - name: Python info - shell: bash -l {0} - run: | - which python3 - python3 --version - - name: Upgrade pip and install dependencies - run: | - python3 -m pip install --upgrade pip setuptools - python3 -m pip install .[dev,publishing] - - name: Install pandoc using apt - run: sudo apt install pandoc - - name: Build documentation - run: make coverage doctest html - working-directory: docs From 1e18d78d186d157f86d68271ef27e54600fcbf3b Mon Sep 17 00:00:00 2001 From: Cunliang Geng Date: Mon, 18 Mar 2024 11:33:31 +0100 Subject: [PATCH 3/4] separate building and sonarcloud actions --- .github/workflows/build.yml | 34 ----------------- .github/workflows/sonar-cloud.yml | 63 +++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/sonar-cloud.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e95bcade..3226cf5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -86,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 }} diff --git a/.github/workflows/sonar-cloud.yml b/.github/workflows/sonar-cloud.yml new file mode 100644 index 00000000..656c0ea7 --- /dev/null +++ b/.github/workflows/sonar-cloud.yml @@ -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 }} From 80c3aea29f50f98ce6538392a4a60ecfbe9f9874 Mon Sep 17 00:00:00 2001 From: Cunliang Geng Date: Mon, 18 Mar 2024 11:33:59 +0100 Subject: [PATCH 4/4] Update pyproject.toml Update ruff settings to be aligned with the latest usage. --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3673a9fb..acf50b91 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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) @@ -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