Skip to content

Commit

Permalink
Add package subdirectory input (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
walkowif authored Jul 10, 2023
1 parent 2f5c2c5 commit f8d17f1
Show file tree
Hide file tree
Showing 14 changed files with 136 additions and 32 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/audit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ on:
- main
workflow_dispatch:
workflow_call:
inputs:
package-subdirectory:
description: Subdirectory in the repository, where the R package is located.
required: false
type: string
default: "."

jobs:
audit:
Expand Down Expand Up @@ -52,6 +58,7 @@ jobs:
}
)
shell: Rscript {0}
working-directory: ${{ inputs.package-subdirectory }}

- name: Run oysteR scan on renv.lock 🔒
run: |
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/bioccheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ on:
required: false
type: string
default: upstream
package-subdirectory:
description: Subdirectory in the repository, where the R package is located.
required: false
type: string
default: "."

concurrency:
group: bioccheck-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -121,6 +126,6 @@ jobs:
- name: Run BiocCheck ☣️
uses: insightsengineering/bioc-check-action@v1
with:
path: ${{ github.event.repository.name }}
path: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}
no-check-version-num: true
allow-failure: ${{ inputs.allow-failure }}
19 changes: 12 additions & 7 deletions .github/workflows/build-check-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ on:
required: false
type: string
default: "release-candidate"
package-subdirectory:
description: Subdirectory in the repository, where the R package is located.
required: false
type: string
default: ""

concurrency:
group: r-cmd-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -299,7 +304,7 @@ jobs:
env:
GITHUB_PAT: ${{ steps.github-token.outputs.token }}
with:
path: ${{ github.event.repository.name }}
path: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}
enable-check: ${{ inputs.enable-staged-dependencies-check }}
run-system-dependencies: ${{ inputs.install-system-dependencies }}
direction: ${{ inputs.sd-direction }}
Expand All @@ -315,7 +320,7 @@ jobs:
x <- desc::desc_set_dep("xml2", "Suggests")
}
shell: Rscript {0}
working-directory: ${{ github.event.repository.name }}
working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}

- name: Replace testthat.R for test reporting 🎚
if: inputs.disable-unit-test-reports != 'true'
Expand All @@ -337,7 +342,7 @@ jobs:
cat tests/testthat.R
fi
shell: bash
working-directory: ${{ github.event.repository.name }}
working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}

- name: Build R package 🏗
run: |
Expand All @@ -347,7 +352,7 @@ jobs:
export $(tr '\n' ' ' < /tmp/dotenv.env)
}
fi
R CMD build ${{ github.event.repository.name }}
R CMD build ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}
echo "PKGBUILD=$(echo ${{ github.event.repository.name }}_*.tar.gz)" >> $GITHUB_ENV
shell: bash

Expand All @@ -370,7 +375,7 @@ jobs:
echo "TESTING_DEPTH=1" >> $GITHUB_ENV
fi
shell: bash
working-directory: ${{ github.event.repository.name }}
working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}

- name: Run R CMD check 🏁
run: |
Expand Down Expand Up @@ -689,13 +694,13 @@ jobs:
R CMD build .
echo "PKGBUILD=$(echo ${{ github.event.repository.name }}_*.tar.gz)" >> $GITHUB_ENV
shell: bash
working-directory: ${{ github.event.repository.name }}
working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}

- name: Upload package build ⤴
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v3
with:
path: ${{ github.event.repository.name }}/${{ env.PKGBUILD }}
path: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}/${{ env.PKGBUILD }}
name: ${{ env.PKGBUILD }}

publish-junit-html-report:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/grammar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
passiveVoice = false;
}
files.forEach((file) => {
if (fs.lstatSync(file).isFile() &&
if (fs.lstatSync(file).isFile() &&
!path.dirname(file).startsWith("node_modules")) {
const contents = fs.readFileSync(file, 'utf8');
const suggestions = writeGood(contents, { passive : passiveVoice });
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/licenses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ on:
- main
workflow_dispatch:
workflow_call:
inputs:
package-subdirectory:
description: Subdirectory in the repository, where the R package is located.
required: false
type: string
default: "."

concurrency:
group: licenses-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -34,3 +40,4 @@ jobs:
uses: insightsengineering/r-license-report@v1
with:
regex: "^AGPL.*"
path: ${{ inputs.package-subdirectory }}
15 changes: 10 additions & 5 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ on:
type: string
default: >-
^main$|^devel$|^pre-release$|^latest-tag$|^release-candidate$|^develop$|^v([0-9]+\\.)?([0-9]+\\.)?([0-9]+)|^v([0-9]+\\.)?([0-9]+\\.)?([0-9]+)(-rc[0-9]+)$
package-subdirectory:
description: Subdirectory in the repository, where the R package is located.
required: false
type: string
default: "."

concurrency:
group: docs-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -163,7 +168,7 @@ jobs:
env:
GITHUB_PAT: ${{ steps.github-token.outputs.token }}
with:
path: ${{ github.event.repository.name }}
path: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}
enable-check: ${{ inputs.enable-staged-dependencies-check }}
run-system-dependencies: ${{ inputs.install-system-dependencies }}
direction: ${{ inputs.sd-direction }}
Expand All @@ -173,7 +178,7 @@ jobs:
if (file.exists("renv.lock")) renv::restore()
install.packages(".", repos=NULL, type="source")
shell: Rscript {0}
working-directory: ${{ github.event.repository.name }}
working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}

- name: Build docs 🏗
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/v')
Expand Down Expand Up @@ -201,12 +206,12 @@ jobs:
}
fi
shell: bash
working-directory: ${{ github.event.repository.name }}
working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}

- name: Create documentation artifact 📂
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/v')
run: |
pushd ${{ github.event.repository.name }}/docs/
pushd ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}/docs/
zip -r9 $OLDPWD/pkgdown.zip *
popd
shell: bash
Expand Down Expand Up @@ -239,7 +244,7 @@ jobs:
)
EOF
shell: bash
working-directory: ${{ github.event.repository.name }}
working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}

multi-version-docs:
name: Multi-version docs 📑
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ on:
required: false
default: false
type: boolean
package-subdirectory:
description: Subdirectory in the repository, where the R package is located.
required: false
type: string
default: "."
workflow_dispatch:

concurrency:
Expand Down Expand Up @@ -68,13 +73,14 @@ jobs:
RELEASE_VERSION=$(awk -F: '/Version:/{gsub(/[ ]+/,"") ; print $2}' DESCRIPTION)
REPOSITORY_NAME="${{ github.event.repository.name }}"
(awk "/^#+.*${REPOSITORY_NAME//./\.}.*${RELEASE_VERSION//./\.}$/{flag=1;next}/^#+.*${REPOSITORY_NAME//./\.}.*/{flag=0}flag" NEWS.md | grep -v "^$" || echo "* ${RELEASE_VERSION}") > RELEASE_BODY.txt
working-directory: ${{ inputs.package-subdirectory }}

- name: Create release 🌟
if: >-
steps.rc-tag.outputs.is-rc-tag == 'false' ||
inputs.create-rc-releases == true
uses: softprops/action-gh-release@v1
with:
body_path: RELEASE_BODY.txt
body_path: ${{ inputs.package-subdirectory }}/RELEASE_BODY.txt
token: ${{ steps.github-token.outputs.token }}
generate_release_notes: true
11 changes: 8 additions & 3 deletions .github/workflows/roxygen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ on:
required: false
type: string
default: upstream
package-subdirectory:
description: Subdirectory in the repository, where the R package is located.
required: false
type: string
default: "."
secrets:
REPO_GITHUB_TOKEN:
description: |
Expand Down Expand Up @@ -99,7 +104,7 @@ jobs:
env:
GITHUB_PAT: ${{ steps.github-token.outputs.token }}
with:
path: ${{ github.event.repository.name }}
path: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}
enable-check: ${{ inputs.enable-staged-dependencies-check }}
run-system-dependencies: ${{ inputs.install-system-dependencies }}
direction: ${{ inputs.sd-direction }}
Expand Down Expand Up @@ -127,7 +132,7 @@ jobs:
stop("Please 🙏 fix the errors shown below this message 👇")
}
shell: Rscript {0}
working-directory: ${{ github.event.repository.name }}
working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}

- name: Roxygen check 🅾
run: |
Expand Down Expand Up @@ -170,4 +175,4 @@ jobs:
}
fi
shell: bash
working-directory: ${{ github.event.repository.name }}
working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}
13 changes: 13 additions & 0 deletions .github/workflows/spelling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ on:
- main
workflow_dispatch:
workflow_call:
inputs:
package-subdirectory:
description: Subdirectory in the repository, where the R package is located.
required: false
type: string
default: "."

concurrency:
group: spelling-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -34,7 +40,14 @@ jobs:
- name: Checkout Code 🛎
uses: actions/checkout@v3

- name: Normalize variables 📏
run: |
package_subdirectory_input="${{ inputs.package-subdirectory }}"
echo "package_subdirectory=${package_subdirectory_input:-.}" >> $GITHUB_ENV
shell: bash

- name: Run Spellcheck 👟
uses: insightsengineering/r-spellcheck-action@v2
with:
exclude: inst/extdata/*
path: ${{ env.package_subdirectory }}
9 changes: 7 additions & 2 deletions .github/workflows/style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ on:
required: false
default: false
type: boolean
package-subdirectory:
description: Subdirectory in the repository, where the R package is located.
required: false
type: string
default: "."

concurrency:
group: style-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -90,7 +95,7 @@ jobs:
)
}
shell: Rscript {0}
working-directory: ${{ github.event.repository.name }}
working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}

- name: Check file existence 🤔
id: check_files
Expand Down Expand Up @@ -120,7 +125,7 @@ jobs:
git push -v origin HEAD:${{ steps.branch-name.outputs.head_ref_branch }} || \
echo "⚠️ Could not push to ${BRANCH_NAME} on $(git remote -v show -n origin | grep Push)"
shell: bash
working-directory: ${{ github.event.repository.name }}
working-directory: ${{ github.event.repository.name }}/${{ inputs.package-subdirectory }}
continue-on-error: true

- name: Styler check summary 🅾
Expand Down
Loading

0 comments on commit f8d17f1

Please sign in to comment.