Skip to content

Commit

Permalink
Merge pull request #479 from r-world-devs/458-add-job-to-deploy-gh-pages
Browse files Browse the repository at this point in the history
Add gh deployment job.
  • Loading branch information
maciekbanas authored Sep 27, 2024
2 parents 1ad97a2 + 52e926f commit 89ca95d
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown.yaml

permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
folder: docs
5 changes: 5 additions & 0 deletions tests/testthat/test-get_commits-GitHub.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ test_that("`get_commits_from_one_repo()` prepares formatted list", {
})

test_that("`get_commits_from_repos()` pulls commits from repos", {
mockery::stub(
test_graphql_github$get_commits_from_repos,
"private$get_commits_from_one_repo",
test_mocker$use("commits_from_repo")
)
commits_from_repos <- test_graphql_github$get_commits_from_repos(
org = "r-world-devs",
repo = "GitStats",
Expand Down
27 changes: 27 additions & 0 deletions tests/testthat/test-get_files_content-GitHub.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,24 @@ test_that("get_repos_data pulls data on repos and branches", {
)
})

test_that("GitHub GraphQL Engine pulls file response", {
github_file_response <- test_graphql_github_priv$get_file_response(
org = "r-world-devs",
repo = "GitStats",
def_branch = "master",
file_path = "LICENSE",
files_query = test_mocker$use("gh_file_blobs_from_repo_query")
)
expect_github_files_response(github_file_response)
test_mocker$cache(github_file_response)
})

test_that("GitHub GraphQL Engine pulls files from organization", {
mockery::stub(
test_graphql_github$get_files_from_org,
"private$get_file_response",
test_mocker$use("github_file_response")
)
github_files_response <- test_graphql_github$get_files_from_org(
org = "r-world-devs",
repos = NULL,
Expand Down Expand Up @@ -53,6 +70,11 @@ test_that("GitHub GraphQL Engine pulls .png files from organization", {
})

test_that("GitHub GraphQL Engine pulls files from defined repositories", {
mockery::stub(
test_graphql_github$get_files_from_org,
"private$get_file_response",
test_mocker$use("github_file_response")
)
github_files_response <- test_graphql_github$get_files_from_org(
org = "openpharma",
repos = c("DataFakeR", "visR"),
Expand All @@ -67,6 +89,11 @@ test_that("GitHub GraphQL Engine pulls files from defined repositories", {
})

test_that("GitHub GraphQL Engine pulls two files from a group", {
mockery::stub(
test_graphql_github$get_files_from_org,
"private$get_file_response",
test_mocker$use("github_file_response")
)
github_files_response <- test_graphql_github$get_files_from_org(
org = "r-world-devs",
repos = NULL,
Expand Down

0 comments on commit 89ca95d

Please sign in to comment.