diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..6917e2d --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +/pkg.lock diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 44df4cf..3146fdb 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -23,6 +23,8 @@ name: rcc jobs: R-CMD-check-smoke: runs-on: ubuntu-latest + outputs: + sha: ${{ steps.commit.outputs.sha }} name: "Smoke test: stock R" @@ -36,6 +38,8 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} + - uses: ./.github/workflows/git-identity + - uses: ./.github/workflows/custom/before-install - uses: ./.github/workflows/install @@ -43,9 +47,17 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} install-r: false cache-version: rcc-smoke-1 + extra-packages: rcmdcheck roxygen2 styler - uses: ./.github/workflows/custom/after-install + - uses: ./.github/workflows/roxygenize + + - uses: ./.github/workflows/style + + - id: commit + uses: ./.github/workflows/commit + - uses: ./.github/workflows/check with: results: ${{ runner.os }}-smoke-test @@ -53,6 +65,8 @@ jobs: # Runs in a separate workflow, because it's using dev pkgdown # which might bring in other dev dependencies pkgdown: + needs: R-CMD-check-smoke + runs-on: ubuntu-latest name: "pkgdown" @@ -62,6 +76,8 @@ jobs: steps: - uses: actions/checkout@v2 + with: + ref: ${{ needs.rcc-smoke.outputs.sha }} - uses: ./.github/workflows/rate-limit with: @@ -112,6 +128,8 @@ jobs: steps: - uses: actions/checkout@v2 + with: + ref: ${{ needs.rcc-smoke.outputs.sha }} - uses: ./.github/workflows/custom/before-install @@ -167,6 +185,8 @@ jobs: steps: - uses: actions/checkout@v2 + with: + ref: ${{ needs.rcc-smoke.outputs.sha }} - uses: ./.github/workflows/custom/before-install diff --git a/.github/workflows/commit/action.yml b/.github/workflows/commit/action.yml new file mode 100644 index 0000000..8e6e77b --- /dev/null +++ b/.github/workflows/commit/action.yml @@ -0,0 +1,29 @@ +name: 'Action to commit changes to the repository' +outputs: + sha: + description: "SHA of generated commit" + value: ${{ steps.commit.outputs.sha }} + +runs: + using: "composite" + steps: + - name: Commit if changed + id: commit + run: | + set -x + if [ -n "$(git status --porcelain)" ]; then + echo "Changed" + git fetch + if [ -n "${GITHUB_HEAD_REF}" ]; then + git add . + git stash save + git switch ${GITHUB_HEAD_REF} + git merge origin/${GITHUB_BASE_REF} --no-edit + git stash pop + fi + git add . + git commit -m "Auto-update from GitHub Actions"$'\n'$'\n'"Run: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" + git push + echo ::set-output name=sha::$(git rev-parse HEAD) + fi + shell: bash diff --git a/.github/workflows/install/action.yml b/.github/workflows/install/action.yml index 3f463c3..5ecab53 100644 --- a/.github/workflows/install/action.yml +++ b/.github/workflows/install/action.yml @@ -49,6 +49,14 @@ runs: extra-packages: ${{ inputs.extra-packages }} ${{ matrix.config.covr && 'covr' }} cache-version: ${{ inputs.cache-version }} + - name: Add pkg.lock to .gitignore + run: | + set -x + if ! [ -f .github/.gitignore ] || [ -z "$(grep '^/pkg.lock$' .github/.gitignore)" ]; then + echo /pkg.lock >> .github/.gitignore + fi + shell: bash + - name: Add fake qpdf and checkbashisms if: runner.os == 'Linux' run: | diff --git a/.github/workflows/roxygenize/action.yml b/.github/workflows/roxygenize/action.yml new file mode 100644 index 0000000..3037b70 --- /dev/null +++ b/.github/workflows/roxygenize/action.yml @@ -0,0 +1,9 @@ +name: 'Action to create documentation with roxygen2' + +runs: + using: "composite" + steps: + - name: Roxygenize + run: | + roxygen2::roxygenize() + shell: Rscript {0} diff --git a/.github/workflows/style/action.yml b/.github/workflows/style/action.yml new file mode 100644 index 0000000..0f30b9f --- /dev/null +++ b/.github/workflows/style/action.yml @@ -0,0 +1,37 @@ +name: 'Action to auto-style a package' + +runs: + using: "composite" + steps: + - name: Check styler options + id: check + run: | + set -x + scope=$(grep Config/autostyle/scope DESCRIPTION | cut -d " " -f 2) + strict=$(grep Config/autostyle/strict DESCRIPTION | cut -d " " -f 2) + echo ::set-output name=scope::$scope + echo ::set-output name=strict::$strict + shell: bash + + - name: Enable styler cache + if: ${{ steps.check.outputs.scope }} + run: | + styler::cache_activate(verbose = TRUE) + shell: Rscript {0} + + - uses: actions/cache@v2 + if: ${{ steps.check.outputs.scope }} + with: + path: | + ~/.cache/R/R.cache + key: ${{ runner.os }}- + + - name: Run styler + if: ${{ steps.check.outputs.scope }} + run: | + strict <- as.logical("${{ steps.check.outputs.strict }}") + if (is.na(strict)) { + strict = FALSE + } + styler::style_pkg(scope = "${{ steps.check.outputs.scope }}", strict = strict) + shell: Rscript {0} diff --git a/DESCRIPTION b/DESCRIPTION index 5494f8a..a67fbca 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -67,3 +67,5 @@ Collate: 'show_KazamConnection.R' 'show_KazamDriver.R' 'show_KazamResult.R' +Config/autostyle/scope: line_breaks +Config/autostyle/strict: false diff --git a/R/Connection.R b/R/Connection.R index 7df4f6f..f0a4c5b 100644 --- a/R/Connection.R +++ b/R/Connection.R @@ -40,4 +40,3 @@ DBI::dbListObjects #' @export DBI::dbWithTransaction - diff --git a/R/Driver.R b/R/Driver.R index 7c7c5f4..afe07f5 100644 --- a/R/Driver.R +++ b/R/Driver.R @@ -31,4 +31,3 @@ DBI::dbCanConnect #' @export DBI::Id - diff --git a/R/RKazam.R b/R/RKazam.R index fd25a9e..6295f96 100644 --- a/R/RKazam.R +++ b/R/RKazam.R @@ -1,3 +1,2 @@ #' @details TBD. "_PACKAGE" - diff --git a/R/Result.R b/R/Result.R index b97ed5a..8bf7659 100644 --- a/R/Result.R +++ b/R/Result.R @@ -16,4 +16,3 @@ setClass( statement = "character" ) ) - diff --git a/man/DBI.Rd b/man/DBI.Rd index ac82bf6..9c3a3a4 100644 --- a/man/DBI.Rd +++ b/man/DBI.Rd @@ -188,15 +188,7 @@ or \linkS4class{DBIConnection}} \item{obj}{An R object whose SQL type we want to determine.} -\item{name}{The table name, passed on to \code{\link[DBI:dbQuoteIdentifier]{dbQuoteIdentifier()}}. Options are: -\itemize{ -\item a character string with the unquoted DBMS table name, -e.g. \code{"table_name"}, -\item a call to \code{\link[DBI:Id]{Id()}} with components to the fully qualified table name, -e.g. \code{Id(schema = "my_schema", table = "table_name")} -\item a call to \code{\link[DBI:SQL]{SQL()}} with the quoted and fully qualified table name -given verbatim, e.g. \code{SQL('"my_schema"."table_name"')} -}} +\item{name}{A character string specifying a DBMS table name.} \item{n}{maximum number of records to retrieve per fetch. Use \code{n = -1} or \code{n = Inf} diff --git a/tests/testthat/test-DBItest.R b/tests/testthat/test-DBItest.R index 5d964b3..153a977 100644 --- a/tests/testthat/test-DBItest.R +++ b/tests/testthat/test-DBItest.R @@ -1,5 +1,3 @@ if (identical(Sys.getenv("NOT_CRAN"), "true")) { - DBItest::test_all() - }