From 857083a38feb2568a8c33cdf75f86a69b238ef2f Mon Sep 17 00:00:00 2001 From: Waldir Leoncio Date: Thu, 3 Feb 2022 11:00:46 +0100 Subject: [PATCH] Moved lint and coverage CI to their own YML --- .github/workflows/build.yml | 29 +-------------- .github/workflows/linter.yml | 55 ++++++++++++++++++++++++++++ .github/workflows/test-coverage.yaml | 25 +++++++++++++ 3 files changed, 81 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/linter.yml create mode 100644 .github/workflows/test-coverage.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 480c1a1..f0d9722 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ # ======================================================== # on: [push, pull_request] -name: R-CMD-check +name: package-build # ======================================================== # # Determine actions to take # @@ -89,33 +89,6 @@ jobs: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") shell: Rscript {0} - # Checking unit test coverage ---------------------------- # - - name: Checking unit test coverage - run: | - install.packages("covr") - covr::codecov() - shell: Rscript {0} - - # Judging coding style ----------------------------------- # - - name: Linting package - run: | - install.packages("lintr") - library(lintr) - style_rules <- list( - assignment_linter, closed_curly_linter, commas_linter, - todo_comment_linter, equals_na_linter, - function_left_parentheses_linter, infix_spaces_linter, - line_length_linter, no_tab_linter, open_curly_linter, - paren_brace_linter, absolute_path_linter, nonportable_path_linter, - pipe_continuation_linter, semicolon_terminator_linter, - single_quotes_linter, spaces_inside_linter, - trailing_blank_lines_linter, trailing_whitespace_linter, - undesirable_function_linter, undesirable_operator_linter, - unneeded_concatenation_linter - ) # TODO: expand style rules as package matures - lint_package(linters = style_rules) - shell: Rscript {0} - # Uploading check results -------------------------------- # - name: Uploading check results if: failure() diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..d6c4bb5 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,55 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# +# See https://github.com/r-lib/actions/tree/master/examples#readme for +# additional example workflows available for the R community. + +# ======================================================== # +# Determines when the action is triggered # +# ======================================================== # + +on: [push, pull_request] +name: linter + +# ======================================================== # +# Determine actions to take # +# ======================================================== # + +jobs: + lint: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checking out the repository + uses: actions/checkout@v2 + + - name: Setting up R + uses: r-lib/actions/setup-r@v1 + with: + use-public-rspm: true + + - name: Installing dependencies + uses: r-lib/actions/setup-r-dependencies@v1 + with: + extra-packages: lintr + + - name: Picking on the coding style + run: | + library(lintr) + style_rules <- list( + assignment_linter, closed_curly_linter, commas_linter, + todo_comment_linter, equals_na_linter, + function_left_parentheses_linter, infix_spaces_linter, + line_length_linter, no_tab_linter, open_curly_linter, + paren_brace_linter, absolute_path_linter, nonportable_path_linter, + pipe_continuation_linter, semicolon_terminator_linter, + single_quotes_linter, spaces_inside_linter, + trailing_blank_lines_linter, trailing_whitespace_linter, + undesirable_function_linter, undesirable_operator_linter, + unneeded_concatenation_linter + ) # TODO: expand style rules as package matures + lint_package(linters = style_rules) + shell: Rscript {0} diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 0000000..57e749f --- /dev/null +++ b/.github/workflows/test-coverage.yaml @@ -0,0 +1,25 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/master/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: [push, pull_request] +name: test-coverage + +jobs: + test-coverage: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@v1 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v1 + with: + extra-packages: covr + + - name: Test coverage + run: covr::codecov() + shell: Rscript {0}