├── .Rbuildignore ├── .circleci └── config.yml ├── .github └── workflows │ ├── main.yml │ ├── rhub.yaml │ └── update-tic.yml ├── .gitignore ├── .lintr ├── .pre-commit-config.yaml ├── DESCRIPTION ├── NAMESPACE ├── NEWS.md ├── R ├── base64.R ├── ci.R ├── circleci.R ├── droneci.R ├── dsl-storage.R ├── dsl.R ├── gh-actions.R ├── git2r.R ├── helpers_github.R ├── install.R ├── local.R ├── macro-blogdown.R ├── macro-bookdown.R ├── macro-drat.R ├── macro-package-checks.R ├── macro-pkgdown.R ├── macro-readme-rmd.R ├── macro.R ├── mock.R ├── print.R ├── repo.R ├── run.R ├── stage.R ├── steps-base.R ├── steps-blogdown.R ├── steps-bookdown.R ├── steps-code.R ├── steps-drat.R ├── steps-git.R ├── steps-install.R ├── steps-pkgdown.R ├── steps-rcmdcheck.R ├── steps-session-info.R ├── steps-ssh.R ├── steps-write-text-file.R ├── tic-package.R ├── update-yaml-helpers.R ├── update-yaml.R ├── use-badge.R ├── use-yaml.R ├── use_tic.R └── utils.R ├── README.md ├── codecov.yml ├── codemeta.json ├── inst ├── WORDLIST ├── templates │ ├── blogdown │ │ ├── all-tic.R │ │ ├── circle-tic.R │ │ ├── ghactions-tic.R │ │ ├── none-tic.R │ │ └── travis-tic.R │ ├── bookdown │ │ ├── all-tic.R │ │ ├── circle-tic.R │ │ ├── ghactions-tic.R │ │ ├── none-tic.R │ │ └── travis-tic.R │ ├── circle-deploy-matrix.yml │ ├── circle-deploy.yml │ ├── circle-matrix.yml │ ├── circle.yml │ ├── ghactions-core.yml │ ├── ghactions-deploy.yml │ ├── ghactions-env.yml │ ├── ghactions-meta-custom-deploy.yml │ ├── ghactions-meta-custom.yml │ ├── ghactions-meta-linux-deploy.yml │ ├── ghactions-meta-linux-macos-deploy.yml │ ├── ghactions-meta-linux-macos.yml │ ├── ghactions-meta-linux-windows-deploy.yml │ ├── ghactions-meta-linux-windows.yml │ ├── ghactions-meta-linux.yml │ ├── ghactions-meta-macos-deploy.yml │ ├── ghactions-meta-macos-windows-deploy.yml │ ├── ghactions-meta-macos-windows.yml │ ├── ghactions-meta-macos.yml │ ├── ghactions-meta-windows-deploy.yml │ ├── ghactions-meta-windows.yml │ ├── ghactions-meta.yml │ ├── package │ │ ├── all-tic.R │ │ ├── circle-tic.R │ │ ├── ghactions-tic.R │ │ ├── none-tic.R │ │ └── travis-tic.R │ ├── site │ │ ├── all-tic.R │ │ ├── circle-tic.R │ │ ├── ghactions-tic.R │ │ ├── none-tic.R │ │ └── travis-tic.R │ ├── unknown │ │ └── tic.R │ └── update-tic.yml └── testdata │ ├── circle-test-update-yaml-env-and-blocks-solution.yml │ ├── circle-test-update-yaml-env-and-blocks.yml │ ├── ghactions-check-update-fail.yml │ ├── ghactions-test-update-yaml-env-and-blocks-solution.yml │ └── ghactions-test-update-yaml-env-and-blocks.yml ├── man-roxygen ├── cname.R ├── private_key_name.R ├── remote.R └── repo.R ├── man ├── Deprecated.Rd ├── TicStep.Rd ├── base64serialize.Rd ├── ci.Rd ├── do_blogdown.Rd ├── do_bookdown.Rd ├── do_drat.Rd ├── do_package_checks.Rd ├── do_pkgdown.Rd ├── do_readme_rmd.Rd ├── dsl.Rd ├── dsl_get.Rd ├── figures │ ├── lifecycle-archived.svg │ ├── lifecycle-defunct.svg │ ├── lifecycle-deprecated.svg │ ├── lifecycle-experimental.svg │ ├── lifecycle-maturing.svg │ ├── lifecycle-questioning.svg │ ├── lifecycle-retired.svg │ ├── lifecycle-soft-deprecated.svg │ ├── lifecycle-stable.svg │ └── lifecycle-superseded.svg ├── gha_add_secret.Rd ├── github_helpers.Rd ├── github_info.Rd ├── list_macros.Rd ├── macro.Rd ├── prepare_all_stages.Rd ├── reexports.Rd ├── repo.Rd ├── run_all_stages.Rd ├── run_stage.Rd ├── ssh_key_helpers.Rd ├── stages.Rd ├── step_add_to_drat.Rd ├── step_add_to_known_hosts.Rd ├── step_build_blogdown.Rd ├── step_build_bookdown.Rd ├── step_build_pkgdown.Rd ├── step_do_push_deploy.Rd ├── step_hello_world.Rd ├── step_install_pkg.Rd ├── step_install_ssh_keys.Rd ├── step_push_deploy.Rd ├── step_rcmdcheck.Rd ├── step_run_code.Rd ├── step_session_info.Rd ├── step_setup_push_deploy.Rd ├── step_setup_ssh.Rd ├── step_test_ssh.Rd ├── step_write_text_file.Rd ├── tic-package.Rd ├── update_yml.Rd ├── use_ghactions_deploy.Rd ├── use_tic.Rd ├── use_tic_badge.Rd ├── use_tic_r.Rd ├── use_update_tic.Rd └── yaml_templates.Rd ├── pkgdown ├── _pkgdown.yml └── extra.css ├── tests ├── testthat.R └── testthat │ ├── _snaps │ └── print.md │ ├── helper-ci.R │ ├── helper.R │ ├── test-base64.R │ ├── test-ci.R │ ├── test-deploy.R │ ├── test-integration-assign.R │ ├── test-integration-early-failure.R │ ├── test-integration-git-commit-paths.R │ ├── test-integration-git-race-path-branch-orphan.R │ ├── test-integration-git-race-path-branch.R │ ├── test-integration-git-race.R │ ├── test-integration-git.R │ ├── test-integration-package-failure.R │ ├── test-integration-package.R │ ├── test-macro.R │ ├── test-print.R │ ├── test-repo.R │ ├── test-stages.R │ ├── test-tasks-base.R │ ├── test-update-yaml.R │ └── test-utils.R ├── tic.R ├── tic.Rproj └── vignettes ├── .gitignore ├── advanced.Rmd ├── build-lifecycle.Rmd ├── ci-client-packages.Rmd ├── ci-providers.Rmd ├── custom-steps.Rmd ├── deployment.Rmd ├── faq.Rmd ├── features.Rmd ├── img ├── README.md ├── build-lifecycle.graphml ├── build-lifecycle.png ├── circleci-debug.png ├── private-key-travis.png ├── ssh-deploy-key.png ├── tic-travis-usethis.graphml ├── tic-travis-usethis.png └── travis-job-id.png ├── tic.Rmd └── updating.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^codecov\.yml$ 2 | ^appveyor\.yml$ 3 | ^.*\.Rproj$ 4 | ^\.Rproj\.user$ 5 | ^\.httr-oauth$ 6 | ^\.travis\.yml$ 7 | ^tic\.R$ 8 | ^_pkgdown\.yml$ 9 | ^docs$ 10 | ^pkgdown/ 11 | ^\.circleci/config\.yml$ 12 | ^\.pre-commit-config\.yaml$ 13 | ^\.lintr$ 14 | ^tests/testthat/tic$ 15 | ^\.vscode$ 16 | ^codemeta\.json$ 17 | ^\.ccache$ 18 | ^man-roxygen$ 19 | ^\.github$ 20 | ^clang-.* 21 | ^gfortran.* 22 | ^\.circleci$ 23 | ^pkgdown$ 24 | -------------------------------------------------------------------------------- /.github/workflows/rhub.yaml: -------------------------------------------------------------------------------- 1 | # R-hub's generic GitHub Actions workflow file. It's canonical location is at 2 | # https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml 3 | # You can update this file to a newer version using the rhub2 package: 4 | # 5 | # rhub::rhub_setup() 6 | # 7 | # It is unlikely that you need to modify this file manually. 8 | 9 | name: R-hub 10 | run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}" 11 | 12 | on: 13 | workflow_dispatch: 14 | inputs: 15 | config: 16 | description: 'A comma separated list of R-hub platforms to use.' 17 | type: string 18 | default: 'linux,windows,macos' 19 | name: 20 | description: 'Run name. You can leave this empty now.' 21 | type: string 22 | id: 23 | description: 'Unique ID. You can leave this empty now.' 24 | type: string 25 | 26 | jobs: 27 | 28 | setup: 29 | runs-on: ubuntu-latest 30 | outputs: 31 | containers: ${{ steps.rhub-setup.outputs.containers }} 32 | platforms: ${{ steps.rhub-setup.outputs.platforms }} 33 | 34 | steps: 35 | # NO NEED TO CHECKOUT HERE 36 | - uses: r-hub/actions/setup@v1 37 | with: 38 | config: ${{ github.event.inputs.config }} 39 | id: rhub-setup 40 | 41 | linux-containers: 42 | needs: setup 43 | if: ${{ needs.setup.outputs.containers != '[]' }} 44 | runs-on: ubuntu-latest 45 | name: ${{ matrix.config.label }} 46 | strategy: 47 | fail-fast: false 48 | matrix: 49 | config: ${{ fromJson(needs.setup.outputs.containers) }} 50 | container: 51 | image: ${{ matrix.config.container }} 52 | 53 | steps: 54 | - uses: r-hub/actions/checkout@v1 55 | - uses: r-hub/actions/platform-info@v1 56 | with: 57 | token: ${{ secrets.RHUB_TOKEN }} 58 | job-config: ${{ matrix.config.job-config }} 59 | - uses: r-hub/actions/setup-deps@v1 60 | with: 61 | token: ${{ secrets.RHUB_TOKEN }} 62 | job-config: ${{ matrix.config.job-config }} 63 | - uses: r-hub/actions/run-check@v1 64 | with: 65 | token: ${{ secrets.RHUB_TOKEN }} 66 | job-config: ${{ matrix.config.job-config }} 67 | 68 | other-platforms: 69 | needs: setup 70 | if: ${{ needs.setup.outputs.platforms != '[]' }} 71 | runs-on: ${{ matrix.config.os }} 72 | name: ${{ matrix.config.label }} 73 | strategy: 74 | fail-fast: false 75 | matrix: 76 | config: ${{ fromJson(needs.setup.outputs.platforms) }} 77 | 78 | steps: 79 | - uses: r-hub/actions/checkout@v1 80 | - uses: r-hub/actions/setup-r@v1 81 | with: 82 | job-config: ${{ matrix.config.job-config }} 83 | token: ${{ secrets.RHUB_TOKEN }} 84 | - uses: r-hub/actions/platform-info@v1 85 | with: 86 | token: ${{ secrets.RHUB_TOKEN }} 87 | job-config: ${{ matrix.config.job-config }} 88 | - uses: r-hub/actions/setup-deps@v1 89 | with: 90 | job-config: ${{ matrix.config.job-config }} 91 | token: ${{ secrets.RHUB_TOKEN }} 92 | - uses: r-hub/actions/run-check@v1 93 | with: 94 | job-config: ${{ matrix.config.job-config }} 95 | token: ${{ secrets.RHUB_TOKEN }} 96 | -------------------------------------------------------------------------------- /.github/workflows/update-tic.yml: -------------------------------------------------------------------------------- 1 | on: 2 | workflow_dispatch: 3 | schedule: 4 | # * is a special character in YAML so you have to quote this string 5 | - cron: "0 4 * * 0" # every week 6 | 7 | name: Update tic 8 | 9 | jobs: 10 | update-tic: 11 | runs-on: ${{ matrix.config.os }} 12 | 13 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 14 | 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | config: 19 | - { os: ubuntu-latest, r: "release" } 20 | 21 | env: 22 | # use GITHUB_TOKEN from GitHub to workaround rate limits in {remotes} 23 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 24 | 25 | steps: 26 | - uses: actions/checkout@v4 27 | with: 28 | persist-credentials: false 29 | 30 | - uses: r-lib/actions/setup-r@v2 31 | with: 32 | r-version: ${{ matrix.config.r }} 33 | Ncpus: 4 34 | 35 | - name: "[Stage] Dependencies" 36 | env: 37 | RSPM: https://packagemanager.rstudio.com/all/__linux__/focal/latest 38 | run: | 39 | Rscript -e "install.packages('pak', repos = 'https://r-lib.github.io/p/pak/stable')" 40 | Rscript -e "if (grepl('Ubuntu', Sys.info()[['version']])) {options(repos = c(CRAN = sprintf('https://packagemanager.rstudio.com/all/__linux__/%s/latest', system('lsb_release -cs', intern = TRUE))))}; pak::pkg_install('ropensci/tic', dependencies = TRUE)" 41 | 42 | - name: "[Stage] Update YAMLs" 43 | run: | 44 | Rscript -e "tic::update_yml()" 45 | 46 | - name: "[Stage] Create Pull Request" 47 | uses: peter-evans/create-pull-request@v4 48 | with: 49 | author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> 50 | token: ${{ secrets.TIC_UPDATE }} 51 | title: "Update tic templates [ci-skip]" 52 | commit-message: "update tic templates" 53 | body: "{tic} templates can be updated :rocket: :robot:" 54 | branch: update-tic 55 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig 2 | 3 | # Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,r,windows 4 | # Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,macos,r,windows 5 | 6 | ### macOS ### 7 | # General 8 | .DS_Store 9 | .AppleDouble 10 | .LSOverride 11 | 12 | # Icon must end with two \r 13 | Icon 14 | 15 | # Thumbnails 16 | ._* 17 | 18 | # Files that might appear in the root of a volume 19 | .DocumentRevisions-V100 20 | .fseventsd 21 | .Spotlight-V100 22 | .TemporaryItems 23 | .Trashes 24 | .VolumeIcon.icns 25 | .com.apple.timemachine.donotpresent 26 | 27 | # Directories potentially created on remote AFP share 28 | .AppleDB 29 | .AppleDesktop 30 | Network Trash Folder 31 | Temporary Items 32 | .apdisk 33 | 34 | ### R ### 35 | # History files 36 | .Rhistory 37 | .Rapp.history 38 | 39 | # Session Data files 40 | .RData 41 | .RDataTmp 42 | 43 | # User-specific files 44 | .Ruserdata 45 | 46 | # Example code in package build process 47 | *-Ex.R 48 | 49 | # Output files from R CMD build 50 | /*.tar.gz 51 | 52 | # Output files from R CMD check 53 | /*.Rcheck/ 54 | 55 | # RStudio files 56 | .Rproj.user/ 57 | 58 | # produced vignettes 59 | vignettes/*.html 60 | vignettes/*.pdf 61 | 62 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 63 | .httr-oauth 64 | 65 | # knitr and R markdown default cache directories 66 | *_cache/ 67 | /cache/ 68 | 69 | # Temporary files created by R markdown 70 | *.utf8.md 71 | *.knit.md 72 | 73 | # R Environment Variables 74 | .Renviron 75 | 76 | # pkgdown site 77 | docs/ 78 | 79 | # translation temp files 80 | po/*~ 81 | 82 | # RStudio Connect folder 83 | rsconnect/ 84 | 85 | ### R.Bookdown Stack ### 86 | # R package: bookdown caching files 87 | /*_files/ 88 | 89 | ### VisualStudioCode ### 90 | .vscode/* 91 | !.vscode/settings.json 92 | !.vscode/tasks.json 93 | !.vscode/launch.json 94 | !.vscode/extensions.json 95 | !.vscode/*.code-snippets 96 | 97 | # Local History for Visual Studio Code 98 | .history/ 99 | 100 | # Built Visual Studio Code Extensions 101 | *.vsix 102 | 103 | ### VisualStudioCode Patch ### 104 | # Ignore all local history of files 105 | .history 106 | .ionide 107 | 108 | # Support for Project snippet scope 109 | 110 | ### Windows ### 111 | # Windows thumbnail cache files 112 | Thumbs.db 113 | Thumbs.db:encryptable 114 | ehthumbs.db 115 | ehthumbs_vista.db 116 | 117 | # Dump file 118 | *.stackdump 119 | 120 | # Folder config file 121 | [Dd]esktop.ini 122 | 123 | # Recycle Bin used on file shares 124 | $RECYCLE.BIN/ 125 | 126 | # Windows Installer files 127 | *.cab 128 | *.msi 129 | *.msix 130 | *.msm 131 | *.msp 132 | 133 | # Windows shortcuts 134 | *.lnk 135 | 136 | # End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,macos,r,windows 137 | 138 | # Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) 139 | 140 | -------------------------------------------------------------------------------- /.lintr: -------------------------------------------------------------------------------- 1 | linters: with_defaults(object_name_linter(style = c("snake_case", "CamelCase")), 2 | open_curly_linter = NULL, cyclocomp_linter = NULL) 3 | exclusions: list("inst/templates/unknown/tic.R", "R/tic-package.R" = 16, 4 | "R/gh-actions.R" = 71, 5 | "inst/templates/bookdown/none-tic.R", 6 | "R/use-yaml.R") 7 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # All available hooks: https://pre-commit.com/hooks.html 2 | # R specific hooks: https://github.com/lorenzwalthert/precommit 3 | repos: 4 | - repo: https://github.com/lorenzwalthert/precommit 5 | rev: v0.2.2.9011 6 | hooks: 7 | - id: style-files 8 | args: [--style_pkg=styler, --style_fun=tidyverse_style] 9 | # - id: roxygenize 10 | # codemeta must be above use-tidy-description when both are used 11 | # - id: codemeta-description-updated 12 | # - id: use-tidy-description 13 | # - id: spell-check 14 | exclude: > 15 | (?x)^( 16 | data/.*| 17 | (.*/|)\.Rprofile| 18 | (.*/|)\.Renviron| 19 | (.*/|)\.gitignore| 20 | (.*/|)NAMESPACE| 21 | (.*/|)WORDLIST| 22 | (.*/|)\.travis.yml| 23 | (.*/|)appveyor.yml| 24 | (.*/|)\.Rbuildignore| 25 | (.*/|)\.pre-commit-.*| 26 | .*\.[rR]| 27 | .*\.Rproj| 28 | .*\.py| 29 | .*\.feather| 30 | .*\.rds| 31 | .*\.Rds| 32 | .*\.sh| 33 | .*\.RData 34 | )$ 35 | - id: readme-rmd-rendered 36 | - id: parsable-R 37 | - id: no-browser-statement 38 | # - id: deps-in-desc 39 | - repo: https://github.com/pre-commit/pre-commit-hooks 40 | rev: v4.1.0 41 | hooks: 42 | - id: check-added-large-files 43 | args: ['--maxkb=200'] 44 | - repo: local 45 | hooks: 46 | - id: forbid-to-commit 47 | name: Don't commit common R artifacts 48 | entry: Cannot commit .Rhistory, .RData, .Rds or .rds. 49 | language: fail 50 | files: '\.Rhistory|\.RData|\.Rds|\.rds$' 51 | # `exclude: ` to allow committing specific files. 52 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Type: Package 2 | Package: tic 3 | Title: Tasks Integrating Continuously: CI-Agnostic Workflow Definitions 4 | Version: 0.14.1 5 | Authors@R: c( 6 | person("Eli", "Miller", , "eli@eli.dev", role = c("aut", "cre"), 7 | comment = c(ORCID = "0000-0002-2127-9456")), 8 | person("Patrick", "Schratz", role = c("aut"), 9 | comment = c(ORCID = "0000-0003-0748-6624")), 10 | person("Kirill", "Müller", role = "aut", 11 | comment = c(ORCID = "0000-0002-1416-3412")), 12 | person("Mika", "Braginsky", , "mika.br@gmail.com", role = "aut"), 13 | person("Karthik", "Ram", , "karthik.ram@gmail.com", role = "aut"), 14 | person("Jeroen", "Ooms", , "jeroenooms@gmail.com", role = "aut"), 15 | person("Max", "Held", role = "rev", 16 | comment = "Max reviewed the package for ropensci, see "), 17 | person("Anna", "Krystalli", role = "rev", 18 | comment = "Anna reviewed the package for ropensci, see "), 19 | person("Laura", "DeCicco", role = "rev", 20 | comment = "Laura reviewed the package for ropensci, see "), 21 | person("rOpenSci", role = "fnd", comment = c(ROR = "019jywm96")) 22 | ) 23 | Description: Provides a way to describe common build and deployment 24 | workflows for R-based projects: packages, websites (e.g. blogdown, 25 | pkgdown), or data processing (e.g. research compendia). The recipe is 26 | described independent of the continuous integration tool used for 27 | processing the workflow (e.g. 'GitHub Actions' or 'Circle CI'). This 28 | package has been peer-reviewed by rOpenSci (v0.3.0.9004). 29 | License: GPL (>= 2) 30 | URL: https://github.com/ropensci/tic 31 | BugReports: https://github.com/ropensci/tic/issues 32 | Depends: 33 | R (>= 3.2.0) 34 | Imports: 35 | cli (>= 3.2.0), 36 | crayon, 37 | git2r, 38 | lifecycle, 39 | magrittr, 40 | memoise, 41 | methods, 42 | pak, 43 | R6, 44 | remotes, 45 | rlang (>= 1.0.0), 46 | usethis, 47 | withr 48 | Suggests: 49 | base64enc, 50 | blogdown, 51 | bookdown, 52 | callr, 53 | circle, 54 | covr, 55 | desc, 56 | devtools, 57 | drat, 58 | fansi, 59 | gh (>= 1.1.0), 60 | knitr, 61 | openssl, 62 | pkgdepends, 63 | pkgdown, 64 | purrr, 65 | rcmdcheck, 66 | rmarkdown, 67 | rprojroot, 68 | sodium, 69 | stats, 70 | stringr, 71 | testthat (>= 2.1.0), 72 | utils 73 | VignetteBuilder: 74 | knitr 75 | RdMacros: 76 | lifecycle 77 | ByteCompile: No 78 | Config/testthat/edition: 3 79 | Config/testthat/parallel: true 80 | Encoding: UTF-8 81 | Roxygen: list(markdown = TRUE) 82 | RoxygenNote: 7.3.2 83 | SystemRequirements: sodium harfbuzz fribidi libgit2 84 | Collate: 85 | 'base64.R' 86 | 'ci.R' 87 | 'circleci.R' 88 | 'droneci.R' 89 | 'dsl-storage.R' 90 | 'dsl.R' 91 | 'gh-actions.R' 92 | 'git2r.R' 93 | 'helpers_github.R' 94 | 'install.R' 95 | 'local.R' 96 | 'macro.R' 97 | 'macro-package-checks.R' 98 | 'macro-pkgdown.R' 99 | 'macro-blogdown.R' 100 | 'macro-bookdown.R' 101 | 'macro-drat.R' 102 | 'macro-readme-rmd.R' 103 | 'mock.R' 104 | 'print.R' 105 | 'repo.R' 106 | 'run.R' 107 | 'stage.R' 108 | 'steps-base.R' 109 | 'steps-blogdown.R' 110 | 'steps-bookdown.R' 111 | 'steps-code.R' 112 | 'steps-drat.R' 113 | 'steps-git.R' 114 | 'steps-install.R' 115 | 'steps-rcmdcheck.R' 116 | 'steps-pkgdown.R' 117 | 'steps-session-info.R' 118 | 'steps-ssh.R' 119 | 'steps-write-text-file.R' 120 | 'tic-package.R' 121 | 'update-yaml-helpers.R' 122 | 'update-yaml.R' 123 | 'use-badge.R' 124 | 'use-yaml.R' 125 | 'use_tic.R' 126 | 'utils.R' 127 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | S3method(print,TicStage) 4 | S3method(print,TicStages) 5 | export("%>%") 6 | export(TicStep) 7 | export(add_code_step) 8 | export(add_package_checks) 9 | export(add_step) 10 | export(after_deploy) 11 | export(after_failure) 12 | export(after_install) 13 | export(after_script) 14 | export(after_success) 15 | export(base64serialize) 16 | export(base64unserialize) 17 | export(before_deploy) 18 | export(before_install) 19 | export(before_script) 20 | export(ci) 21 | export(ci_can_push) 22 | export(ci_cat_with_color) 23 | export(ci_get_branch) 24 | export(ci_get_build_number) 25 | export(ci_get_build_url) 26 | export(ci_get_commit) 27 | export(ci_get_env) 28 | export(ci_get_slug) 29 | export(ci_has_env) 30 | export(ci_is_env) 31 | export(ci_is_interactive) 32 | export(ci_is_tag) 33 | export(ci_on_circle) 34 | export(ci_on_ghactions) 35 | export(deploy) 36 | export(do_blogdown) 37 | export(do_bookdown) 38 | export(do_drat) 39 | export(do_package_checks) 40 | export(do_pkgdown) 41 | export(do_readme_rmd) 42 | export(dsl_get) 43 | export(dsl_init) 44 | export(dsl_load) 45 | export(get_stage) 46 | export(gha_add_secret) 47 | export(install) 48 | export(list_macros) 49 | export(prepare_all_stages) 50 | export(repo_bioc) 51 | export(repo_cloud) 52 | export(repo_cran) 53 | export(repo_default) 54 | export(run_all_stages) 55 | export(run_stage) 56 | export(script) 57 | export(step_add_to_drat) 58 | export(step_add_to_known_hosts) 59 | export(step_build_blogdown) 60 | export(step_build_bookdown) 61 | export(step_build_pkgdown) 62 | export(step_do_push_deploy) 63 | export(step_hello_world) 64 | export(step_install_cran) 65 | export(step_install_deps) 66 | export(step_install_github) 67 | export(step_install_ssh_keys) 68 | export(step_push_deploy) 69 | export(step_rcmdcheck) 70 | export(step_run_code) 71 | export(step_session_info) 72 | export(step_setup_push_deploy) 73 | export(step_setup_ssh) 74 | export(step_test_ssh) 75 | export(step_write_text_file) 76 | export(update_yml) 77 | export(use_circle_yml) 78 | export(use_ghactions_deploy) 79 | export(use_ghactions_yml) 80 | export(use_tic) 81 | export(use_tic_badge) 82 | export(use_tic_r) 83 | export(use_update_tic) 84 | import(cli) 85 | import(rlang) 86 | importFrom(R6,R6Class) 87 | importFrom(crayon,has_color) 88 | importFrom(lifecycle,deprecate_soft) 89 | importFrom(magrittr,"%>%") 90 | importFrom(memoise,memoise) 91 | importFrom(methods,setOldClass) 92 | importFrom(rlang,try_fetch) 93 | importFrom(utils,menu) 94 | importFrom(utils,packageName) 95 | -------------------------------------------------------------------------------- /R/base64.R: -------------------------------------------------------------------------------- 1 | #' Helpers for converting R objects to strings and back 2 | #' 3 | #' @description 4 | #' `base64serialize()` converts an R object into a string suitable for storing 5 | #' in an environment variable. Use this function for encoding entire R objects 6 | #' (such as OAuth tokens). 7 | #' 8 | #' @param x Object to serialize or deserialize 9 | #' @param compression Passed on as `type` argument to [memCompress()] or 10 | #' [memDecompress()]. 11 | #' @export 12 | #' @examples 13 | #' serial <- base64serialize(1:10) 14 | base64serialize <- function(x, compression = "gzip") { 15 | raw <- serialize(x, connection = NULL) 16 | compressed <- memCompress(raw, type = compression) 17 | encoded <- base64enc::base64encode(compressed) 18 | encoded 19 | } 20 | 21 | #' @rdname base64serialize 22 | #' @description 23 | #' `base64unserialize()` is the inverse operation to `base64serialize()`. 24 | #' Use this function in your `tic.R` to access the R object previously encoded 25 | #' by `base64serialize()`. 26 | #' 27 | #' @export 28 | #' @examples 29 | #' base64unserialize(serial) 30 | base64unserialize <- function(x, compression = "gzip") { 31 | decoded <- base64enc::base64decode(x) 32 | expanded <- memDecompress(decoded, type = compression) 33 | ret <- unserialize(expanded) 34 | ret 35 | } 36 | -------------------------------------------------------------------------------- /R/circleci.R: -------------------------------------------------------------------------------- 1 | # nocov start 2 | #' @include ci.R 3 | CircleCI <- R6Class( # nolint 4 | "CircleCI", 5 | inherit = CI, 6 | 7 | public = list( 8 | get_branch = function() { 9 | Sys.getenv("CIRCLE_BRANCH") 10 | }, 11 | get_tag = function() { 12 | Sys.getenv("CIRCLE_TAG") 13 | }, 14 | is_tag = function() { 15 | self$get_tag() != "" 16 | }, 17 | get_slug = function() { 18 | sprintf( 19 | "%s/%s", Sys.getenv("CIRCLE_PROJECT_USERNAME"), 20 | Sys.getenv("CIRCLE_PROJECT_REPONAME") 21 | ) 22 | }, 23 | get_build_number = function() { 24 | paste0("CircleCI build ", self$get_env("CIRCLE_BUILD_NUM")) 25 | }, 26 | get_build_url = function() { 27 | Sys.getenv("CIRCLE_BUILD_URL") 28 | }, 29 | get_commit = function() { 30 | Sys.getenv("CIRCLE_COMMIT") 31 | }, 32 | can_push = function(name) { 33 | # FIXME: Currently there is no way to check for the 'github-user-key' on 34 | # Circle CI in an easy way (we always need the API key). 35 | # Proceed anyway and error during git push in `step_do_push_deploy()`. 36 | TRUE 37 | }, 38 | get_env = function(env) { 39 | Sys.getenv(env) 40 | }, 41 | is_env = function(env, value) { 42 | self$get_env(env) == value 43 | }, 44 | has_env = function(env) { 45 | self$get_env(env) != "" 46 | }, 47 | on_circle = function() { 48 | TRUE 49 | } 50 | ) 51 | ) 52 | # nocov end 53 | -------------------------------------------------------------------------------- /R/droneci.R: -------------------------------------------------------------------------------- 1 | # nocov start 2 | #' @include ci.R 3 | DRONE_CI <- R6Class( # nolint 4 | "DRONE_CI", 5 | inherit = CI, 6 | public = list( 7 | get_branch = function() { 8 | Sys.getenv("DRONE_BRANCH") 9 | }, 10 | get_tag = function() { 11 | Sys.getenv("DRONE_TAG") 12 | }, 13 | is_tag = function() { 14 | self$get_tag() != "" 15 | }, 16 | get_slug = function() { 17 | Sys.getenv("DRONE_REPO") 18 | }, 19 | get_build_number = function() { 20 | paste0("DRONE_CI build ", self$get_env("DRONE_BUILD_NUMBER")) 21 | }, 22 | get_build_url = function() { 23 | Sys.getenv("DRONE_BUILD_LINK") 24 | }, 25 | get_commit = function() { 26 | Sys.getenv("DRONE_COMMIT") 27 | }, 28 | can_push = function(name) { 29 | # Deployment permissions must be ensured by users themselves on their 30 | # environment. 31 | # Setting TRUE to proceed anyway and error during git push in 32 | # `step_do_push_deploy()`. 33 | TRUE 34 | }, 35 | get_env = function(env) { 36 | Sys.getenv(env) 37 | }, 38 | is_env = function(env, value) { 39 | self$get_env(env) == value 40 | }, 41 | has_env = function(env) { 42 | self$get_env(env) != "" 43 | }, 44 | ON_DRONE = function() { 45 | TRUE 46 | } 47 | ) 48 | ) 49 | # nocov end 50 | -------------------------------------------------------------------------------- /R/dsl.R: -------------------------------------------------------------------------------- 1 | #' @import rlang 2 | NULL 3 | 4 | #' tic's domain-specific language 5 | #' 6 | #' Functions to define stages and their constituent steps. 7 | #' The [macro]s combine several steps and assign them to relevant 8 | #' stages. 9 | #' See [dsl_get()] for functions to access the storage for the stages 10 | #' and their steps. 11 | #' 12 | #' @name dsl 13 | #' @aliases DSL 14 | NULL 15 | 16 | #' @description 17 | #' `get_stage()` returns a `TicStage` object for a stage given by name. 18 | #' This function can be called directly in the `tic.R` configuration file, 19 | #' which is processed by [dsl_load()]. 20 | #' 21 | #' @param name `[string]`\cr 22 | #' The name for the stage. 23 | #' @rdname dsl 24 | #' @export 25 | #' @examples 26 | #' dsl_init() 27 | #' 28 | #' get_stage("script") 29 | get_stage <- function(name) { 30 | # Initialize if necessary 31 | dsl_get() 32 | 33 | dslobj_get()$get_stage(name) 34 | } 35 | 36 | #' @description 37 | #' `add_step()` adds a step to a stage, see [step_hello_world()] 38 | #' and the links therein for available steps. 39 | #' 40 | #' @param stage `[TicStage]`\cr 41 | #' A `TicStage` object as returned by `get_stage()`. 42 | #' @param step `[function]`\cr 43 | #' An object of class [TicStep], usually created by functions 44 | #' with the `step_` prefix like [step_hello_world()]. 45 | #' @rdname dsl 46 | #' @export 47 | #' @examples 48 | #' 49 | #' get_stage("script") %>% 50 | #' add_step(step_hello_world()) 51 | #' 52 | #' get_stage("script") 53 | add_step <- function(stage, step) { 54 | step_quo <- enquo(step) 55 | 56 | tryCatch( 57 | step <- eval_tidy(step_quo), 58 | error = function(e) { 59 | stop( 60 | "Error evaluating the step argument of add_step(), ", 61 | "expected an object of class TicStep.\n", 62 | "Original error: ", conditionMessage(e), 63 | call. = FALSE 64 | ) 65 | } 66 | ) 67 | 68 | stopifnot(inherits(step, "TicStep")) 69 | 70 | stage$add_step(step, quo_text(step_quo)) 71 | } 72 | 73 | #' @description 74 | #' `add_code_step()` is a shortcut for `add_step(step_run_code(...))`. 75 | #' 76 | #' @export 77 | #' @inheritParams step_run_code 78 | #' @rdname dsl 79 | #' @examples 80 | #' 81 | #' get_stage("script") %>% 82 | #' add_code_step(print("Hi!")) 83 | #' 84 | #' get_stage("script") 85 | add_code_step <- function(stage, call = NULL, prepare_call = NULL) { 86 | call_expr <- enexpr(call) 87 | prepare_call_expr <- enexpr(prepare_call) 88 | 89 | if (is.null(prepare_call_expr)) { 90 | step <- quo(step_run_code(!!call_expr)) 91 | } else { 92 | step <- quo(step_run_code(!!call_expr, !!prepare_call_expr)) 93 | } 94 | add_step(stage, !!step) 95 | } 96 | 97 | #' @importFrom magrittr %>% 98 | #' @export 99 | magrittr::`%>%` 100 | 101 | TicDSL <- R6Class( # nolint 102 | "TicDSL", 103 | public = list( 104 | initialize = function() { 105 | stage_names <- c( 106 | "before_install", 107 | "install", 108 | "after_install", 109 | "before_script", 110 | "script", 111 | "after_success", 112 | "after_failure", 113 | "before_deploy", 114 | "deploy", 115 | "after_deploy", 116 | "after_script" 117 | ) 118 | 119 | private$stages <- lapply(stats::setNames(nm = stage_names), TicStage$new) 120 | }, 121 | 122 | get_stage = function(name) { 123 | stage <- self$get_stages()[[name]] 124 | if (is.null(stage)) { 125 | stop("Unknown stage ", name, ".", call. = FALSE) 126 | } 127 | stage 128 | }, 129 | 130 | get_stages = function() { 131 | new_stages(private$stages) 132 | } 133 | ), 134 | 135 | private = list( 136 | stages = NULL 137 | ) 138 | ) 139 | -------------------------------------------------------------------------------- /R/git2r.R: -------------------------------------------------------------------------------- 1 | git2r_attrib <- function(x, name) { 2 | if (utils::packageVersion("git2r") > "0.21.0") { 3 | x[[name]] 4 | } else { 5 | `@`(x, as.name(name)) 6 | } 7 | } 8 | 9 | git2r_head <- function(x) { 10 | if (utils::packageVersion("git2r") > "0.21.0") { 11 | git2r::repository_head(x) 12 | } else { 13 | utils::head(x) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /R/install.R: -------------------------------------------------------------------------------- 1 | # This code can only run as part of a CI run 2 | # nocov start 3 | 4 | verify_install <- function(pkg_names) { # nolint 5 | lapply(pkg_names, function(x) verify_install_one(x)) 6 | } 7 | 8 | verify_install_one <- function(pkg_name) { # nolint 9 | pak::pkg_install(pkg_name, upgrade = TRUE) 10 | if (!package_installed(pkg_name)) { 11 | stopc( 12 | "Error installing package ", pkg_name, " or one of its dependencies." 13 | ) 14 | } 15 | } 16 | 17 | package_installed <- function(pkg_name) { 18 | path <- system.file("DESCRIPTION", package = pkg_name) 19 | file.exists(path) 20 | } 21 | 22 | # This code can only run as part of a CI run 23 | # nocov end 24 | -------------------------------------------------------------------------------- /R/local.R: -------------------------------------------------------------------------------- 1 | LocalCI <- R6Class( 2 | "LocalCI", 3 | inherit = CI, 4 | public = list( 5 | get_branch = function() { 6 | # Suppress warnings that occur if not in a Git repo 7 | suppressWarnings(system2("git", "rev-parse --abbrev-ref HEAD", 8 | stdout = TRUE 9 | )) 10 | }, 11 | get_tag = function() { 12 | # Suppress warnings that occur if not in a Git repo 13 | suppressWarnings(system2("git", "describe", stdout = TRUE)) 14 | }, 15 | is_tag = function() { 16 | # Suppress warnings that occur if not in a Git repo 17 | suppressWarnings(length(system2("git", c("tag", "--points-at", "HEAD"), 18 | stdout = TRUE 19 | )) > 0) 20 | }, 21 | get_slug = function() { 22 | # Suppress error that occurs if not in a Git repo 23 | tryCatch( 24 | { 25 | remote <- gh::gh_tree_remote() 26 | paste0(remote$username, "/", remote$repo) 27 | }, 28 | error = function(e) { 29 | return() 30 | } 31 | ) 32 | }, 33 | get_build_number = function() { 34 | "local build" 35 | }, 36 | get_build_url = function() { 37 | NULL 38 | }, 39 | get_commit = function() { 40 | # Suppress error that occurs if not in a Git repo 41 | tryCatch(git2r::revparse_single(revision = "HEAD")$sha, error = "") 42 | }, 43 | can_push = function(name = "TIC_DEPLOY_KEY") { 44 | TRUE 45 | }, 46 | get_env = function(env) { 47 | Sys.getenv(env) 48 | }, 49 | is_env = function(env, value) { 50 | self$get_env(env) == value 51 | }, 52 | has_env = function(env) { 53 | self$get_env(env) != "" 54 | }, 55 | is_interactive = function() { 56 | TRUE 57 | } 58 | ) 59 | ) 60 | -------------------------------------------------------------------------------- /R/macro-drat.R: -------------------------------------------------------------------------------- 1 | #' do_drat 2 | #' 3 | #' The [do_drat()] macro adds the necessary steps for building 4 | #' and deploying a drat repository to host R package sources. 5 | #' 6 | #' @include macro.R 7 | #' @include macro-package-checks.R 8 | #' @name macro 9 | NULL 10 | 11 | #' Build and deploy drat repository 12 | #' 13 | #' @description 14 | #' `do_drat()` builds and deploys R packages to a drat repository and adds 15 | #' default steps to the `"install"`, `"before_deploy"` and `"deploy"` stages: 16 | #' 17 | #' @inheritParams step_add_to_drat 18 | #' @inheritParams step_setup_ssh 19 | #' @inheritParams step_setup_push_deploy 20 | #' @inheritParams step_do_push_deploy 21 | #' @param path,branch By default, this macro deploys the default repo branch 22 | #' (usually "master") of the drat repository. 23 | #' An alternative option is `"gh-pages"`. 24 | #' @template private_key_name 25 | #' 26 | #' @section Deployment: 27 | #' Deployment can only happen to the default repo branch (usually "master") or 28 | #' `gh-pages` branch because the GitHub Pages functionality from GitHub is 29 | #' used to access the drat repository later on. You need to enable this 30 | #' functionality when creating the drat repository on GitHub via `Settings -> 31 | #' GitHub pages` and set it to the chosen setting here. 32 | #' 33 | #' To build and deploy Windows and macOS binaries, builds with deployment 34 | #' permissions need to be triggered. 35 | #' Have a look at 36 | #' \url{https://docs.ropensci.org/tic/articles/deployment.html} for 37 | #' more information and instructions. 38 | #' @family macros 39 | #' @export 40 | #' @examples 41 | #' \dontrun{ 42 | #' dsl_init() 43 | #' 44 | #' do_drat() 45 | #' 46 | #' dsl_get() 47 | #' } 48 | do_drat <- function(repo_slug = NULL, 49 | orphan = FALSE, 50 | checkout = TRUE, 51 | path = "~/git/drat", 52 | branch = NULL, 53 | remote_url = NULL, 54 | commit_message = NULL, 55 | commit_paths = ".", 56 | force = FALSE, 57 | private_key_name = "TIC_DEPLOY_KEY", 58 | deploy_dev = FALSE) { 59 | if (is.null(branch)) { 60 | branch <- github_info()$default_branch 61 | } 62 | 63 | #' @description 64 | #' 1. [step_setup_ssh()] in the `"before_deploy"` to setup 65 | #' the upcoming deployment 66 | get_stage("before_deploy") %>% 67 | add_step(step_setup_ssh(private_key_name = private_key_name)) 68 | 69 | #' 1. [step_setup_push_deploy()] in the `"before_deploy"` stage 70 | #' (if `deploy` is set), 71 | get_stage("before_deploy") %>% 72 | add_step(step_setup_push_deploy( 73 | path = !!enquo(path), 74 | branch = !!enquo(branch), 75 | remote_url = paste0("git@github.com:", repo_slug, ".git"), 76 | orphan = !!enquo(orphan), 77 | checkout = !!enquo(checkout) 78 | )) 79 | 80 | #' 1. [step_add_to_drat()] in the `"deploy"` 81 | get_stage("deploy") %>% 82 | add_step(step_add_to_drat( 83 | repo_slug = repo_slug, deploy_dev = deploy_dev 84 | )) 85 | 86 | #' 1. [step_do_push_deploy()] in the `"deploy"` stage. 87 | get_stage("deploy") %>% 88 | add_step(step_do_push_deploy( 89 | path = !!enquo(path), 90 | commit_message = !!enquo(commit_message), 91 | commit_paths = !!enquo(commit_paths), 92 | force = !!enquo(force) 93 | )) 94 | 95 | dsl_get() 96 | } 97 | -------------------------------------------------------------------------------- /R/macro-package-checks.R: -------------------------------------------------------------------------------- 1 | #' do_package_checks 2 | #' 3 | #' The [do_package_checks()] macro adds default checks for R packages, 4 | #' including installation of dependencies and running a test coverage 5 | #' analysis. 6 | #' 7 | #' @include macro.R 8 | #' @name macro 9 | NULL 10 | 11 | #' Add default checks for packages 12 | #' 13 | #' @description 14 | #' `do_package_checks()` adds default steps related to package checks 15 | #' to the `"before_install"`, `"install"`, `"script"` and `"after_success"` 16 | #' stages: 17 | #' 18 | #' This macro is only available for R packages. 19 | #' 20 | #' @inheritParams step_rcmdcheck 21 | #' @inheritParams step_install_pkg 22 | #' @param codecov `[flag]`\cr Whether to include a step running 23 | #' `covr::codecov(quiet = FALSE)` (default: only for non-interactive CI, 24 | #' see [ci_is_interactive()]). 25 | #' @family macros 26 | #' @export 27 | #' @examples 28 | #' dsl_init() 29 | #' 30 | #' do_package_checks() 31 | #' 32 | #' dsl_get() 33 | do_package_checks <- function(..., 34 | codecov = !ci_is_interactive(), 35 | warnings_are_errors = NULL, 36 | notes_are_errors = NULL, 37 | args = NULL, 38 | build_args = NULL, 39 | error_on = "warning", 40 | repos = repo_default(), 41 | dependencies = TRUE, 42 | timeout = Inf, 43 | check_dir = "check") { 44 | #' @description 45 | #' 1. [step_install_deps()] in the `"install"` stage, using the 46 | #' `repos` argument. 47 | #' 1. [step_session_info()] in the `"install"` stage. 48 | get_stage("install") %>% 49 | add_step( 50 | step_install_deps(dependencies = {{ dependencies }}) 51 | ) %>% 52 | add_step( 53 | step_session_info() 54 | ) 55 | 56 | #' 1. [step_rcmdcheck()] in the `"script"` stage, using the 57 | #' `warnings_are_errors`, `notes_are_errors`, `args`, and 58 | #' `build_args` arguments. 59 | get_stage("script") %>% 60 | add_step( 61 | step_rcmdcheck( 62 | warnings_are_errors = !!enquo(warnings_are_errors), 63 | notes_are_errors = !!enquo(notes_are_errors), 64 | args = !!enquo(args), 65 | build_args = !!enquo(build_args), 66 | error_on = !!enquo(error_on), 67 | repos = !!enquo(repos), 68 | timeout = !!enquo(timeout), 69 | check_dir = !!enquo(check_dir) 70 | ) 71 | ) 72 | 73 | if (isTRUE(codecov)) { 74 | #' 1. A call to [covr::codecov()] in the `"after_success"` stage 75 | #' (only if the `codecov` flag is set) 76 | get_stage("after_success") %>% 77 | add_code_step(covr::codecov(quiet = FALSE)) 78 | } 79 | 80 | dsl_get() 81 | } 82 | 83 | #' Deprecated functions 84 | #' 85 | #' `add_package_checks()` has been replaced by [do_package_checks()]. 86 | #' 87 | #' @inheritParams do_package_checks 88 | #' @name Deprecated 89 | #' @export 90 | add_package_checks <- function(..., 91 | warnings_are_errors = NULL, 92 | notes_are_errors = NULL, 93 | args = c("--no-manual", "--as-cran"), 94 | build_args = "--force", error_on = "warning", 95 | repos = repo_default(), timeout = Inf) { 96 | .Deprecated("do_package_checks") 97 | do_package_checks( 98 | ... = ..., 99 | warnings_are_errors = warnings_are_errors, 100 | notes_are_errors = notes_are_errors, 101 | args = args, 102 | build_args = build_args, error_on = error_on, 103 | repos = repos, timeout = timeout 104 | ) 105 | } 106 | -------------------------------------------------------------------------------- /R/macro-readme-rmd.R: -------------------------------------------------------------------------------- 1 | #' do_readme_rmd 2 | #' 3 | #' The [do_readme_rmd()] macro renders an R Markdown README and deploys 4 | #' the rendered README.md file to Github. 5 | #' 6 | #' @include macro.R 7 | #' @include macro-package-checks.R 8 | #' @name macro 9 | NULL 10 | 11 | #' Render a R Markdown README and deploy to Github 12 | #' 13 | #' @description 14 | #' `r lifecycle::badge("experimental")` 15 | #' 16 | #' `do_readme_rmd()` renders an R Markdown README and deploys 17 | #' the rendered README.md file to Github. It adds default steps to the 18 | #' `"before_deploy"` and `"deploy"` stages: 19 | #' 20 | #' @inheritParams step_setup_ssh 21 | #' @inheritParams step_setup_push_deploy 22 | #' @inheritParams step_do_push_deploy 23 | #' @template private_key_name 24 | #' 25 | #' @family macros 26 | #' @export 27 | #' @examples 28 | #' \dontrun{ 29 | #' dsl_init() 30 | #' 31 | #' do_readme_rmd() 32 | #' 33 | #' dsl_get() 34 | #' } 35 | do_readme_rmd <- function(checkout = TRUE, 36 | remote_url = NULL, 37 | commit_message = NULL, 38 | force = FALSE, 39 | private_key_name = "TIC_DEPLOY_KEY") { 40 | 41 | #' @description 42 | #' 1. [step_setup_ssh()] in the `"before_deploy"` to setup 43 | #' the upcoming deployment 44 | get_stage("before_deploy") %>% 45 | add_step(step_setup_ssh(private_key_name = !!enquo(private_key_name))) 46 | 47 | #' 1. [step_setup_push_deploy()] in the `"before_deploy"` stage 48 | get_stage("before_deploy") %>% 49 | add_step(step_setup_push_deploy( 50 | path = ".", 51 | branch = github_info()$default_branch, 52 | remote_url = !!enquo(remote_url), 53 | orphan = FALSE, 54 | checkout = !!enquo(checkout) 55 | )) 56 | 57 | #' 1. `rmarkdown::render()` in the `"deploy"` stage 58 | get_stage("deploy") %>% 59 | add_code_step(rmarkdown::render("README.Rmd")) 60 | 61 | #' 1. [step_do_push_deploy()] in the `"deploy"` stage. 62 | get_stage("deploy") %>% 63 | add_step(step_do_push_deploy( 64 | path = ".", 65 | commit_message = !!enquo(commit_message), 66 | commit_paths = "README.md", 67 | force = !!enquo(force) 68 | )) 69 | 70 | dsl_get() 71 | } 72 | -------------------------------------------------------------------------------- /R/macro.R: -------------------------------------------------------------------------------- 1 | #' Macros 2 | #' 3 | #' The [DSL] offers a fine-grained interface to the individual stages 4 | #' of a CI run. 5 | #' Macros are tic's way of adding several related steps to the relevant 6 | #' stages. 7 | #' All macros use the `do_` prefix. 8 | #' @name macro 9 | NULL 10 | 11 | #' List available macros 12 | #' 13 | #' @description Lists available macro functions of the `tic` package. 14 | #' @return [character] 15 | #' @family macros 16 | #' @export 17 | list_macros <- function() { 18 | requireNamespace("utils", quietly = TRUE) 19 | as.character(utils::lsf.str("package:tic", pattern = "^do_")) 20 | } 21 | -------------------------------------------------------------------------------- /R/mock.R: -------------------------------------------------------------------------------- 1 | #' @include ci.R 2 | MockCI <- R6Class( 3 | "MockCI", 4 | inherit = CI, 5 | 6 | public = list( 7 | get_branch = function() { 8 | "mock-ci-branch" 9 | }, 10 | get_tag = function() { 11 | "mock-ci-tag" 12 | }, 13 | is_tag = function() { 14 | FALSE 15 | }, 16 | get_slug = function() { 17 | "user/repo" 18 | }, 19 | get_build_number = function() { 20 | "mock build" 21 | }, 22 | get_build_url = function() { 23 | "http://build.url" 24 | }, 25 | get_commit = function() { 26 | "00000000000000000000000000000000" 27 | }, 28 | can_push = function(name = "TIC_DEPLOY_KEY") { 29 | self$has_env(name) 30 | }, 31 | get_env = function(env) { 32 | Sys.getenv(env) 33 | }, 34 | is_env = function(env, value) { 35 | self$get_env(env) == value 36 | }, 37 | has_env = function(env) { 38 | self$get_env(env) != "" 39 | }, 40 | is_interactive = function() { 41 | TRUE 42 | } 43 | ) 44 | ) 45 | -------------------------------------------------------------------------------- /R/print.R: -------------------------------------------------------------------------------- 1 | #' @import cli 2 | #' @export 3 | print.TicStages <- function(x, ...) { 4 | cli::cat_rule("tic configuration summary", col = "blue") 5 | 6 | if (all(vlapply(x, stage_is_empty))) { 7 | cat_bullet( 8 | "No steps defined in any stage", 9 | bullet = "info", bullet_col = "green" 10 | ) 11 | } else { 12 | lapply(x, print, omit_if_empty = TRUE) 13 | } 14 | invisible(x) 15 | } 16 | 17 | #' @export 18 | print.TicStage <- function(x, ..., omit_if_empty = FALSE) { 19 | x$print(omit_if_empty = omit_if_empty) 20 | invisible(x) 21 | } 22 | -------------------------------------------------------------------------------- /R/repo.R: -------------------------------------------------------------------------------- 1 | #' Shortcuts for accessing CRAN-like repositories 2 | #' 3 | #' These functions can be used as convenient shortcuts 4 | #' for the `repos` argument to e.g. [do_package_checks()] and 5 | #' [step_install_deps()]. 6 | #' @name repo 7 | NULL 8 | 9 | #' @rdname repo 10 | #' @export 11 | repo_default <- function() { 12 | #' @description 13 | #' `repo_default()` returns the value of the `"repos"` option, 14 | #' or `repo_cloud()` if the option is not set. 15 | repos <- un_cran(getOption("repos")) 16 | if (length(repos) == 0) { 17 | c(CRAN = repo_cloud()) 18 | } else { 19 | repos 20 | } 21 | } 22 | 23 | #' @rdname repo 24 | #' @export 25 | repo_cloud <- function() { 26 | #' @description 27 | #' `repo_cloud()` returns RStudio's CRAN mirror. 28 | c(CRAN = https("cloud.r-project.org")) 29 | } 30 | 31 | #' @rdname repo 32 | #' @export 33 | repo_cran <- function() { 34 | #' @description 35 | #' `repo_cran()` returns the master CRAN repo. 36 | c(CRAN = https("cran.r-project.org")) 37 | } 38 | 39 | #' @rdname repo 40 | #' @param base The base repo to use, defaults to `repo_default()`. 41 | #' Pass `NULL` to install only from Bioconductor repos. 42 | #' @export 43 | repo_bioc <- function(base = repo_default()) { 44 | #' @description 45 | #' `repo_bioc()` returns Bioconductor repos from 46 | #' [remotes::bioc_install_repos()], in addition to the default repo. 47 | c(base, remotes::bioc_install_repos()) 48 | } 49 | 50 | https <- function(x) { 51 | if (getRversion() >= "3.2") { 52 | paste0("https://", x) 53 | } else { 54 | paste0("http://", x) 55 | } 56 | } 57 | 58 | un_cran <- function(x) { 59 | x[x != "@CRAN@"] 60 | } 61 | -------------------------------------------------------------------------------- /R/steps-base.R: -------------------------------------------------------------------------------- 1 | #' @title The base class for all steps 2 | #' 3 | #' @description 4 | #' Override this class to create a new step. 5 | #' 6 | #' @importFrom R6 R6Class 7 | #' @export 8 | TicStep <- R6Class( 9 | "TicStep", 10 | cloneable = FALSE, 11 | 12 | public = list( 13 | 14 | #' @description 15 | #' Create a `TicStep` object. 16 | initialize = function() { 17 | }, 18 | 19 | #' @description 20 | #' This method must be overridden, it is called when running the stage 21 | #' to which a step has been added. 22 | run = function() { 23 | stopc("Please override the run() method to do something useful.") 24 | }, 25 | 26 | #' @description 27 | #' This is just a placeholder. 28 | #' This method is called when preparing the stage to 29 | #' which a step has been added. It auto-install all packages which are 30 | #' needed for a certain step. For example, `step_build_pkgdown()` requires 31 | #' the _pkgdown_ package. 32 | #' 33 | #' For `add_code_step()`, it autodetects any package calls in the form of 34 | #' `pkg::fun` and tries to install these packages from CRAN. If a steps 35 | #' `prepare_call` is not empty, the `$prepare` method is skipped for this 36 | #' step. This can be useful if a package should be installed from 37 | #' non-standard repositories, e.g. from GitHub. 38 | prepare = function() { 39 | }, 40 | 41 | #' @description 42 | #' This method determines if a step is prepared and run. 43 | #' Return `FALSE` if conditions for running this step are not met. 44 | check = function() { 45 | TRUE 46 | } 47 | ) 48 | ) 49 | 50 | HelloWorld <- R6Class( 51 | "HelloWorld", 52 | inherit = TicStep, 53 | 54 | public = list( 55 | run = function() { 56 | print("Hello, world!") 57 | } 58 | ) 59 | ) 60 | 61 | #' Step: Hello, world! 62 | #' 63 | #' The simplest step possible: prints "Hello, world!" to the console when run, 64 | #' does not require any preparation. This step may be useful to test a \pkg{tic} 65 | #' setup or as a starting point when implementing a custom step. 66 | #' 67 | #' @family steps 68 | #' @export 69 | #' @examples 70 | #' dsl_init() 71 | #' 72 | #' get_stage("script") %>% 73 | #' add_step(step_hello_world()) 74 | #' 75 | #' dsl_get() 76 | step_hello_world <- function() { 77 | HelloWorld$new() 78 | } 79 | -------------------------------------------------------------------------------- /R/steps-blogdown.R: -------------------------------------------------------------------------------- 1 | BuildBlogdown <- R6Class( 2 | "BuildBlogdown", 3 | inherit = TicStep, 4 | 5 | public = list( 6 | initialize = function(...) { 7 | private$blogdown_args <- list(...) 8 | super$initialize() 9 | }, 10 | 11 | run = function() { 12 | do.call(blogdown::build_site, private$blogdown_args) 13 | }, 14 | 15 | prepare = function() { 16 | verify_install(c("blogdown")) 17 | super$prepare() 18 | } 19 | ), 20 | 21 | private = list( 22 | blogdown_args = NULL 23 | ) 24 | ) 25 | 26 | #' Step: Build a Blogdown Site 27 | #' 28 | #' Build a Blogdown site using [blogdown::build_site()]. 29 | #' 30 | #' @inheritDotParams blogdown::build_site 31 | #' 32 | #' @export 33 | #' @examples 34 | #' dsl_init() 35 | #' 36 | #' get_stage("script") %>% 37 | #' add_step(step_build_blogdown(".")) 38 | #' 39 | #' dsl_get() 40 | step_build_blogdown <- function(...) { 41 | BuildBlogdown$new(...) 42 | } 43 | -------------------------------------------------------------------------------- /R/steps-bookdown.R: -------------------------------------------------------------------------------- 1 | BuildBookdown <- R6Class( 2 | "BuildBookdown", 3 | inherit = TicStep, 4 | public = list( 5 | initialize = function(...) { 6 | private$bookdown_args <- list(...) 7 | super$initialize() 8 | }, 9 | run = function() { 10 | do.call(bookdown::render_book, private$bookdown_args) 11 | }, 12 | prepare = function() { 13 | verify_install(c("bookdown")) 14 | super$prepare() 15 | } 16 | ), 17 | private = list( 18 | bookdown_args = NULL 19 | ) 20 | ) 21 | 22 | #' Step: Build a bookdown book 23 | #' 24 | #' Build a bookdown book using [bookdown::render_book()]. 25 | #' 26 | #' @param ... See [bookdown::render_book]. 27 | #' 28 | #' @export 29 | #' @examples 30 | #' dsl_init() 31 | #' 32 | #' get_stage("script") %>% 33 | #' add_step(step_build_bookdown(".")) 34 | #' 35 | #' dsl_get() 36 | step_build_bookdown <- function(...) { 37 | BuildBookdown$new(...) 38 | } 39 | -------------------------------------------------------------------------------- /R/steps-code.R: -------------------------------------------------------------------------------- 1 | RunCode <- R6Class( 2 | "RunCode", 3 | inherit = TicStep, 4 | 5 | public = list( 6 | initialize = function(call, prepare_call = NULL) { 7 | private$call <- enexpr(call) 8 | private$prepare_call <- enexpr(prepare_call) 9 | private$seed <- 123 10 | }, 11 | 12 | run = function() { 13 | set.seed(private$seed) 14 | eval(private$call, envir = .GlobalEnv) 15 | }, 16 | 17 | prepare = function() { 18 | # allow installation of packages from nonstandard repositories, e.g. 19 | # GitHub packages using a repo slug 20 | if (!is.null(private$prepare_call)) { 21 | private$install_call_dep(private$prepare_call) 22 | set.seed(private$seed) 23 | eval(private$prepare_call, envir = .GlobalEnv) 24 | } else { 25 | private$install_call_dep(private$call) 26 | } 27 | } 28 | ), 29 | 30 | private = list( 31 | call = NULL, 32 | prepare_call = NULL, 33 | seed = NULL, 34 | 35 | install_call_dep = function(call) { 36 | pkg_name <- unique(get_deps_from_code(call)) 37 | base_packages <- rownames(utils::installed.packages(priority = "base")) 38 | pkg_name <- setdiff(pkg_name, base_packages) 39 | 40 | verify_install(pkg_name) 41 | } 42 | ) 43 | ) 44 | 45 | #' Step: Run arbitrary R code 46 | #' 47 | #' Captures the expression and executes it when running the step. 48 | #' An optional preparatory expression can be provided that is executed 49 | #' during preparation. 50 | #' If the top-level expression is a qualified function call (of the format 51 | #' `package::fun()`), the package is installed during preparation. 52 | #' 53 | #' @param call `[call]`\cr 54 | #' An arbitrary R expression executed during the stage to which this step is 55 | #' added. 56 | #' The default is useful if you only pass `prepare_call`. 57 | #' @param prepare_call `[call]`\cr 58 | #' An optional arbitrary R expression executed during preparation. 59 | #' @family steps 60 | #' @examples 61 | #' dsl_init() 62 | #' 63 | #' get_stage("install") %>% 64 | #' add_step(step_run_code(update.packages(ask = FALSE))) 65 | #' 66 | #' # Will install covr from CRAN during preparation: 67 | #' get_stage("after_success") %>% 68 | #' add_code_step(covr::codecov()) 69 | #' 70 | #' dsl_get() 71 | #' @export 72 | step_run_code <- function(call = NULL, prepare_call = NULL) { 73 | RunCode$new(!!enexpr(call), !!enexpr(prepare_call)) 74 | } 75 | -------------------------------------------------------------------------------- /R/steps-drat.R: -------------------------------------------------------------------------------- 1 | AddToDrat <- R6Class( 2 | "AddToDrat", 3 | inherit = TicStep, 4 | 5 | public = list( 6 | initialize = function(repo_slug = NULL, deploy_dev = FALSE) { 7 | private$repo_slug <- repo_slug 8 | private$deploy_dev <- deploy_dev 9 | }, 10 | 11 | prepare = function() { 12 | verify_install(c( 13 | "drat", "remotes", "rmarkdown", "withr", "pkgbuild", 14 | "desc", "usethis" 15 | )) 16 | }, 17 | 18 | run = function() { 19 | if (is.null(private$repo_slug)) { 20 | stopc("A repository to deploy to is required.") 21 | } 22 | 23 | ver <- desc::desc_get_version() 24 | if (length(unlist(ver)) > 3 && private$deploy_dev == FALSE) { 25 | cli_alert_info("Detected dev version of current package. Not building 26 | package binaries because {.code deploy_dev = FALSE} is 27 | set.", wrap = TRUE) 28 | return(invisible()) 29 | } 30 | else { 31 | path <- pkgbuild::build(binary = (getOption("pkgType") != "source")) 32 | drat::insertPackage(path) 33 | } 34 | } 35 | ), 36 | 37 | private = list( 38 | repo_slug = NULL, 39 | deploy_dev = NULL 40 | ) 41 | ) 42 | 43 | #' Step: Add built package to a drat 44 | #' 45 | #' Builds a package (binary on OS X or Windows) and inserts it into an existing 46 | #' \pkg{drat} repository via [drat::insertPackage()]. 47 | #' @param repo_slug `[string]`\cr 48 | #' The name of the drat repository to deploy to in the form `:owner/:repo`. 49 | #' @param deploy_dev `[logical]`\cr 50 | #' Should development versions of packages also be deployed to the drat repo? 51 | #' By default only "major", "minor" and "patch" releases are build and 52 | #' deployed. 53 | #' @family steps 54 | #' @export 55 | #' @examples 56 | #' dsl_init() 57 | #' 58 | #' get_stage("script") %>% 59 | #' add_step(step_add_to_drat()) 60 | #' 61 | #' dsl_get() 62 | step_add_to_drat <- function(repo_slug = NULL, deploy_dev = FALSE) { 63 | AddToDrat$new( 64 | repo_slug = repo_slug, deploy_dev = deploy_dev 65 | ) 66 | } 67 | -------------------------------------------------------------------------------- /R/steps-pkgdown.R: -------------------------------------------------------------------------------- 1 | #' @include steps-rcmdcheck.R 2 | BuildPkgdown <- R6Class( 3 | "BuildPkgdown", 4 | inherit = TicStep, 5 | public = list( 6 | initialize = function(...) { 7 | private$pkgdown_args <- list(...) 8 | super$initialize() 9 | }, 10 | run = function() { 11 | # pak::local_install(".") 12 | if (dir.exists("docs")) { 13 | pkgdown::clean_site() 14 | } 15 | do.call( 16 | pkgdown::build_site, c(list(preview = FALSE), private$pkgdown_args) 17 | ) 18 | }, 19 | prepare = function() { 20 | if (!file.exists("DESCRIPTION")) { 21 | cli::cli_alert_danger("The {.code step_build_pkgdown()} step and the 22 | {.code do_pkgdown()} macro are only available 23 | for packages.", wrap = TRUE) 24 | stopc("No DESCRIPTION file found.") 25 | } 26 | verify_install("pkgdown") 27 | super$prepare() 28 | } 29 | ), 30 | private = list( 31 | pkgdown_args = NULL 32 | ) 33 | ) 34 | 35 | #' Step: Build pkgdown documentation 36 | #' 37 | #' Builds package documentation with the \pkg{pkgdown} package. 38 | #' Calls `pkgdown::clean_site()` and then `pkgdown::build_site(...)`. 39 | #' 40 | #' @inheritDotParams pkgdown::build_site 41 | #' @family steps 42 | #' @export 43 | #' @examples 44 | #' dsl_init() 45 | #' 46 | #' get_stage("script") %>% 47 | #' add_step(step_build_pkgdown()) 48 | #' 49 | #' dsl_get() 50 | step_build_pkgdown <- function(...) { 51 | BuildPkgdown$new(...) 52 | } 53 | -------------------------------------------------------------------------------- /R/steps-session-info.R: -------------------------------------------------------------------------------- 1 | SessionInfo <- R6Class( 2 | "SessionInfo", 3 | inherit = TicStep, 4 | 5 | public = list( 6 | initialize = function() { 7 | super$initialize() 8 | }, 9 | 10 | prepare = function() { 11 | verify_install("sessioninfo") 12 | super$prepare() 13 | }, 14 | 15 | run = function() { 16 | pkgs <- installed.packages()[, "Package"] 17 | print(sessioninfo::session_info(pkgs)) 18 | }, 19 | 20 | check = function() { 21 | !ci_is_interactive() 22 | } 23 | ) 24 | ) 25 | 26 | #' Step: Print the current Session Info 27 | #' 28 | #' Prints out the package information of the current session via 29 | #' [sessioninfo::session_info()]. 30 | #' 31 | #' @family steps 32 | #' @export 33 | #' @examples 34 | #' dsl_init() 35 | #' 36 | #' get_stage("install") %>% 37 | #' add_step(step_session_info()) 38 | #' 39 | #' dsl_get() 40 | step_session_info <- function() { 41 | SessionInfo$new() 42 | } 43 | -------------------------------------------------------------------------------- /R/steps-write-text-file.R: -------------------------------------------------------------------------------- 1 | WriteTextFile <- R6Class( 2 | "WriteTextFile", 3 | inherit = TicStep, 4 | 5 | public = list( 6 | initialize = function(..., path) { 7 | private$contents <- c(...) 8 | private$path <- path 9 | }, 10 | 11 | run = function() { 12 | dir.create(dirname(private$path), recursive = TRUE) 13 | writeLines(private$contents, private$path) 14 | }, 15 | 16 | check = function() { 17 | !ci_is_interactive() 18 | } 19 | ), 20 | 21 | private = list( 22 | contents = NULL, 23 | path = NULL 24 | ) 25 | ) 26 | 27 | #' Step: Write a text file 28 | #' 29 | #' Creates a text file with arbitrary contents 30 | #' 31 | #' @param ... `[character]`\cr 32 | #' Contents of the text file. 33 | #' @param path `[string]`\cr 34 | #' Path to the new text file. 35 | #' 36 | #' @family steps 37 | #' @export 38 | #' @examples 39 | #' dsl_init() 40 | #' 41 | #' get_stage("script") %>% 42 | #' add_step(step_write_text_file("Hi!", path = "hello.txt")) 43 | #' 44 | #' dsl_get() 45 | step_write_text_file <- function(..., path) { 46 | WriteTextFile$new(..., path = path) 47 | } 48 | -------------------------------------------------------------------------------- /R/tic-package.R: -------------------------------------------------------------------------------- 1 | #' @details 2 | #' The [use_tic()] function prepares a code repository for use with 3 | #' this package. 4 | #' See [DSL] for an overview of \pkg{tic}'s domain-specific 5 | #' language for defining stages and steps, 6 | #' [step_hello_world()] and the links therein for available steps, 7 | #' and [macro] for an overview over the available macros that bundle 8 | #' several steps. 9 | #' @importFrom crayon has_color 10 | #' @importFrom memoise memoise 11 | #' @aliases NULL tic-package 12 | "_PACKAGE" 13 | 14 | # Import methods, to make sure it is available when Rscript is used on Windows 15 | # to run tic verbs 16 | # Reference: https://github.com/tidyverse/hms/commit/0a301d895d35ca61e8d702df58154b8be45900ce 17 | #' @importFrom methods setOldClass 18 | ## usethis namespace: start 19 | #' @importFrom lifecycle deprecate_soft 20 | ## usethis namespace: end 21 | NULL 22 | -------------------------------------------------------------------------------- /R/update-yaml-helpers.R: -------------------------------------------------------------------------------- 1 | account_for_dup_env_vars <- function(custom_env_var_list, 2 | env_var_index_latest, 3 | tmpl_latest) { 4 | requireNamespace("stats", quietly = TRUE) 5 | 6 | # get all custom env vars 7 | env_vars_raw <- gsub(" ", "", 8 | unlist( 9 | lapply(custom_env_var_list, function(x) strsplit(x[2], ":")[[1]][1]), 10 | recursive = TRUE 11 | ), 12 | fixed = TRUE 13 | ) 14 | 15 | # find dups 16 | env_dups <- lapply(env_vars_raw, function(x) { 17 | length(grep( 18 | sprintf("%s: ", x), 19 | tmpl_latest[env_var_index_latest:length(tmpl_latest)] 20 | )) 21 | }) 22 | 23 | for (i in seq_along(env_dups)) { 24 | if (env_dups[[i]] > 1) { 25 | # find the latest instance of the duplicated env var and remove it with 26 | # its comment 27 | env_to_remove <- c( 28 | grep(env_vars_raw[i], tmpl_latest)[2] - 1, 29 | grep(env_vars_raw[i], tmpl_latest)[2] 30 | ) 31 | tmpl_latest[env_to_remove] <- NA 32 | tmpl_latest <- stats::na.omit(tmpl_latest) 33 | cli::cli_alert_info("Found duplicated env var {.var {env_vars_raw[i]}} 34 | after updating to the latest template version. 35 | Removed the latest instance to avoid duplicates. 36 | This happens if a custom env var has the same name as an env var 37 | defined in the {.pkg tic} template.", wrap = TRUE) 38 | } 39 | } 40 | return(tmpl_latest) 41 | } 42 | -------------------------------------------------------------------------------- /R/use-badge.R: -------------------------------------------------------------------------------- 1 | #' Add a CI Status Badge to README files 2 | #' 3 | #' @description 4 | #' Adds a CI status badge to `README.Rmd` or `README.md`. By default the label 5 | #' is `"tic"`. 6 | #' 7 | #' A custom branch can be specified via argument `branch`. 8 | #' 9 | #' @param provider `character(1)`\cr 10 | #' The CI provider to generate a badge for. Only `ghactions` is currently 11 | #' supported 12 | #' @param branch `character(1)`\cr 13 | #' Which branch should the badge represent? Defaults to the default repo 14 | #' branch. 15 | #' @param label `character(1)`\cr 16 | #' Text to use for the badge. 17 | #' 18 | #' @examples 19 | #' \dontrun{ 20 | #' use_tic_badge(provider = "ghactions") 21 | #' 22 | #' # use a different branch 23 | #' use_tic_badge(provider = "ghactions", branch = "develop") 24 | #' } 25 | #' @export 26 | use_tic_badge <- function(provider, 27 | branch = NULL, 28 | label = "tic") { 29 | 30 | requireNamespace("usethis", quietly = TRUE) 31 | 32 | if (is.null(branch)) { 33 | branch <- github_info()$default_branch 34 | } 35 | 36 | label_badge <- label 37 | # whitespaces do not render in README.md files 38 | label_badge <- gsub(" ", "%20", label_badge) 39 | 40 | github_home <- paste0("https://github.com/", ci_get_slug()) 41 | url <- paste0(github_home, "/actions") 42 | img <- paste0( 43 | github_home, 44 | "/workflows/", 45 | label_badge, 46 | "/badge.svg", 47 | "?branch=", 48 | branch 49 | ) 50 | 51 | catch <- tryCatch( 52 | # suppressing "Multiple github remotes found. Using origin." 53 | # the git remote cannot be set anyways 54 | suppressWarnings(usethis::use_badge(label, url, img)), 55 | error = function(cond) { 56 | if ("object 'tic' not found" %in% cond) { 57 | cli_alert_danger("{.fun use_tic_badge}: Could not find anchors in 58 | README.\nYou need to add `` and 59 | `` to README.md/README.Rmd denoting the start and 60 | end of the badges to make {.fun use_tic_badge} work.", 61 | wrap = TRUE 62 | ) 63 | } else { 64 | # return error message if the error is different 65 | message(cond) 66 | } 67 | return(NA) 68 | } 69 | ) 70 | return(invisible(catch)) 71 | } 72 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | target: auto 8 | threshold: 1% 9 | patch: 10 | default: 11 | target: auto 12 | threshold: 1% 13 | -------------------------------------------------------------------------------- /inst/templates/blogdown/all-tic.R: -------------------------------------------------------------------------------- 1 | get_stage("install") %>% 2 | add_step(step_install_deps()) %>% 3 | add_code_step(blogdown::install_hugo()) 4 | 5 | get_stage("deploy") %>% 6 | add_code_step(blogdown::build_site()) 7 | 8 | # deploys site to gh-pages branch, wiping all previous commits 9 | if (ci_has_env("BUILD_BLOGDOWN")) { 10 | get_stage("before_deploy") %>% 11 | add_step(step_setup_ssh()) %>% 12 | add_step(step_setup_push_deploy( 13 | path = "public", branch = "gh-pages", 14 | orphan = TRUE 15 | )) 16 | 17 | if (ci_get_branch() == "main") { 18 | get_stage("deploy") %>% 19 | add_step(step_do_push_deploy(path = "public")) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /inst/templates/blogdown/circle-tic.R: -------------------------------------------------------------------------------- 1 | get_stage("install") %>% 2 | add_step(step_install_deps()) %>% 3 | add_code_step(blogdown::install_hugo()) 4 | 5 | get_stage("deploy") %>% 6 | add_code_step(blogdown::build_site()) 7 | 8 | # deploys site to gh-pages branch, wiping all previous commits 9 | if (ci_on_circle() && ci_has_env("BUILD_BLOGDOWN")) { 10 | get_stage("before_deploy") %>% 11 | add_step(step_setup_ssh()) %>% 12 | add_step(step_setup_push_deploy( 13 | path = "public", branch = "gh-pages", 14 | orphan = TRUE 15 | )) 16 | 17 | if (ci_get_branch() == "main") { 18 | get_stage("deploy") %>% 19 | add_step(step_do_push_deploy(path = "public")) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /inst/templates/blogdown/ghactions-tic.R: -------------------------------------------------------------------------------- 1 | get_stage("install") %>% 2 | add_step(step_install_deps()) %>% 3 | add_code_step(blogdown::install_hugo()) 4 | 5 | get_stage("deploy") %>% 6 | add_code_step(blogdown::build_site()) 7 | 8 | # deploys site to gh-pages branch, wiping all previous commits 9 | if (ci_on_ghactions() && ci_has_env("BUILD_BLOGDOWN")) { 10 | get_stage("before_deploy") %>% 11 | add_step(step_setup_ssh()) %>% 12 | add_step(step_setup_push_deploy( 13 | path = "public", branch = "gh-pages", 14 | orphan = TRUE 15 | )) 16 | 17 | if (ci_get_branch() == "main") { 18 | get_stage("deploy") %>% 19 | add_step(step_do_push_deploy(path = "public")) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /inst/templates/blogdown/none-tic.R: -------------------------------------------------------------------------------- 1 | get_stage("install") %>% 2 | add_step(step_install_deps()) %>% 3 | add_code_step(blogdown::install_hugo()) 4 | 5 | get_stage("deploy") %>% 6 | add_code_step(blogdown::build_site()) 7 | -------------------------------------------------------------------------------- /inst/templates/blogdown/travis-tic.R: -------------------------------------------------------------------------------- 1 | get_stage("install") %>% 2 | add_step(step_install_deps()) %>% 3 | add_code_step(blogdown::install_hugo()) 4 | 5 | get_stage("deploy") %>% 6 | add_code_step(blogdown::build_site()) 7 | 8 | # deploys site to gh-pages branch, wiping all previous commits 9 | if (ci_on_ghactions() && ci_has_env("BUILD_BLOGDOWN")) { 10 | get_stage("before_deploy") %>% 11 | add_step(step_setup_ssh()) %>% 12 | add_step(step_setup_push_deploy( 13 | path = "public", branch = "gh-pages", 14 | orphan = TRUE 15 | )) 16 | 17 | if (ci_get_branch() == "main") { 18 | get_stage("deploy") %>% 19 | add_step(step_do_push_deploy(path = "public")) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /inst/templates/bookdown/all-tic.R: -------------------------------------------------------------------------------- 1 | if (ci_has_env("BUILD_BOOKDOWN")) { 2 | do_bookdown(input = "") 3 | } 4 | -------------------------------------------------------------------------------- /inst/templates/bookdown/circle-tic.R: -------------------------------------------------------------------------------- 1 | if (ci_on_circle() && ci_has_env("BUILD_BOOKDOWN")) { 2 | do_bookdown(input = "") 3 | } 4 | -------------------------------------------------------------------------------- /inst/templates/bookdown/ghactions-tic.R: -------------------------------------------------------------------------------- 1 | if (ci_on_ghactions() && ci_has_env("BUILD_BOOKDOWN")) { 2 | do_bookdown(input = "") 3 | } 4 | -------------------------------------------------------------------------------- /inst/templates/bookdown/none-tic.R: -------------------------------------------------------------------------------- 1 | # set up deployment first and then uncomment this code, possibly by conditioning 2 | # on a CI provider (e.g. if (ci_on_ghactions())) 3 | # if (ci_on_ghactions()) { 4 | # do_bookdown(input = "") 5 | # } 6 | -------------------------------------------------------------------------------- /inst/templates/bookdown/travis-tic.R: -------------------------------------------------------------------------------- 1 | if (ci_on_ghactions() && ci_has_env("BUILD_BOOKDOWN")) { 2 | do_bookdown(input = "") 3 | } 4 | -------------------------------------------------------------------------------- /inst/templates/circle-deploy.yml: -------------------------------------------------------------------------------- 1 | ## tic Circle CI template: linux-deploy 2 | ## revision date: 2023-12-15 3 | version: 2.1 4 | jobs: 5 | r-release: 6 | docker: 7 | - image: rocker/verse 8 | steps: 9 | - checkout 10 | 11 | # create a unique env var for the cache. Unfortunately normal env vars 12 | # are not picked up by the cache, therefore this workaround is needed. 13 | # See https://discuss.circleci.com/t/cannot-use-circle-yml-environment-variables-in-cache-keys/10994/7 14 | - run: echo "$(date '+%d-%m')-r-release" > /tmp/_tmp_file 15 | - restore_cache: 16 | key: R-package-library-{{ checksum "/tmp/_tmp_file" }} 17 | 18 | # install deps and check pkg --------------------------------------------- 19 | - run: 20 | name: "[r-release] Install dependencies" 21 | command: | 22 | sudo apt update && sudo apt install -y pandoc libgit2-dev libcurl4-openssl-dev 23 | R -q -e "install.packages('tic', repos = c('https://ropensci.r-universe.dev', if (grepl('Ubuntu', Sys.info()[['version']])) {sprintf('https://packagemanager.rstudio.com/all/__linux__/%s/latest', system('lsb_release -cs', intern = TRUE))} else {'https://cloud.r-project.org'}))" -e "print(tic::dsl_load())" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()" 24 | 25 | - run: 26 | name: "[r-release] R CMD Check" 27 | no_output_timeout: 60m 28 | command: | 29 | R -q -e 'tic::before_script()' 30 | R -q -e 'tic::script()' 31 | 32 | # save R pkg cache ------------------------------------------------------- 33 | - save_cache: 34 | key: R-package-library-{{ checksum "/tmp/_tmp_file" }} 35 | paths: 36 | - /usr/local/lib/R/site-library 37 | deploy: 38 | environment: 39 | # if you use bookdown or blogdown, replace "PKGDOWN" by the respective 40 | # capitalized term. This also might need to be done in tic.R 41 | BUILD_PKGDOWN: true 42 | 43 | docker: 44 | - image: rocker/verse 45 | steps: 46 | - checkout 47 | 48 | - run: echo "$(date '+%d-%m')-r-release" > /tmp/_tmp_file 49 | - restore_cache: 50 | key: R-package-library-{{ checksum "/tmp/_tmp_file" }} 51 | 52 | - run: 53 | name: Deploy 54 | command: | 55 | sudo apt update && sudo apt install -y pandoc 56 | R -q -e "install.packages('pak', repos = 'https://r-lib.github.io/p/pak/stable')" 57 | R -q -e "if (grepl('Ubuntu', Sys.info()[['version']])) {options(repos = c(CRAN = sprintf('https://packagemanager.rstudio.com/all/__linux__/%s/latest', system('lsb_release -cs', intern = TRUE))))}; pak::pkg_install('ropensci/tic')" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" 58 | R -q -e 'tic::before_deploy()' 59 | R -q -e 'tic::deploy()' 60 | R -q -e 'tic::after_deploy()' 61 | 62 | workflows: 63 | build-and-deploy: 64 | jobs: 65 | - r-release 66 | - deploy: 67 | requires: 68 | - r-release 69 | 70 | # CRON job daily at 4 am in the morning 71 | # - runs the "build" job on the master branch and builds package cache 72 | nightly: 73 | triggers: 74 | - schedule: 75 | cron: "0 4 * * *" 76 | filters: 77 | branches: 78 | only: 79 | - master 80 | - main 81 | - cran-* 82 | jobs: 83 | - r-release 84 | # Custom user code ------------------------------------------------------------- 85 | -------------------------------------------------------------------------------- /inst/templates/circle.yml: -------------------------------------------------------------------------------- 1 | ## tic Circle CI template: linux 2 | ## revision date: 2023-12-15 3 | version: 2.1 4 | jobs: 5 | r-release: 6 | environment: 7 | docker: 8 | - image: rocker/verse 9 | steps: 10 | - checkout 11 | 12 | # create a unique env var for the cache. Unfortunately normal env vars 13 | # are not picked up by the cache, therefore this workaround is needed. 14 | # See https://discuss.circleci.com/t/cannot-use-circle-yml-environment-variables-in-cache-keys/10994/7 15 | - run: echo "$(date '+%d-%m')-r-release" > /tmp/_tmp_file 16 | 17 | - restore_cache: 18 | key: R-package-library-{{ checksum "/tmp/_tmp_file" }} 19 | 20 | # install deps and check pkg --------------------------------------------- 21 | - run: 22 | name: "[r-release] Install dependencies" 23 | command: | 24 | sudo apt update && sudo apt install -y pandoc libgit2-dev libcurl4-openssl-dev 25 | R -q -e "install.packages('tic', repos = c('https://ropensci.r-universe.dev', if (grepl('Ubuntu', Sys.info()[['version']])) {sprintf('https://packagemanager.rstudio.com/all/__linux__/%s/latest', system('lsb_release -cs', intern = TRUE))} else {'https://cloud.r-project.org'}))" -e "print(tic::dsl_load())" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()" 26 | 27 | - run: 28 | name: "[r-release] R CMD Check" 29 | no_output_timeout: 60m 30 | command: | 31 | R -q -e 'tic::before_script()' 32 | R -q -e 'tic::script()' 33 | 34 | # save R pkg cache ------------------------------------------------------- 35 | - save_cache: 36 | key: R-package-library-{{ checksum "/tmp/_tmp_file" }} 37 | paths: 38 | - /usr/local/lib/R/site-library 39 | 40 | workflows: 41 | build: 42 | jobs: 43 | - r-release 44 | 45 | # CRON job daily at 4 am in the morning 46 | # - runs the "build" job on the master branch and builds package cache 47 | nightly: 48 | triggers: 49 | - schedule: 50 | cron: "0 4 * * *" 51 | filters: 52 | branches: 53 | only: 54 | - master 55 | - main 56 | jobs: 57 | - r-release 58 | # Custom user code ------------------------------------------------------------- 59 | -------------------------------------------------------------------------------- /inst/templates/ghactions-core.yml: -------------------------------------------------------------------------------- 1 | 2 | steps: 3 | - uses: actions/checkout@v4 4 | 5 | - uses: r-lib/actions/setup-r@v2 6 | with: 7 | r-version: ${{ matrix.config.r }} 8 | Ncpus: 4 9 | 10 | - uses: r-lib/actions/setup-tinytex@v2 11 | if: matrix.config.latex == 'true' 12 | 13 | - uses: r-lib/actions/setup-pandoc@v2 14 | 15 | - name: Install sys deps for Ubuntu 16 | if: runner.os == 'Linux' 17 | run: sudo apt update && sudo apt install -y libgit2-dev libcurl4-openssl-dev 18 | 19 | # set date/week for use in cache creation 20 | # https://github.community/t5/GitHub-Actions/How-to-set-and-access-a-Workflow-variable/m-p/42970 21 | # - cache R packages daily 22 | - name: "[Cache] Prepare daily timestamp for cache" 23 | if: runner.os != 'Windows' 24 | id: date 25 | run: echo "date=$(date '+%d-%m')" >> $GITHUB_OUTPUT 26 | 27 | - name: "[Cache] Restore R package cache" 28 | if: runner.os != 'Windows' 29 | uses: actions/cache/restore@v3 30 | with: 31 | path: ${{ env.R_LIBS_USER }} 32 | key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}} 33 | 34 | - name: "[Stage] Install" 35 | run: Rscript -e "install.packages('tic', repos = c('https://ropensci.r-universe.dev', if (grepl('Ubuntu', Sys.info()[['version']])) {sprintf('https://packagemanager.rstudio.com/all/__linux__/%s/latest', system('lsb_release -cs', intern = TRUE))} else {'https://cloud.r-project.org'}))" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()" 36 | 37 | - name: "[Cache] Save R package cache" 38 | if: runner.os != 'Windows' && always() 39 | uses: actions/cache/save@v3 40 | with: 41 | path: ${{ env.R_LIBS_USER }} 42 | key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}} 43 | 44 | - name: "[Stage] Script" 45 | run: Rscript -e 'tic::script()' 46 | 47 | - name: "[Stage] After Success" 48 | run: Rscript -e "tic::after_success()" 49 | 50 | - name: "[Stage] Upload R CMD check artifacts" 51 | if: failure() 52 | uses: actions/upload-artifact@v4 53 | with: 54 | name: ${{ runner.os }}-r${{ matrix.config.r }}-results 55 | path: check 56 | -------------------------------------------------------------------------------- /inst/templates/ghactions-deploy.yml: -------------------------------------------------------------------------------- 1 | - name: "[Stage] Before Deploy" 2 | run: | 3 | Rscript -e "tic::before_deploy()" 4 | 5 | - name: "[Stage] Deploy" 6 | run: Rscript -e "tic::deploy()" 7 | 8 | - name: "[Stage] After Deploy" 9 | run: Rscript -e "tic::after_deploy()" 10 | -------------------------------------------------------------------------------- /inst/templates/ghactions-env.yml: -------------------------------------------------------------------------------- 1 | env: 2 | # make sure to run `tic::use_ghactions_deploy()` to set up deployment 3 | TIC_DEPLOY_KEY: ${{ secrets.TIC_DEPLOY_KEY }} 4 | # prevent rgl issues because no X11 display is available 5 | RGL_USE_NULL: true 6 | # if you use bookdown or blogdown, replace "PKGDOWN" by the respective 7 | # capitalized term. This also might need to be done in tic.R 8 | BUILD_PKGDOWN: ${{ matrix.config.pkgdown }} 9 | # use GITHUB_TOKEN from GitHub to workaround rate limits in {remotes} 10 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 11 | -------------------------------------------------------------------------------- /inst/templates/ghactions-meta-custom-deploy.yml: -------------------------------------------------------------------------------- 1 | ## tic GitHub Actions template: custom-deploy 2 | ## revision date: 2023-12-15 3 | # [Custom header] 4 | on: 5 | workflow_dispatch: 6 | push: 7 | branches: 8 | - main 9 | - master 10 | - cran-* 11 | pull_request: 12 | branches: 13 | - main 14 | - master 15 | # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) 16 | schedule: 17 | # * is a special character in YAML so you have to quote this string 18 | - cron: "0 4 * * *" 19 | 20 | name: tic 21 | 22 | jobs: 23 | all: 24 | runs-on: ${{ matrix.config.os }} 25 | 26 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 27 | 28 | strategy: 29 | fail-fast: false 30 | matrix: 31 | config: 32 | ### Custom configs (specify your own runners here) 33 | # [Custom matrix env var] 34 | # - { os: windows-latest, r: "release" } 35 | # [Custom matrix env var] 36 | # - { os: macOS-latest, r: "release", pkgdown: "true", latex: "true" } 37 | # [Custom matrix env var] 38 | # - { os: ubuntu-latest, r: "release" } 39 | # [Custom matrix env var] 40 | # - { os: ubuntu-latest, r: "devel" } 41 | 42 | -------------------------------------------------------------------------------- /inst/templates/ghactions-meta-custom.yml: -------------------------------------------------------------------------------- 1 | ## tic GitHub Actions template: custom 2 | ## revision date: 2023-12-15 3 | # [Custom header] 4 | on: 5 | workflow_dispatch: 6 | push: 7 | branches: 8 | - main 9 | - master 10 | - cran-* 11 | pull_request: 12 | branches: 13 | - main 14 | - master 15 | # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) 16 | schedule: 17 | # * is a special character in YAML so you have to quote this string 18 | - cron: "0 4 * * *" 19 | 20 | name: tic 21 | 22 | jobs: 23 | all: 24 | runs-on: ${{ matrix.config.os }} 25 | 26 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 27 | 28 | strategy: 29 | fail-fast: false 30 | matrix: 31 | config: 32 | ### Custom configs (specify your own runners here) 33 | # [Custom matrix env var] 34 | # - { os: windows-latest, r: "release" } 35 | # [Custom matrix env var] 36 | # - { os: macOS-latest, r: "release", pkgdown: "true", latex: "true" } 37 | # [Custom matrix env var] 38 | # - { os: ubuntu-latest, r: "release" } 39 | # [Custom matrix env var] 40 | # - { os: ubuntu-latest, r: "devel" } 41 | 42 | -------------------------------------------------------------------------------- /inst/templates/ghactions-meta-linux-deploy.yml: -------------------------------------------------------------------------------- 1 | ## tic GitHub Actions template: linux-deploy 2 | ## revision date: 2023-12-15 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | - master 9 | - cran-* 10 | pull_request: 11 | branches: 12 | - main 13 | - master 14 | # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) 15 | schedule: 16 | # * is a special character in YAML so you have to quote this string 17 | - cron: "0 4 * * *" 18 | 19 | name: tic 20 | 21 | jobs: 22 | all: 23 | runs-on: ${{ matrix.config.os }} 24 | 25 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 26 | 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | config: 31 | # use a different tic template type if you do not want to build on all listed platforms 32 | - { os: ubuntu-latest, r: "release", pkgdown: "true" } 33 | 34 | -------------------------------------------------------------------------------- /inst/templates/ghactions-meta-linux-macos-deploy.yml: -------------------------------------------------------------------------------- 1 | ## tic GitHub Actions template: linux-macos-deploy 2 | ## revision date: 2023-12-15 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | - master 9 | - cran-* 10 | pull_request: 11 | branches: 12 | - main 13 | - master 14 | # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) 15 | schedule: 16 | # * is a special character in YAML so you have to quote this string 17 | - cron: "0 4 * * *" 18 | 19 | name: tic 20 | 21 | jobs: 22 | all: 23 | runs-on: ${{ matrix.config.os }} 24 | 25 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 26 | 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | config: 31 | # use a different tic template type if you do not want to build on all listed platforms 32 | - { os: ubuntu-latest, r: "release" } 33 | - { os: macOS-latest, r: "release", pkgdown: "true", latex: "true" } 34 | - { os: ubuntu-latest, r: "devel" } 35 | 36 | -------------------------------------------------------------------------------- /inst/templates/ghactions-meta-linux-macos.yml: -------------------------------------------------------------------------------- 1 | ## tic GitHub Actions template: linux-macos 2 | ## revision date: 2023-12-15 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | - master 9 | - cran-* 10 | pull_request: 11 | branches: 12 | - main 13 | - master 14 | # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) 15 | schedule: 16 | # * is a special character in YAML so you have to quote this string 17 | - cron: "0 4 * * *" 18 | 19 | name: tic 20 | 21 | jobs: 22 | all: 23 | runs-on: ${{ matrix.config.os }} 24 | 25 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 26 | 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | config: 31 | # use a different tic template type if you do not want to build on all listed platforms 32 | - { os: ubuntu-latest, r: "release" } 33 | - { os: macOS-latest, r: "release", latex: "true" } 34 | - { os: ubuntu-latest, r: "devel" } 35 | 36 | -------------------------------------------------------------------------------- /inst/templates/ghactions-meta-linux-windows-deploy.yml: -------------------------------------------------------------------------------- 1 | ## tic GitHub Actions template: linux-macos-windows-deploy 2 | ## revision date: 2023-12-15 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | - master 9 | - cran-* 10 | pull_request: 11 | branches: 12 | - main 13 | - master 14 | # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) 15 | schedule: 16 | # * is a special character in YAML so you have to quote this string 17 | - cron: "0 4 * * *" 18 | 19 | name: tic 20 | 21 | jobs: 22 | all: 23 | runs-on: ${{ matrix.config.os }} 24 | 25 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 26 | 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | config: 31 | # use a different tic template type if you do not want to build on all listed platforms 32 | - { os: ubuntu-latest, r: "release", pkgdown: "true", latex: "true" } 33 | - { os: windows-latest, r: "release" } 34 | 35 | -------------------------------------------------------------------------------- /inst/templates/ghactions-meta-linux-windows.yml: -------------------------------------------------------------------------------- 1 | ## tic GitHub Actions template: linux-windows 2 | ## revision date: 2023-12-15 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | - master 9 | - cran-* 10 | pull_request: 11 | branches: 12 | - main 13 | - master 14 | # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) 15 | schedule: 16 | # * is a special character in YAML so you have to quote this string 17 | - cron: "0 4 * * *" 18 | 19 | name: tic 20 | 21 | jobs: 22 | all: 23 | runs-on: ${{ matrix.config.os }} 24 | 25 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 26 | 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | config: 31 | # use a different tic template type if you do not want to build on all listed platforms 32 | - { os: ubuntu-latest, r: "release", latex: "true" } 33 | - { os: windows-latest, r: "release" } 34 | 35 | -------------------------------------------------------------------------------- /inst/templates/ghactions-meta-linux.yml: -------------------------------------------------------------------------------- 1 | ## tic GitHub Actions template: linux 2 | ## revision date: 2023-12-15 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | - master 9 | - cran-* 10 | pull_request: 11 | branches: 12 | - main 13 | - master 14 | # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) 15 | schedule: 16 | # * is a special character in YAML so you have to quote this string 17 | - cron: "0 4 * * *" 18 | 19 | name: tic 20 | 21 | jobs: 22 | all: 23 | runs-on: ${{ matrix.config.os }} 24 | 25 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 26 | 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | config: 31 | # use a different tic template type if you do not want to build on all listed platforms 32 | - { os: ubuntu-latest, r: "release", latex: "true" } 33 | 34 | -------------------------------------------------------------------------------- /inst/templates/ghactions-meta-macos-deploy.yml: -------------------------------------------------------------------------------- 1 | ## tic GitHub Actions template: macos-deploy 2 | ## revision date: 2023-12-15 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | - master 9 | - cran-* 10 | pull_request: 11 | branches: 12 | - main 13 | - master 14 | # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) 15 | schedule: 16 | # * is a special character in YAML so you have to quote this string 17 | - cron: "0 4 * * *" 18 | 19 | name: tic 20 | 21 | jobs: 22 | all: 23 | runs-on: ${{ matrix.config.os }} 24 | 25 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 26 | 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | config: 31 | # use a different tic template type if you do not want to build on all listed platforms 32 | - { os: macOS-latest, r: "release", pkgdown: "true", latex: "true" } 33 | - { os: ubuntu-latest, r: "devel" } 34 | 35 | -------------------------------------------------------------------------------- /inst/templates/ghactions-meta-macos-windows-deploy.yml: -------------------------------------------------------------------------------- 1 | ## tic GitHub Actions template: macos-windows-deploy 2 | ## revision date: 2023-12-15 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | - master 9 | - cran-* 10 | pull_request: 11 | branches: 12 | - main 13 | - master 14 | # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) 15 | schedule: 16 | # * is a special character in YAML so you have to quote this string 17 | - cron: "0 4 * * *" 18 | 19 | name: tic 20 | 21 | jobs: 22 | all: 23 | runs-on: ${{ matrix.config.os }} 24 | 25 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 26 | 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | config: 31 | # use a different tic template type if you do not want to build on all listed platforms 32 | - { os: ubuntu-latest, r: "devel" } 33 | - { os: macOS-latest, r: "release", pkgdown: "true", latex: "true" } 34 | - { os: windows-latest, r: "release" } 35 | 36 | -------------------------------------------------------------------------------- /inst/templates/ghactions-meta-macos-windows.yml: -------------------------------------------------------------------------------- 1 | ## tic GitHub Actions template: macos-windows 2 | ## revision date: 2023-12-15 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | - master 9 | - cran-* 10 | pull_request: 11 | branches: 12 | - main 13 | - master 14 | # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) 15 | schedule: 16 | # * is a special character in YAML so you have to quote this string 17 | - cron: "0 4 * * *" 18 | 19 | name: tic 20 | 21 | jobs: 22 | all: 23 | runs-on: ${{ matrix.config.os }} 24 | 25 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 26 | 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | config: 31 | # use a different tic template type if you do not want to build on all listed platforms 32 | - { os: ubuntu-latest, r: "devel" } 33 | - { os: macOS-latest, r: "release", latex: "true" } 34 | - { os: windows-latest, r: "release" } 35 | 36 | -------------------------------------------------------------------------------- /inst/templates/ghactions-meta-macos.yml: -------------------------------------------------------------------------------- 1 | ## tic GitHub Actions template: macos 2 | ## revision date: 2023-12-15 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | - master 9 | - cran-* 10 | pull_request: 11 | branches: 12 | - main 13 | - master 14 | # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) 15 | schedule: 16 | # * is a special character in YAML so you have to quote this string 17 | - cron: "0 4 * * *" 18 | 19 | name: tic 20 | 21 | jobs: 22 | all: 23 | runs-on: ${{ matrix.config.os }} 24 | 25 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 26 | 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | config: 31 | # use a different tic template type if you do not want to build on all listed platforms 32 | - { os: macOS-latest, r: "release", latex: "true" } 33 | 34 | -------------------------------------------------------------------------------- /inst/templates/ghactions-meta-windows-deploy.yml: -------------------------------------------------------------------------------- 1 | ## tic GitHub Actions template: windows-deploy 2 | ## revision date: 2023-12-15 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | - master 9 | - cran-* 10 | pull_request: 11 | branches: 12 | - main 13 | - master 14 | # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) 15 | schedule: 16 | # * is a special character in YAML so you have to quote this string 17 | - cron: "0 4 * * *" 18 | 19 | name: tic 20 | 21 | jobs: 22 | all: 23 | runs-on: ${{ matrix.config.os }} 24 | 25 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 26 | 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | config: 31 | # use a different tic template type if you do not want to build on all listed platforms 32 | - { os: windows-latest, r: "release", pkgdown: "true" } 33 | 34 | -------------------------------------------------------------------------------- /inst/templates/ghactions-meta-windows.yml: -------------------------------------------------------------------------------- 1 | ## tic GitHub Actions template: windows 2 | ## revision date: 2023-12-15 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | - master 9 | - cran-* 10 | pull_request: 11 | branches: 12 | - main 13 | - master 14 | # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) 15 | schedule: 16 | # * is a special character in YAML so you have to quote this string 17 | - cron: "0 4 * * *" 18 | 19 | name: tic 20 | 21 | jobs: 22 | all: 23 | runs-on: ${{ matrix.config.os }} 24 | 25 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 26 | 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | config: 31 | # use a different tic template type if you do not want to build on all listed platforms 32 | - { os: windows-latest, r: "release" } 33 | 34 | -------------------------------------------------------------------------------- /inst/templates/ghactions-meta.yml: -------------------------------------------------------------------------------- 1 | ## tic GitHub Actions template: linux-macos-windows-deploy 2 | ## revision date: 2023-12-15 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: 7 | - main 8 | - master 9 | - cran-* 10 | pull_request: 11 | branches: 12 | - main 13 | - master 14 | # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) 15 | schedule: 16 | # * is a special character in YAML so you have to quote this string 17 | - cron: "0 4 * * *" 18 | 19 | name: tic 20 | 21 | jobs: 22 | all: 23 | runs-on: ${{ matrix.config.os }} 24 | 25 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 26 | 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | config: 31 | # use a different tic template type if you do not want to build on all listed platforms 32 | - { os: windows-latest, r: "release" } 33 | - { os: macOS-latest, r: "release", pkgdown: "true", latex: "true" } 34 | - { os: ubuntu-latest, r: "devel" } 35 | - { os: ubuntu-latest, r: "release" } 36 | 37 | -------------------------------------------------------------------------------- /inst/templates/package/all-tic.R: -------------------------------------------------------------------------------- 1 | # installs dependencies, runs R CMD check, runs covr::codecov() 2 | do_package_checks() 3 | 4 | # creates pkgdown site and pushes to gh-pages branch 5 | # only for runners with the "BUILD_PKGDOWN" env var set 6 | if (ci_has_env("BUILD_PKGDOWN")) { 7 | do_pkgdown() 8 | } 9 | -------------------------------------------------------------------------------- /inst/templates/package/circle-tic.R: -------------------------------------------------------------------------------- 1 | # installs dependencies, runs R CMD check, runs covr::codecov() 2 | do_package_checks() 3 | 4 | if (ci_on_circle() && ci_has_env("BUILD_PKGDOWN")) { 5 | # creates pkgdown site and pushes to gh-pages branch 6 | # only for the runner with the "BUILD_PKGDOWN" env var set 7 | do_pkgdown() 8 | } 9 | -------------------------------------------------------------------------------- /inst/templates/package/ghactions-tic.R: -------------------------------------------------------------------------------- 1 | # installs dependencies, runs R CMD check, runs covr::codecov() 2 | do_package_checks() 3 | 4 | if (ci_on_ghactions() && ci_has_env("BUILD_PKGDOWN")) { 5 | # creates pkgdown site and pushes to gh-pages branch 6 | # only for the runner with the "BUILD_PKGDOWN" env var set 7 | do_pkgdown() 8 | } 9 | -------------------------------------------------------------------------------- /inst/templates/package/none-tic.R: -------------------------------------------------------------------------------- 1 | # installs dependencies, runs R CMD check, runs covr::codecov() 2 | do_package_checks() 3 | -------------------------------------------------------------------------------- /inst/templates/package/travis-tic.R: -------------------------------------------------------------------------------- 1 | # installs dependencies, runs R CMD check, runs covr::codecov() 2 | do_package_checks() 3 | 4 | if (ci_on_ghactions() && ci_has_env("BUILD_PKGDOWN")) { 5 | # creates pkgdown site and pushes to gh-pages branch 6 | # only for the runner with the "BUILD_PKGDOWN" env var set 7 | do_pkgdown() 8 | } 9 | -------------------------------------------------------------------------------- /inst/templates/site/all-tic.R: -------------------------------------------------------------------------------- 1 | get_stage("install") %>% 2 | add_step(step_install_deps()) 3 | 4 | get_stage("deploy") %>% 5 | add_code_step(rmarkdown::render_site()) 6 | 7 | get_stage("before_deploy") %>% 8 | add_step(step_setup_ssh()) 9 | 10 | get_stage("deploy") %>% 11 | add_step(step_push_deploy(path = "_site", branch = "gh-pages")) 12 | -------------------------------------------------------------------------------- /inst/templates/site/circle-tic.R: -------------------------------------------------------------------------------- 1 | get_stage("install") %>% 2 | add_step(step_install_deps()) 3 | 4 | get_stage("deploy") %>% 5 | add_code_step(rmarkdown::render_site()) 6 | 7 | if (ci_on_circle()) { 8 | get_stage("before_deploy") %>% 9 | add_step(step_setup_ssh()) 10 | 11 | get_stage("deploy") %>% 12 | add_step(step_push_deploy(path = "_site", branch = "gh-pages")) 13 | } 14 | -------------------------------------------------------------------------------- /inst/templates/site/ghactions-tic.R: -------------------------------------------------------------------------------- 1 | get_stage("install") %>% 2 | add_step(step_install_deps()) 3 | 4 | get_stage("deploy") %>% 5 | add_code_step(rmarkdown::render_site()) 6 | 7 | if (ci_on_ghactions()) { 8 | get_stage("before_deploy") %>% 9 | add_step(step_setup_ssh()) 10 | 11 | get_stage("deploy") %>% 12 | add_step(step_push_deploy(path = "_site", branch = "gh-pages")) 13 | } 14 | -------------------------------------------------------------------------------- /inst/templates/site/none-tic.R: -------------------------------------------------------------------------------- 1 | get_stage("install") %>% 2 | add_step(step_install_deps()) 3 | 4 | get_stage("deploy") %>% 5 | add_code_step(rmarkdown::render_site()) 6 | -------------------------------------------------------------------------------- /inst/templates/site/travis-tic.R: -------------------------------------------------------------------------------- 1 | get_stage("install") %>% 2 | add_step(step_install_deps()) 3 | 4 | get_stage("deploy") %>% 5 | add_code_step(rmarkdown::render_site()) 6 | 7 | if (ci_on_ghactions()) { 8 | get_stage("before_deploy") %>% 9 | add_step(step_setup_ssh()) 10 | 11 | get_stage("deploy") %>% 12 | add_step(step_push_deploy(path = "_site", branch = "gh-pages")) 13 | } 14 | -------------------------------------------------------------------------------- /inst/templates/unknown/tic.R: -------------------------------------------------------------------------------- 1 | # TODO: Define steps using the tic DSL, see ?DSL 2 | # get_stage("") %>% 3 | # add_step(step_...(...)) 4 | -------------------------------------------------------------------------------- /inst/templates/update-tic.yml: -------------------------------------------------------------------------------- 1 | on: 2 | workflow_dispatch: 3 | schedule: 4 | # * is a special character in YAML so you have to quote this string 5 | - cron: "0 4 * * 0" # every week 6 | 7 | name: Update tic 8 | 9 | jobs: 10 | update-tic: 11 | runs-on: ${{ matrix.config.os }} 12 | 13 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 14 | 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | config: 19 | - { os: ubuntu-latest, r: "release" } 20 | 21 | env: 22 | # use GITHUB_TOKEN from GitHub to workaround rate limits in {remotes} 23 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 24 | 25 | steps: 26 | - uses: actions/checkout@v4 27 | with: 28 | persist-credentials: false 29 | 30 | - uses: r-lib/actions/setup-r@v2 31 | with: 32 | r-version: ${{ matrix.config.r }} 33 | Ncpus: 4 34 | 35 | - name: "[Stage] Dependencies" 36 | run: | 37 | Rscript -e "install.packages('pak', repos = 'https://r-lib.github.io/p/pak/stable')" 38 | Rscript -e "if (grepl('Ubuntu', Sys.info()[['version']])) {options(repos = c(CRAN = sprintf('https://packagemanager.rstudio.com/all/__linux__/%s/latest', system('lsb_release -cs', intern = TRUE))))}; pak::pkg_install('ropensci/tic', dependencies = TRUE)" 39 | 40 | - name: "[Stage] Update YAMLs" 41 | run: | 42 | Rscript -e "tic::update_yml()" 43 | 44 | - name: "[Stage] Create Pull Request" 45 | uses: peter-evans/create-pull-request@v4 46 | with: 47 | author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> 48 | token: ${{ secrets.TIC_UPDATE }} 49 | title: "Update tic templates [ci-skip]" 50 | commit-message: "update tic templates" 51 | body: "{tic} templates can be updated :rocket: :robot:" 52 | branch: update-tic 53 | -------------------------------------------------------------------------------- /man-roxygen/cname.R: -------------------------------------------------------------------------------- 1 | #' @param cname (`character(1)`\cr An optional URL for redirecting the created 2 | #' website A `CNAME` file containing the given URL will be added to the root 3 | #' of the directory specified in argument `path`. 4 | -------------------------------------------------------------------------------- /man-roxygen/private_key_name.R: -------------------------------------------------------------------------------- 1 | #' @param private_key_name `string`\cr 2 | #' Only needed when deploying from builds on GitHub Actions. 3 | #' If you have set a custom name for the private key during creation of the 4 | #' SSH key pair via tic::use_ghactions_deploy()] or [use_tic()], pass this 5 | #' name here. 6 | -------------------------------------------------------------------------------- /man-roxygen/remote.R: -------------------------------------------------------------------------------- 1 | #' @param remote `[string]`\cr 2 | #' The Github remote which should be used. Defaults to "origin". 3 | -------------------------------------------------------------------------------- /man-roxygen/repo.R: -------------------------------------------------------------------------------- 1 | #' @param repo `[string]`\cr 2 | #' The repository slug to use. Must follow the "`user/repo`" structure. 3 | -------------------------------------------------------------------------------- /man/Deprecated.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/macro-package-checks.R 3 | \name{Deprecated} 4 | \alias{Deprecated} 5 | \alias{add_package_checks} 6 | \title{Deprecated functions} 7 | \usage{ 8 | add_package_checks( 9 | ..., 10 | warnings_are_errors = NULL, 11 | notes_are_errors = NULL, 12 | args = c("--no-manual", "--as-cran"), 13 | build_args = "--force", 14 | error_on = "warning", 15 | repos = repo_default(), 16 | timeout = Inf 17 | ) 18 | } 19 | \arguments{ 20 | \item{...}{Ignored, used to enforce naming of arguments.} 21 | 22 | \item{warnings_are_errors, notes_are_errors}{\verb{[flag]}\cr 23 | Deprecated, use \code{error_on}.} 24 | 25 | \item{args}{\verb{[character]}\cr 26 | Passed to \code{rcmdcheck::rcmdcheck()}.\cr 27 | 28 | Default for local runs: \code{c("--no-manual", "--as-cran")}. 29 | 30 | Default for Windows: 31 | \code{c("--no-manual", "--as-cran", "--no-vignettes", "--no-build-vignettes", "--no-multiarch")}. 32 | 33 | On GitHub Actions option "--no-manual" is always used (appended to custom 34 | user input) because LaTeX is not available and installation is time 35 | consuming and error prone.\cr} 36 | 37 | \item{build_args}{\verb{[character]}\cr 38 | Passed to \code{rcmdcheck::rcmdcheck()}.\cr 39 | Default for local runs: \code{"--force"}.\cr 40 | Default for Windows: \code{c("--no-build-vignettes", "--force")}.\cr} 41 | 42 | \item{error_on}{\verb{[character]}\cr 43 | Whether to throw an error on R CMD check failures. Note that the check is 44 | always completed (unless a timeout happens), and the error is only thrown 45 | after completion. If "never", then no errors are thrown. If "error", then 46 | only ERROR failures generate errors. If "warning", then WARNING failures 47 | generate errors as well. If "note", then any check failure generated an 48 | error.} 49 | 50 | \item{repos}{\verb{[character]}\cr 51 | Passed to \code{rcmdcheck::rcmdcheck()}, default: 52 | \code{\link[=repo_default]{repo_default()}}.} 53 | 54 | \item{timeout}{\verb{[numeric]}\cr 55 | Passed to \code{rcmdcheck::rcmdcheck()}, default: 56 | \code{Inf}.} 57 | } 58 | \description{ 59 | \code{add_package_checks()} has been replaced by \code{\link[=do_package_checks]{do_package_checks()}}. 60 | } 61 | -------------------------------------------------------------------------------- /man/TicStep.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-base.R 3 | \name{TicStep} 4 | \alias{TicStep} 5 | \title{The base class for all steps} 6 | \description{ 7 | Override this class to create a new step. 8 | } 9 | \section{Methods}{ 10 | \subsection{Public methods}{ 11 | \itemize{ 12 | \item \href{#method-TicStep-new}{\code{TicStep$new()}} 13 | \item \href{#method-TicStep-run}{\code{TicStep$run()}} 14 | \item \href{#method-TicStep-prepare}{\code{TicStep$prepare()}} 15 | \item \href{#method-TicStep-check}{\code{TicStep$check()}} 16 | } 17 | } 18 | \if{html}{\out{
}} 19 | \if{html}{\out{}} 20 | \if{latex}{\out{\hypertarget{method-TicStep-new}{}}} 21 | \subsection{Method \code{new()}}{ 22 | Create a \code{TicStep} object. 23 | \subsection{Usage}{ 24 | \if{html}{\out{
}}\preformatted{TicStep$new()}\if{html}{\out{
}} 25 | } 26 | 27 | } 28 | \if{html}{\out{
}} 29 | \if{html}{\out{}} 30 | \if{latex}{\out{\hypertarget{method-TicStep-run}{}}} 31 | \subsection{Method \code{run()}}{ 32 | This method must be overridden, it is called when running the stage 33 | to which a step has been added. 34 | \subsection{Usage}{ 35 | \if{html}{\out{
}}\preformatted{TicStep$run()}\if{html}{\out{
}} 36 | } 37 | 38 | } 39 | \if{html}{\out{
}} 40 | \if{html}{\out{}} 41 | \if{latex}{\out{\hypertarget{method-TicStep-prepare}{}}} 42 | \subsection{Method \code{prepare()}}{ 43 | This is just a placeholder. 44 | This method is called when preparing the stage to 45 | which a step has been added. It auto-install all packages which are 46 | needed for a certain step. For example, \code{step_build_pkgdown()} requires 47 | the \emph{pkgdown} package. 48 | 49 | For \code{add_code_step()}, it autodetects any package calls in the form of 50 | \code{pkg::fun} and tries to install these packages from CRAN. If a steps 51 | \code{prepare_call} is not empty, the \verb{$prepare} method is skipped for this 52 | step. This can be useful if a package should be installed from 53 | non-standard repositories, e.g. from GitHub. 54 | \subsection{Usage}{ 55 | \if{html}{\out{
}}\preformatted{TicStep$prepare()}\if{html}{\out{
}} 56 | } 57 | 58 | } 59 | \if{html}{\out{
}} 60 | \if{html}{\out{}} 61 | \if{latex}{\out{\hypertarget{method-TicStep-check}{}}} 62 | \subsection{Method \code{check()}}{ 63 | This method determines if a step is prepared and run. 64 | Return \code{FALSE} if conditions for running this step are not met. 65 | \subsection{Usage}{ 66 | \if{html}{\out{
}}\preformatted{TicStep$check()}\if{html}{\out{
}} 67 | } 68 | 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /man/base64serialize.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/base64.R 3 | \name{base64serialize} 4 | \alias{base64serialize} 5 | \alias{base64unserialize} 6 | \title{Helpers for converting R objects to strings and back} 7 | \usage{ 8 | base64serialize(x, compression = "gzip") 9 | 10 | base64unserialize(x, compression = "gzip") 11 | } 12 | \arguments{ 13 | \item{x}{Object to serialize or deserialize} 14 | 15 | \item{compression}{Passed on as \code{type} argument to \code{\link[=memCompress]{memCompress()}} or 16 | \code{\link[=memDecompress]{memDecompress()}}.} 17 | } 18 | \description{ 19 | \code{base64serialize()} converts an R object into a string suitable for storing 20 | in an environment variable. Use this function for encoding entire R objects 21 | (such as OAuth tokens). 22 | 23 | \code{base64unserialize()} is the inverse operation to \code{base64serialize()}. 24 | Use this function in your \code{tic.R} to access the R object previously encoded 25 | by \code{base64serialize()}. 26 | } 27 | \examples{ 28 | serial <- base64serialize(1:10) 29 | base64unserialize(serial) 30 | } 31 | -------------------------------------------------------------------------------- /man/ci.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ci.R 3 | \name{ci} 4 | \alias{ci} 5 | \alias{ci_get_branch} 6 | \alias{ci_is_tag} 7 | \alias{ci_get_slug} 8 | \alias{ci_get_build_number} 9 | \alias{ci_get_build_url} 10 | \alias{ci_get_commit} 11 | \alias{ci_get_env} 12 | \alias{ci_is_env} 13 | \alias{ci_has_env} 14 | \alias{ci_can_push} 15 | \alias{ci_is_interactive} 16 | \alias{ci_cat_with_color} 17 | \alias{ci_on_circle} 18 | \alias{ci_on_ghactions} 19 | \title{The current CI environment} 20 | \usage{ 21 | ci_get_branch() 22 | 23 | ci_is_tag() 24 | 25 | ci_get_slug() 26 | 27 | ci_get_build_number() 28 | 29 | ci_get_build_url() 30 | 31 | ci_get_commit() 32 | 33 | ci_get_env(env) 34 | 35 | ci_is_env(env, value) 36 | 37 | ci_has_env(env) 38 | 39 | ci_can_push(private_key_name = "TIC_DEPLOY_KEY") 40 | 41 | ci_is_interactive() 42 | 43 | ci_cat_with_color(code) 44 | 45 | ci_on_circle() 46 | 47 | ci_on_ghactions() 48 | 49 | ci() 50 | } 51 | \arguments{ 52 | \item{env}{Name of the environment variable to check.} 53 | 54 | \item{value}{Value for the environment variable to compare against.} 55 | 56 | \item{private_key_name}{\code{string}\cr 57 | Only needed when deploying from builds on GitHub Actions. 58 | If you have set a custom name for the private key during creation of the 59 | SSH key pair via tic::use_ghactions_deploy()] or \code{\link[=use_tic]{use_tic()}}, pass this 60 | name here.} 61 | 62 | \item{code}{Code that should be colored.} 63 | } 64 | \description{ 65 | Functions that return environment settings that describe the CI 66 | environment. The value is retrieved only once and then cached. 67 | 68 | \code{ci_get_branch()}: Returns the current branch. Returns nothing if operating 69 | on a tag. 70 | 71 | \code{ci_is_tag()}: Returns the current tag name. Returns nothing if a branch is 72 | selected. 73 | 74 | \code{ci_get_slug()}: Returns the repo slug in the format \code{user/repo} or 75 | \code{org/repo} 76 | 77 | \code{ci_get_build_number()}: Returns the CI build number. 78 | 79 | \code{ci_get_build_url()}: Returns the URL of the current build. 80 | 81 | \code{ci_get_commit()}: Returns the SHA1 of the current commit. 82 | 83 | \code{ci_get_env()}: Return an environment or configuration variable. 84 | 85 | \code{ci_is_env()}: Checks if an environment or configuration variable is set to a 86 | particular value. 87 | 88 | \code{ci_has_env()}: Checks if an environment or configuration variable is set to 89 | any value. 90 | 91 | \code{ci_can_push()}: Checks if push deployment is possible. Always true 92 | for local environments, CI environments require an environment 93 | variable (by default \code{TIC_DEPLOY_KEY}). 94 | 95 | \code{ci_is_interactive()}: Returns whether the current build is run interactively 96 | or not. Global setup operations shouldn't be run on interactive CIs. 97 | 98 | \code{ci_cat_with_color()}: Colored output targeted to the CI log. 99 | The code argument can be an unevaluated call to a crayon function, the 100 | style will be applied even if it normally wouldn't be. 101 | 102 | \code{ci_on_circle()}: Are we running on Circle CI? 103 | 104 | \code{ci_on_ghactions()}: Are we running on GitHub Actions? 105 | 106 | \code{ci()}: Return the current CI environment 107 | } 108 | -------------------------------------------------------------------------------- /man/do_readme_rmd.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/macro-readme-rmd.R 3 | \name{do_readme_rmd} 4 | \alias{do_readme_rmd} 5 | \title{Render a R Markdown README and deploy to Github} 6 | \usage{ 7 | do_readme_rmd( 8 | checkout = TRUE, 9 | remote_url = NULL, 10 | commit_message = NULL, 11 | force = FALSE, 12 | private_key_name = "TIC_DEPLOY_KEY" 13 | ) 14 | } 15 | \arguments{ 16 | \item{checkout}{\verb{[flag]}\cr 17 | Check out the current contents of the repository? Defaults to \code{TRUE}, 18 | set to \code{FALSE} if the build process relies on existing contents or 19 | if you deploy to a different branch.} 20 | 21 | \item{remote_url}{\verb{[string]}\cr 22 | The URL of the remote Git repository to push to, defaults to the 23 | current GitHub repository.} 24 | 25 | \item{commit_message}{\verb{[string]}\cr 26 | Commit message to use, defaults to a useful message linking to the CI build 27 | and avoiding recursive CI runs.} 28 | 29 | \item{force}{\verb{[logical]}\cr 30 | Add \code{--force} flag to git commands?} 31 | 32 | \item{private_key_name}{\code{string}\cr 33 | Only needed when deploying from builds on GitHub Actions. 34 | If you have set a custom name for the private key during creation of the 35 | SSH key pair via tic::use_ghactions_deploy()] or \code{\link[=use_tic]{use_tic()}}, pass this 36 | name here.} 37 | } 38 | \description{ 39 | \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} 40 | 41 | \code{do_readme_rmd()} renders an R Markdown README and deploys 42 | the rendered README.md file to Github. It adds default steps to the 43 | \code{"before_deploy"} and \code{"deploy"} stages: 44 | 45 | \enumerate{ 46 | \item \code{\link[=step_setup_ssh]{step_setup_ssh()}} in the \code{"before_deploy"} to setup 47 | the upcoming deployment 48 | \item \code{\link[=step_setup_push_deploy]{step_setup_push_deploy()}} in the \code{"before_deploy"} stage 49 | \item \code{rmarkdown::render()} in the \code{"deploy"} stage 50 | \item \code{\link[=step_do_push_deploy]{step_do_push_deploy()}} in the \code{"deploy"} stage. 51 | } 52 | } 53 | \examples{ 54 | \dontrun{ 55 | dsl_init() 56 | 57 | do_readme_rmd() 58 | 59 | dsl_get() 60 | } 61 | } 62 | \seealso{ 63 | Other macros: 64 | \code{\link{do_blogdown}()}, 65 | \code{\link{do_bookdown}()}, 66 | \code{\link{do_drat}()}, 67 | \code{\link{do_package_checks}()}, 68 | \code{\link{do_pkgdown}()}, 69 | \code{\link{list_macros}()} 70 | } 71 | \concept{macros} 72 | -------------------------------------------------------------------------------- /man/dsl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/dsl.R 3 | \name{dsl} 4 | \alias{dsl} 5 | \alias{DSL} 6 | \alias{get_stage} 7 | \alias{add_step} 8 | \alias{add_code_step} 9 | \title{tic's domain-specific language} 10 | \usage{ 11 | get_stage(name) 12 | 13 | add_step(stage, step) 14 | 15 | add_code_step(stage, call = NULL, prepare_call = NULL) 16 | } 17 | \arguments{ 18 | \item{name}{\verb{[string]}\cr 19 | The name for the stage.} 20 | 21 | \item{stage}{\verb{[TicStage]}\cr 22 | A \code{TicStage} object as returned by \code{get_stage()}.} 23 | 24 | \item{step}{\verb{[function]}\cr 25 | An object of class \link{TicStep}, usually created by functions 26 | with the \code{step_} prefix like \code{\link[=step_hello_world]{step_hello_world()}}.} 27 | 28 | \item{call}{\verb{[call]}\cr 29 | An arbitrary R expression executed during the stage to which this step is 30 | added. 31 | The default is useful if you only pass \code{prepare_call}.} 32 | 33 | \item{prepare_call}{\verb{[call]}\cr 34 | An optional arbitrary R expression executed during preparation.} 35 | } 36 | \description{ 37 | Functions to define stages and their constituent steps. 38 | The \link{macro}s combine several steps and assign them to relevant 39 | stages. 40 | See \code{\link[=dsl_get]{dsl_get()}} for functions to access the storage for the stages 41 | and their steps. 42 | 43 | \code{get_stage()} returns a \code{TicStage} object for a stage given by name. 44 | This function can be called directly in the \code{tic.R} configuration file, 45 | which is processed by \code{\link[=dsl_load]{dsl_load()}}. 46 | 47 | \code{add_step()} adds a step to a stage, see \code{\link[=step_hello_world]{step_hello_world()}} 48 | and the links therein for available steps. 49 | 50 | \code{add_code_step()} is a shortcut for \code{add_step(step_run_code(...))}. 51 | } 52 | \examples{ 53 | dsl_init() 54 | 55 | get_stage("script") 56 | 57 | get_stage("script") \%>\% 58 | add_step(step_hello_world()) 59 | 60 | get_stage("script") 61 | 62 | get_stage("script") \%>\% 63 | add_code_step(print("Hi!")) 64 | 65 | get_stage("script") 66 | } 67 | -------------------------------------------------------------------------------- /man/dsl_get.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/dsl-storage.R 3 | \name{dsl_get} 4 | \alias{dsl_get} 5 | \alias{dsl_load} 6 | \alias{dsl_init} 7 | \title{Stages and steps} 8 | \usage{ 9 | dsl_get() 10 | 11 | dsl_load(path = "tic.R", force = FALSE, quiet = FALSE) 12 | 13 | dsl_init(quiet = FALSE) 14 | } 15 | \arguments{ 16 | \item{path}{\verb{[string]}\cr 17 | Path to the stage definition file, default: \code{"tic.R"}.} 18 | 19 | \item{force}{\verb{[flag]}\cr 20 | Set to \code{TRUE} to force loading from file even if a configuration exists. 21 | By default an existing configuration is not overwritten by \code{dsl_load()}.} 22 | 23 | \item{quiet}{\verb{[flag]}\cr 24 | Set to \code{TRUE} to turn off verbose output.} 25 | } 26 | \value{ 27 | A named list of opaque stage objects with a \code{"class"} attribute 28 | and a corresponding \code{\link[=print]{print()}} method for pretty output. 29 | Use the high-level \code{\link[=get_stage]{get_stage()}} and \code{\link[=add_step]{add_step()}} functions to configure, 30 | and the \link{stages} functions to run. 31 | } 32 | \description{ 33 | \pkg{tic} works in a declarative way, centered around the \code{tic.R} file 34 | created by \code{\link[=use_tic]{use_tic()}}. 35 | This file contains the \emph{definition} of the steps to be run in each stage: 36 | calls to \code{\link[=get_stage]{get_stage()}} and \code{\link[=add_step]{add_step()}}, or macros like 37 | \code{\link[=do_package_checks]{do_package_checks()}}. 38 | 39 | Normally, this file is never executed directly. 40 | Running these functions in an interactive session will \strong{not} carry out 41 | the respective actions. 42 | Instead, a description of the code that would have been run is printed 43 | to the console. 44 | Edit \code{tic.R} to configure your CI builds. 45 | See \code{vignette("build-lifecycle", package = "tic")} for more details. 46 | } 47 | \details{ 48 | Stages and steps defined using tic's \link{DSL} are stored in an 49 | internal object in the package. 50 | The stages are accessible through \code{dsl_get()}. 51 | When running the \link{stages}, by default a configuration defined 52 | in the \code{tic.R} file is loaded with \code{dsl_load()}. 53 | See \code{\link[=use_tic]{use_tic()}} for setting up a \code{tic.R} file. 54 | 55 | For interactive tests, an empty storage can be initialized 56 | with \code{dsl_init()}. 57 | This happens automatically the first time \code{dsl_get()} is called 58 | (directly or indirectly). 59 | } 60 | \examples{ 61 | \dontrun{ 62 | dsl_init() 63 | dsl_get() 64 | 65 | dsl_load(system.file("templates/package/tic.R", package = "tic")) 66 | dsl_load(system.file("templates/package/tic.R", package = "tic"), 67 | force = 68 | TRUE 69 | ) 70 | dsl_get() 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /man/figures/lifecycle-archived.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecyclearchivedarchived -------------------------------------------------------------------------------- /man/figures/lifecycle-defunct.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecycledefunctdefunct -------------------------------------------------------------------------------- /man/figures/lifecycle-deprecated.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecycledeprecateddeprecated -------------------------------------------------------------------------------- /man/figures/lifecycle-experimental.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecycleexperimentalexperimental -------------------------------------------------------------------------------- /man/figures/lifecycle-maturing.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecyclematuringmaturing -------------------------------------------------------------------------------- /man/figures/lifecycle-questioning.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecyclequestioningquestioning -------------------------------------------------------------------------------- /man/figures/lifecycle-retired.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecycleretiredretired -------------------------------------------------------------------------------- /man/figures/lifecycle-soft-deprecated.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecyclesoft-deprecatedsoft-deprecated -------------------------------------------------------------------------------- /man/figures/lifecycle-stable.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecyclestablestable -------------------------------------------------------------------------------- /man/figures/lifecycle-superseded.svg: -------------------------------------------------------------------------------- 1 | lifecyclelifecyclesupersededsuperseded -------------------------------------------------------------------------------- /man/gha_add_secret.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gh-actions.R 3 | \name{gha_add_secret} 4 | \alias{gha_add_secret} 5 | \title{Add a GitHub Actions secret to a repository} 6 | \usage{ 7 | gha_add_secret( 8 | secret, 9 | name, 10 | repo_slug = NULL, 11 | remote = "origin", 12 | visibility = "all", 13 | selected_repositories = NULL 14 | ) 15 | } 16 | \arguments{ 17 | \item{secret}{\verb{[character]}\cr 18 | The value which should be encrypted (e.g. a Personal Access Token).} 19 | 20 | \item{name}{\verb{[character]}\cr 21 | The name of the secret as which it will appear in the "Secrets" overview of 22 | the repository.} 23 | 24 | \item{repo_slug}{\verb{[character]}\cr 25 | Repository slug of the repository to which the secret should be added. 26 | Must follow the form \code{owner/repo}.} 27 | 28 | \item{remote}{\verb{[character]}\cr 29 | If \code{repo_slug = NULL}, the \code{repo_slug} is determined by the respective git 30 | remote.} 31 | 32 | \item{visibility}{\verb{[character]}\cr 33 | The level of visibility for the secret. One of \code{"all"}, \code{"private"}, or 34 | \code{"selected"}. 35 | See https://developer.github.com/v3/actions/secrets/#create-or-update-an-organization-secret 36 | for more information.} 37 | 38 | \item{selected_repositories}{\verb{[character]}\cr 39 | Vector of repository ids for which the secret is accessible. 40 | Only applies if \code{visibility = "selected"} was set.} 41 | } 42 | \description{ 43 | Encrypts the supplied value using \code{libsodium} and adds it as a 44 | secret to the given GitHub repository. Secrets can be be used in GitHub 45 | Action runs as environment variables. 46 | A common use case is to encrypt Personal Access Tokens (PAT) or API keys. 47 | 48 | This is the same as adding a secret manually in GitHub via 49 | \code{"Settings" -> "Secrets" -> "New repository secret"} 50 | } 51 | \examples{ 52 | \dontrun{ 53 | gha_add_secret("supersecret", name = "MY_SECRET", repo = "ropensci/tic") 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /man/github_helpers.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/helpers_github.R 3 | \name{github_helpers} 4 | \alias{github_helpers} 5 | \alias{auth_github} 6 | \alias{get_owner} 7 | \alias{get_user} 8 | \alias{get_repo} 9 | \alias{get_repo_slug} 10 | \title{Github API helpers} 11 | \usage{ 12 | auth_github() 13 | 14 | get_owner(remote = "origin") 15 | 16 | get_user() 17 | 18 | get_repo(remote = "origin") 19 | 20 | get_repo_slug(remote = "origin") 21 | } 22 | \arguments{ 23 | \item{remote}{\verb{[string]}\cr 24 | The Github remote which should be used. Defaults to "origin".} 25 | } 26 | \description{ 27 | \itemize{ 28 | \item \code{auth_github()}: Creates a \code{GITHUB_TOKEN} and asks to store it in your 29 | \code{.Renviron} file. 30 | } 31 | 32 | \itemize{ 33 | \item \code{get_owner()}: Returns the owner of a Github repo. 34 | } 35 | 36 | \itemize{ 37 | \item \code{get_repo()}: Returns the repo name of a Github repo for a given remote. 38 | } 39 | 40 | \itemize{ 41 | \item \code{get_repo_slug()}: Returns the repo slug of a Github repo 42 | (\verb{/}). 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /man/github_info.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/helpers_github.R 3 | \name{github_repo} 4 | \alias{github_repo} 5 | \alias{github_info} 6 | \alias{uses_github} 7 | \title{Github information} 8 | \usage{ 9 | github_repo( 10 | path = usethis::proj_get(), 11 | info = github_info(path, remote = remote), 12 | remote = "origin" 13 | ) 14 | 15 | github_info(path = usethis::proj_get(), remote = "origin") 16 | 17 | uses_github(path = usethis::proj_get()) 18 | } 19 | \arguments{ 20 | \item{path}{\verb{[string]}\cr 21 | The path to a GitHub-enabled Git repository (or a subdirectory thereof).} 22 | 23 | \item{info}{\verb{[list]}\cr 24 | GitHub information for the repository, by default obtained through 25 | \code{\link[=github_info]{github_info()}}.} 26 | 27 | \item{remote}{\verb{[string]}\cr 28 | The Github remote which should be used. Defaults to "origin".} 29 | } 30 | \description{ 31 | \code{github_repo()} returns the true repository name as string. 32 | 33 | Retrieves metadata about a Git repository from GitHub. 34 | 35 | \code{github_info()} returns a list as obtained from the GET "/repos/:repo" API. 36 | } 37 | \concept{GitHub functions} 38 | -------------------------------------------------------------------------------- /man/list_macros.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/macro.R 3 | \name{list_macros} 4 | \alias{list_macros} 5 | \title{List available macros} 6 | \usage{ 7 | list_macros() 8 | } 9 | \value{ 10 | \link{character} 11 | } 12 | \description{ 13 | Lists available macro functions of the \code{tic} package. 14 | } 15 | \seealso{ 16 | Other macros: 17 | \code{\link{do_blogdown}()}, 18 | \code{\link{do_bookdown}()}, 19 | \code{\link{do_drat}()}, 20 | \code{\link{do_package_checks}()}, 21 | \code{\link{do_pkgdown}()}, 22 | \code{\link{do_readme_rmd}()} 23 | } 24 | \concept{macros} 25 | -------------------------------------------------------------------------------- /man/macro.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/macro.R, R/macro-package-checks.R, 3 | % R/macro-pkgdown.R, R/macro-blogdown.R, R/macro-bookdown.R, R/macro-drat.R, 4 | % R/macro-readme-rmd.R 5 | \name{macro} 6 | \alias{macro} 7 | \title{Macros} 8 | \description{ 9 | The \link{DSL} offers a fine-grained interface to the individual stages 10 | of a CI run. 11 | Macros are tic's way of adding several related steps to the relevant 12 | stages. 13 | All macros use the \code{do_} prefix. 14 | 15 | The \code{\link[=do_package_checks]{do_package_checks()}} macro adds default checks for R packages, 16 | including installation of dependencies and running a test coverage 17 | analysis. 18 | 19 | The \code{\link[=do_pkgdown]{do_pkgdown()}} macro adds the necessary steps for building 20 | and deploying \pkg{pkgdown} documentation for a package. 21 | 22 | The \code{\link[=do_blogdown]{do_blogdown()}} macro adds the necessary steps for building 23 | and deploying a \pkg{blogdown} blog. 24 | 25 | The \code{\link[=do_bookdown]{do_bookdown()}} macro adds the necessary steps for building 26 | and deploying a \pkg{bookdown} book. 27 | 28 | The \code{\link[=do_drat]{do_drat()}} macro adds the necessary steps for building 29 | and deploying a drat repository to host R package sources. 30 | 31 | The \code{\link[=do_readme_rmd]{do_readme_rmd()}} macro renders an R Markdown README and deploys 32 | the rendered README.md file to Github. 33 | } 34 | -------------------------------------------------------------------------------- /man/prepare_all_stages.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/run.R 3 | \name{prepare_all_stages} 4 | \alias{prepare_all_stages} 5 | \title{Prepare all stages} 6 | \usage{ 7 | prepare_all_stages(stages = dsl_load()) 8 | } 9 | \arguments{ 10 | \item{stages}{\verb{[named list]} 11 | A named list of \code{TicStage} objects as returned by \code{\link[=dsl_load]{dsl_load()}}, 12 | by default loaded from \code{tic.R}.} 13 | } 14 | \description{ 15 | Run the \code{prepare()} method for all defined steps for which the 16 | \code{check()} method returns \code{TRUE}. 17 | } 18 | \seealso{ 19 | \link{TicStep} 20 | 21 | Other runners: 22 | \code{\link{run_all_stages}()}, 23 | \code{\link{run_stage}()} 24 | } 25 | \concept{runners} 26 | -------------------------------------------------------------------------------- /man/reexports.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/dsl.R 3 | \docType{import} 4 | \name{reexports} 5 | \alias{reexports} 6 | \alias{\%>\%} 7 | \title{Objects exported from other packages} 8 | \keyword{internal} 9 | \description{ 10 | These objects are imported from other packages. Follow the links 11 | below to see their documentation. 12 | 13 | \describe{ 14 | \item{magrittr}{\code{\link[magrittr:pipe]{\%>\%}}} 15 | }} 16 | 17 | -------------------------------------------------------------------------------- /man/repo.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/repo.R 3 | \name{repo} 4 | \alias{repo} 5 | \alias{repo_default} 6 | \alias{repo_cloud} 7 | \alias{repo_cran} 8 | \alias{repo_bioc} 9 | \title{Shortcuts for accessing CRAN-like repositories} 10 | \usage{ 11 | repo_default() 12 | 13 | repo_cloud() 14 | 15 | repo_cran() 16 | 17 | repo_bioc(base = repo_default()) 18 | } 19 | \arguments{ 20 | \item{base}{The base repo to use, defaults to \code{repo_default()}. 21 | Pass \code{NULL} to install only from Bioconductor repos.} 22 | } 23 | \description{ 24 | These functions can be used as convenient shortcuts 25 | for the \code{repos} argument to e.g. \code{\link[=do_package_checks]{do_package_checks()}} and 26 | \code{\link[=step_install_deps]{step_install_deps()}}. 27 | 28 | \code{repo_default()} returns the value of the \code{"repos"} option, 29 | or \code{repo_cloud()} if the option is not set. 30 | 31 | \code{repo_cloud()} returns RStudio's CRAN mirror. 32 | 33 | \code{repo_cran()} returns the master CRAN repo. 34 | 35 | \code{repo_bioc()} returns Bioconductor repos from 36 | \code{\link[remotes:bioc_install_repos]{remotes::bioc_install_repos()}}, in addition to the default repo. 37 | } 38 | -------------------------------------------------------------------------------- /man/run_all_stages.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/run.R 3 | \name{run_all_stages} 4 | \alias{run_all_stages} 5 | \title{Emulate a CI run locally} 6 | \usage{ 7 | run_all_stages(stages = dsl_load()) 8 | } 9 | \arguments{ 10 | \item{stages}{\verb{[named list]} 11 | A named list of \code{TicStage} objects as returned by \code{\link[=dsl_load]{dsl_load()}}, 12 | by default loaded from \code{tic.R}.} 13 | } 14 | \description{ 15 | Runs predefined \link{stages} similarly to the chosen CI provider. 16 | The run aborts on error, the \code{after_failure} stage is never run. 17 | } 18 | \details{ 19 | The stages are run in the following order: 20 | \enumerate{ 21 | \item \code{before_install()} 22 | \item \code{install()} 23 | \item \code{after_install()} 24 | \item \code{before_script()} 25 | \item \code{script()} 26 | \item \code{after_success()} 27 | \item \code{before_deploy()} 28 | \item \code{deploy()} 29 | \item \code{after_deploy()} 30 | \item \code{after_script()} 31 | } 32 | } 33 | \seealso{ 34 | Other runners: 35 | \code{\link{prepare_all_stages}()}, 36 | \code{\link{run_stage}()} 37 | } 38 | \concept{runners} 39 | -------------------------------------------------------------------------------- /man/run_stage.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/run.R 3 | \name{run_stage} 4 | \alias{run_stage} 5 | \title{Run a stage} 6 | \usage{ 7 | run_stage(name, stages = dsl_load()) 8 | } 9 | \arguments{ 10 | \item{name}{\verb{[string]}\cr 11 | The name of the stage to run.} 12 | 13 | \item{stages}{\verb{[named list]} 14 | A named list of \code{TicStage} objects as returned by \code{\link[=dsl_load]{dsl_load()}}, 15 | by default loaded from \code{tic.R}.} 16 | } 17 | \description{ 18 | Run the \code{run_all()} method for all defined steps of a stage for which the 19 | \code{check()} method returns \code{TRUE}. 20 | } 21 | \seealso{ 22 | \link{TicStep} 23 | 24 | Other runners: 25 | \code{\link{prepare_all_stages}()}, 26 | \code{\link{run_all_stages}()} 27 | } 28 | \concept{runners} 29 | -------------------------------------------------------------------------------- /man/ssh_key_helpers.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/helpers_github.R 3 | \name{ssh_key_helpers} 4 | \alias{ssh_key_helpers} 5 | \alias{github_add_key} 6 | \alias{check_admin_repo} 7 | \alias{get_role_in_repo} 8 | \alias{get_public_key} 9 | \alias{encode_private_key} 10 | \alias{check_private_key_name} 11 | \title{SSH key helpers} 12 | \usage{ 13 | github_add_key( 14 | pubkey, 15 | repo = get_repo(remote), 16 | user = get_user(), 17 | title = "ghactions", 18 | remote = "origin", 19 | check_role = TRUE 20 | ) 21 | 22 | check_admin_repo(owner, user, repo) 23 | 24 | get_role_in_repo(owner, user, repo) 25 | 26 | get_public_key(key) 27 | 28 | encode_private_key(key) 29 | 30 | check_private_key_name(string) 31 | } 32 | \arguments{ 33 | \item{pubkey}{The public key of the SSH key pair} 34 | 35 | \item{repo}{\verb{[string]}\cr 36 | The repository slug to use. Must follow the "\code{user/repo}" structure.} 37 | 38 | \item{user}{The name of the user account} 39 | 40 | \item{title}{The title of the key to add} 41 | 42 | \item{remote}{\verb{[string]}\cr 43 | The Github remote which should be used. Defaults to "origin".} 44 | 45 | \item{check_role}{Whether to check if the current user has the permissions to 46 | add a key to the repo. Setting this to \code{FALSE} makes it possible to add keys 47 | to other repos than just the one from which the function is called.} 48 | 49 | \item{owner}{The owner of the repository} 50 | 51 | \item{key}{The SSH key pair object} 52 | 53 | \item{string}{String to check} 54 | } 55 | \description{ 56 | SSH key helpers 57 | } 58 | -------------------------------------------------------------------------------- /man/stages.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/run.R 3 | \name{stages} 4 | \alias{stages} 5 | \alias{before_install} 6 | \alias{install} 7 | \alias{after_install} 8 | \alias{before_script} 9 | \alias{script} 10 | \alias{after_success} 11 | \alias{after_failure} 12 | \alias{before_deploy} 13 | \alias{deploy} 14 | \alias{after_deploy} 15 | \alias{after_script} 16 | \title{Predefined stages} 17 | \usage{ 18 | before_install(stages = dsl_load()) 19 | 20 | install(stages = dsl_load()) 21 | 22 | after_install(stages = dsl_load()) 23 | 24 | before_script(stages = dsl_load()) 25 | 26 | script(stages = dsl_load()) 27 | 28 | after_success(stages = dsl_load()) 29 | 30 | after_failure(stages = dsl_load()) 31 | 32 | before_deploy(stages = dsl_load()) 33 | 34 | deploy(stages = dsl_load()) 35 | 36 | after_deploy(stages = dsl_load()) 37 | 38 | after_script(stages = dsl_load()) 39 | } 40 | \arguments{ 41 | \item{stages}{\verb{[named list]} 42 | A named list of \code{TicStage} objects as returned by \code{\link[=dsl_load]{dsl_load()}}, 43 | by default loaded from \code{tic.R}.} 44 | } 45 | \description{ 46 | Stages available in the CI provider, for which shortcuts 47 | have been defined. All these functions call \code{\link[=run_stage]{run_stage()}} with the 48 | corresponding stage name. 49 | } 50 | -------------------------------------------------------------------------------- /man/step_add_to_drat.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-drat.R 3 | \name{step_add_to_drat} 4 | \alias{step_add_to_drat} 5 | \title{Step: Add built package to a drat} 6 | \usage{ 7 | step_add_to_drat(repo_slug = NULL, deploy_dev = FALSE) 8 | } 9 | \arguments{ 10 | \item{repo_slug}{\verb{[string]}\cr 11 | The name of the drat repository to deploy to in the form \verb{:owner/:repo}.} 12 | 13 | \item{deploy_dev}{\verb{[logical]}\cr 14 | Should development versions of packages also be deployed to the drat repo? 15 | By default only "major", "minor" and "patch" releases are build and 16 | deployed.} 17 | } 18 | \description{ 19 | Builds a package (binary on OS X or Windows) and inserts it into an existing 20 | \pkg{drat} repository via \code{\link[drat:insertPackage]{drat::insertPackage()}}. 21 | } 22 | \examples{ 23 | dsl_init() 24 | 25 | get_stage("script") \%>\% 26 | add_step(step_add_to_drat()) 27 | 28 | dsl_get() 29 | } 30 | \seealso{ 31 | Other steps: 32 | \code{\link{step_add_to_known_hosts}()}, 33 | \code{\link{step_build_pkgdown}()}, 34 | \code{\link{step_do_push_deploy}()}, 35 | \code{\link{step_hello_world}()}, 36 | \code{\link{step_install_pkg}}, 37 | \code{\link{step_install_ssh_keys}()}, 38 | \code{\link{step_push_deploy}()}, 39 | \code{\link{step_run_code}()}, 40 | \code{\link{step_session_info}()}, 41 | \code{\link{step_setup_push_deploy}()}, 42 | \code{\link{step_setup_ssh}()}, 43 | \code{\link{step_test_ssh}()}, 44 | \code{\link{step_write_text_file}()} 45 | } 46 | \concept{steps} 47 | -------------------------------------------------------------------------------- /man/step_add_to_known_hosts.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-ssh.R 3 | \name{step_add_to_known_hosts} 4 | \alias{step_add_to_known_hosts} 5 | \title{Step: Add to known hosts} 6 | \usage{ 7 | step_add_to_known_hosts(host = "github.com") 8 | } 9 | \arguments{ 10 | \item{host}{\verb{[string]}\cr 11 | The host name to add to the \code{known_hosts} file, default: \code{github.com}.} 12 | } 13 | \description{ 14 | Adds a host name to the \verb{~/.ssh/known_hosts} file to allow subsequent 15 | SSH access. 16 | Requires \code{ssh-keyscan} on the system \code{PATH}. 17 | } 18 | \examples{ 19 | dsl_init() 20 | 21 | get_stage("before_deploy") \%>\% 22 | add_step(step_add_to_known_hosts("gitlab.com")) 23 | 24 | dsl_get() 25 | } 26 | \seealso{ 27 | Other steps: 28 | \code{\link{step_add_to_drat}()}, 29 | \code{\link{step_build_pkgdown}()}, 30 | \code{\link{step_do_push_deploy}()}, 31 | \code{\link{step_hello_world}()}, 32 | \code{\link{step_install_pkg}}, 33 | \code{\link{step_install_ssh_keys}()}, 34 | \code{\link{step_push_deploy}()}, 35 | \code{\link{step_run_code}()}, 36 | \code{\link{step_session_info}()}, 37 | \code{\link{step_setup_push_deploy}()}, 38 | \code{\link{step_setup_ssh}()}, 39 | \code{\link{step_test_ssh}()}, 40 | \code{\link{step_write_text_file}()} 41 | } 42 | \concept{steps} 43 | -------------------------------------------------------------------------------- /man/step_build_blogdown.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-blogdown.R 3 | \name{step_build_blogdown} 4 | \alias{step_build_blogdown} 5 | \title{Step: Build a Blogdown Site} 6 | \usage{ 7 | step_build_blogdown(...) 8 | } 9 | \arguments{ 10 | \item{...}{ 11 | Arguments passed on to \code{\link[blogdown:build_site]{blogdown::build_site}} 12 | \describe{ 13 | \item{\code{local}}{Whether to build the website locally. This argument is passed to 14 | \code{\link[blogdown]{hugo_build}()}, and \code{local = TRUE} is mainly for serving 15 | the site locally via \code{\link[blogdown]{serve_site}()}.} 16 | \item{\code{run_hugo}}{Whether to run \code{hugo_build()} after R Markdown files are 17 | compiled.} 18 | \item{\code{build_rmd}}{Whether to (re)build R Markdown files. By default, they are 19 | not built. See \sQuote{Details} for how \code{build_rmd = TRUE} works. 20 | Alternatively, it can take a vector of file paths, which means these files 21 | are to be (re)built. Or you can provide a function that takes a vector of 22 | paths of all R Markdown files under the \file{content/} directory, and 23 | returns a vector of paths of files to be built, e.g., \code{build_rmd = 24 | blogdown::filter_timestamp}. A few aliases are currently provided for such 25 | functions: \code{build_rmd = 'newfile'} is equivalent to \code{build_rmd = 26 | blogdown::filter_newfile}, \code{build_rmd = 'timestamp'} is equivalent to 27 | \code{build_rmd = blogdown::filter_timestamp}, and \code{build_rmd = 28 | 'md5sum'} is equivalent to \code{build_rmd = blogdown::filter_md5sum}.} 29 | }} 30 | } 31 | \description{ 32 | Build a Blogdown site using \code{\link[blogdown:build_site]{blogdown::build_site()}}. 33 | } 34 | \examples{ 35 | dsl_init() 36 | 37 | get_stage("script") \%>\% 38 | add_step(step_build_blogdown(".")) 39 | 40 | dsl_get() 41 | } 42 | -------------------------------------------------------------------------------- /man/step_build_bookdown.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-bookdown.R 3 | \name{step_build_bookdown} 4 | \alias{step_build_bookdown} 5 | \title{Step: Build a bookdown book} 6 | \usage{ 7 | step_build_bookdown(...) 8 | } 9 | \arguments{ 10 | \item{...}{See \link[bookdown:render_book]{bookdown::render_book}.} 11 | } 12 | \description{ 13 | Build a bookdown book using \code{\link[bookdown:render_book]{bookdown::render_book()}}. 14 | } 15 | \examples{ 16 | dsl_init() 17 | 18 | get_stage("script") \%>\% 19 | add_step(step_build_bookdown(".")) 20 | 21 | dsl_get() 22 | } 23 | -------------------------------------------------------------------------------- /man/step_build_pkgdown.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-pkgdown.R 3 | \name{step_build_pkgdown} 4 | \alias{step_build_pkgdown} 5 | \title{Step: Build pkgdown documentation} 6 | \usage{ 7 | step_build_pkgdown(...) 8 | } 9 | \arguments{ 10 | \item{...}{ 11 | Arguments passed on to \code{\link[pkgdown:build_site]{pkgdown::build_site}} 12 | \describe{ 13 | \item{\code{pkg}}{Path to package.} 14 | \item{\code{examples}}{Run examples?} 15 | \item{\code{run_dont_run}}{Run examples that are surrounded in \\dontrun?} 16 | \item{\code{seed}}{Seed used to initialize random number generation in order to 17 | make article output reproducible. An integer scalar or \code{NULL} for no seed.} 18 | \item{\code{lazy}}{If \code{TRUE}, will only rebuild articles and reference pages 19 | if the source is newer than the destination.} 20 | \item{\code{override}}{An optional named list used to temporarily override 21 | values in \verb{_pkgdown.yml}} 22 | \item{\code{preview}}{If \code{TRUE}, or \code{is.na(preview) && interactive()}, will preview 23 | freshly generated section in browser.} 24 | \item{\code{devel}}{Use development or deployment process? 25 | 26 | If \code{TRUE}, uses lighter-weight process suitable for rapid 27 | iteration; it will run examples and vignettes in the current process, 28 | and will load code with \code{pkgload::load_all()}. 29 | 30 | If \code{FALSE}, will first install the package to a temporary library, 31 | and will run all examples and vignettes in a new process. 32 | 33 | \code{build_site()} defaults to \code{devel = FALSE} so that you get high fidelity 34 | outputs when you building the complete site; \code{build_reference()}, 35 | \code{build_home()} and friends default to \code{devel = TRUE} so that you can 36 | rapidly iterate during development.} 37 | \item{\code{new_process}}{If \code{TRUE}, will run \code{build_site()} in a separate process. 38 | This enhances reproducibility by ensuring nothing that you have loaded 39 | in the current process affects the build process.} 40 | \item{\code{install}}{If \code{TRUE}, will install the package in a temporary library 41 | so it is available for vignettes.} 42 | }} 43 | } 44 | \description{ 45 | Builds package documentation with the \pkg{pkgdown} package. 46 | Calls \code{pkgdown::clean_site()} and then \code{pkgdown::build_site(...)}. 47 | } 48 | \examples{ 49 | dsl_init() 50 | 51 | get_stage("script") \%>\% 52 | add_step(step_build_pkgdown()) 53 | 54 | dsl_get() 55 | } 56 | \seealso{ 57 | Other steps: 58 | \code{\link{step_add_to_drat}()}, 59 | \code{\link{step_add_to_known_hosts}()}, 60 | \code{\link{step_do_push_deploy}()}, 61 | \code{\link{step_hello_world}()}, 62 | \code{\link{step_install_pkg}}, 63 | \code{\link{step_install_ssh_keys}()}, 64 | \code{\link{step_push_deploy}()}, 65 | \code{\link{step_run_code}()}, 66 | \code{\link{step_session_info}()}, 67 | \code{\link{step_setup_push_deploy}()}, 68 | \code{\link{step_setup_ssh}()}, 69 | \code{\link{step_test_ssh}()}, 70 | \code{\link{step_write_text_file}()} 71 | } 72 | \concept{steps} 73 | -------------------------------------------------------------------------------- /man/step_do_push_deploy.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-git.R 3 | \name{step_do_push_deploy} 4 | \alias{step_do_push_deploy} 5 | \title{Step: Perform push deploy} 6 | \usage{ 7 | step_do_push_deploy( 8 | path = ".", 9 | commit_message = NULL, 10 | commit_paths = ".", 11 | force = FALSE 12 | ) 13 | } 14 | \arguments{ 15 | \item{path}{\verb{[string]}\cr 16 | Path to the repository, default \code{"."} which means setting up the current 17 | repository.} 18 | 19 | \item{commit_message}{\verb{[string]}\cr 20 | Commit message to use, defaults to a useful message linking to the CI build 21 | and avoiding recursive CI runs.} 22 | 23 | \item{commit_paths}{\verb{[character]}\cr 24 | Restrict the set of directories and/or files added to Git before deploying. 25 | Default: deploy all files.} 26 | 27 | \item{force}{\verb{[logical]}\cr 28 | Add \code{--force} flag to git commands?} 29 | } 30 | \description{ 31 | Commits and pushes to a repo prepared by \code{\link[=step_setup_push_deploy]{step_setup_push_deploy()}}. 32 | 33 | Deployment usually requires setting up SSH keys with 34 | \code{\link[=use_tic]{use_tic()}}. 35 | } 36 | \details{ 37 | It is highly recommended to restrict the set of files 38 | touched by the deployment with the \code{commit_paths} argument: 39 | this step assumes that it can freely overwrite all changes to all files 40 | below \code{commit_paths}, and will not warn in case of conflicts. 41 | 42 | To mitigate conflicts race conditions to the greatest extent possible, 43 | the following strategy is used: 44 | \itemize{ 45 | \item The changes are committed to the branch 46 | \item Before pushing, new commits are fetched, and the changes are cherry-picked 47 | on top of the new commits 48 | } 49 | 50 | If no new commits were pushed after the CI run has started, 51 | this strategy is equivalent to committing and pushing. 52 | In the opposite case, if the remote repo has new commits, 53 | the deployment is safely applied to the current tip. 54 | } 55 | \examples{ 56 | \dontrun{ 57 | dsl_init() 58 | 59 | # Deployment only works if a companion step_setup_push_deploy() is added 60 | get_stage("deploy") \%>\% 61 | add_step(step_setup_push_deploy(path = "docs", branch = "gh-pages")) \%>\% 62 | add_step(step_build_pkgdown()) 63 | 64 | if (rlang::is_installed("git2r") && git2r::in_repository()) { 65 | get_stage("deploy") \%>\% 66 | add_step(step_do_push_deploy(path = "docs")) 67 | } 68 | 69 | dsl_get() 70 | } 71 | } 72 | \seealso{ 73 | Other deploy steps: 74 | \code{\link{step_push_deploy}()}, 75 | \code{\link{step_setup_push_deploy}()} 76 | 77 | Other steps: 78 | \code{\link{step_add_to_drat}()}, 79 | \code{\link{step_add_to_known_hosts}()}, 80 | \code{\link{step_build_pkgdown}()}, 81 | \code{\link{step_hello_world}()}, 82 | \code{\link{step_install_pkg}}, 83 | \code{\link{step_install_ssh_keys}()}, 84 | \code{\link{step_push_deploy}()}, 85 | \code{\link{step_run_code}()}, 86 | \code{\link{step_session_info}()}, 87 | \code{\link{step_setup_push_deploy}()}, 88 | \code{\link{step_setup_ssh}()}, 89 | \code{\link{step_test_ssh}()}, 90 | \code{\link{step_write_text_file}()} 91 | } 92 | \concept{deploy steps} 93 | \concept{steps} 94 | -------------------------------------------------------------------------------- /man/step_hello_world.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-base.R 3 | \name{step_hello_world} 4 | \alias{step_hello_world} 5 | \title{Step: Hello, world!} 6 | \usage{ 7 | step_hello_world() 8 | } 9 | \description{ 10 | The simplest step possible: prints "Hello, world!" to the console when run, 11 | does not require any preparation. This step may be useful to test a \pkg{tic} 12 | setup or as a starting point when implementing a custom step. 13 | } 14 | \examples{ 15 | dsl_init() 16 | 17 | get_stage("script") \%>\% 18 | add_step(step_hello_world()) 19 | 20 | dsl_get() 21 | } 22 | \seealso{ 23 | Other steps: 24 | \code{\link{step_add_to_drat}()}, 25 | \code{\link{step_add_to_known_hosts}()}, 26 | \code{\link{step_build_pkgdown}()}, 27 | \code{\link{step_do_push_deploy}()}, 28 | \code{\link{step_install_pkg}}, 29 | \code{\link{step_install_ssh_keys}()}, 30 | \code{\link{step_push_deploy}()}, 31 | \code{\link{step_run_code}()}, 32 | \code{\link{step_session_info}()}, 33 | \code{\link{step_setup_push_deploy}()}, 34 | \code{\link{step_setup_ssh}()}, 35 | \code{\link{step_test_ssh}()}, 36 | \code{\link{step_write_text_file}()} 37 | } 38 | \concept{steps} 39 | -------------------------------------------------------------------------------- /man/step_install_pkg.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-install.R 3 | \name{step_install_pkg} 4 | \alias{step_install_pkg} 5 | \alias{step_install_deps} 6 | \alias{step_install_cran} 7 | \alias{step_install_github} 8 | \title{Step: Install packages} 9 | \usage{ 10 | step_install_deps(dependencies = TRUE) 11 | 12 | step_install_cran(package = NULL, ...) 13 | 14 | step_install_github(repo = NULL, ...) 15 | } 16 | \arguments{ 17 | \item{dependencies}{What kinds of dependencies to install. Most commonly 18 | one of the following values: 19 | \itemize{ 20 | \item \code{NA}: only required (hard) dependencies, 21 | \item \code{TRUE}: required dependencies plus optional and development 22 | dependencies, 23 | \item \code{FALSE}: do not install any dependencies. (You might end up with a 24 | non-working package, and/or the installation might fail.) 25 | See \link[pak]{Package dependency types} for other possible values and more 26 | information about package dependencies. 27 | }} 28 | 29 | \item{package}{Package(s) to install} 30 | 31 | \item{...}{Passed on to \code{pak::pkg_install()}.} 32 | 33 | \item{repo}{Package to install in the "user/repo" format.} 34 | } 35 | \description{ 36 | These steps are useful if your CI run needs additional packages. 37 | Usually they are declared as dependencies in your \code{DESCRIPTION}, 38 | but it is also possible to install dependencies manually. 39 | By default, binary versions of packages are installed if possible, 40 | even if the CRAN version is ahead. 41 | 42 | A \code{step_install_deps()} step installs all package dependencies declared in 43 | \code{DESCRIPTION}, using \code{\link[pak:local_install_dev_deps]{pak::local_install_dev_deps()}}. 44 | This includes upgrading outdated packages. 45 | 46 | This step can only be used if a DESCRIPTION file is present in the repository 47 | root. 48 | 49 | A \code{step_install_cran()} step installs one package from CRAN via 50 | \code{\link[=install.packages]{install.packages()}}, but only if it's not already installed. 51 | 52 | A \code{step_install_github()} step installs one or more packages from GitHub 53 | via \code{\link[pak:pkg_install]{pak::pkg_install()}}, the packages are only installed if their 54 | GitHub version is different from the locally installed version. 55 | } 56 | \examples{ 57 | dsl_init() 58 | 59 | get_stage("install") \%>\% 60 | add_step(step_install_deps()) 61 | 62 | dsl_get() 63 | dsl_init() 64 | 65 | get_stage("install") \%>\% 66 | add_step(step_install_cran("magick")) 67 | 68 | dsl_get() 69 | dsl_init() 70 | 71 | get_stage("install") \%>\% 72 | add_step(step_install_github("rstudio/gt")) 73 | 74 | dsl_get() 75 | } 76 | \seealso{ 77 | Other steps: 78 | \code{\link{step_add_to_drat}()}, 79 | \code{\link{step_add_to_known_hosts}()}, 80 | \code{\link{step_build_pkgdown}()}, 81 | \code{\link{step_do_push_deploy}()}, 82 | \code{\link{step_hello_world}()}, 83 | \code{\link{step_install_ssh_keys}()}, 84 | \code{\link{step_push_deploy}()}, 85 | \code{\link{step_run_code}()}, 86 | \code{\link{step_session_info}()}, 87 | \code{\link{step_setup_push_deploy}()}, 88 | \code{\link{step_setup_ssh}()}, 89 | \code{\link{step_test_ssh}()}, 90 | \code{\link{step_write_text_file}()} 91 | } 92 | \concept{steps} 93 | -------------------------------------------------------------------------------- /man/step_install_ssh_keys.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-ssh.R 3 | \name{step_install_ssh_keys} 4 | \alias{step_install_ssh_keys} 5 | \title{Step: Install an SSH key} 6 | \usage{ 7 | step_install_ssh_keys(private_key_name = "TIC_DEPLOY_KEY") 8 | } 9 | \arguments{ 10 | \item{private_key_name}{\code{string}\cr 11 | Only needed when deploying from builds on GitHub Actions. 12 | If you have set a custom name for the private key during creation of the 13 | SSH key pair via tic::use_ghactions_deploy()] or \code{\link[=use_tic]{use_tic()}}, pass this 14 | name here.} 15 | } 16 | \description{ 17 | Writes a private SSH key encoded in an environment variable 18 | to a file in \verb{~/.ssh}. 19 | Only run in non-interactive settings and if the environment variable 20 | exists and is non-empty. 21 | \code{\link[=use_ghactions_deploy]{use_ghactions_deploy()}} and \code{\link[=use_tic]{use_tic()}} functions encode a private key as an 22 | environment variable for use with this function. 23 | } 24 | \examples{ 25 | dsl_init() 26 | 27 | get_stage("before_deploy") \%>\% 28 | add_step(step_install_ssh_keys()) 29 | 30 | dsl_get() 31 | } 32 | \seealso{ 33 | \code{\link[=use_tic]{use_tic()}}, \code{\link[=use_ghactions_deploy]{use_ghactions_deploy()}} 34 | 35 | Other steps: 36 | \code{\link{step_add_to_drat}()}, 37 | \code{\link{step_add_to_known_hosts}()}, 38 | \code{\link{step_build_pkgdown}()}, 39 | \code{\link{step_do_push_deploy}()}, 40 | \code{\link{step_hello_world}()}, 41 | \code{\link{step_install_pkg}}, 42 | \code{\link{step_push_deploy}()}, 43 | \code{\link{step_run_code}()}, 44 | \code{\link{step_session_info}()}, 45 | \code{\link{step_setup_push_deploy}()}, 46 | \code{\link{step_setup_ssh}()}, 47 | \code{\link{step_test_ssh}()}, 48 | \code{\link{step_write_text_file}()} 49 | } 50 | \concept{steps} 51 | -------------------------------------------------------------------------------- /man/step_push_deploy.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-git.R 3 | \name{step_push_deploy} 4 | \alias{step_push_deploy} 5 | \title{Step: Setup and perform push deploy} 6 | \usage{ 7 | step_push_deploy( 8 | path = ".", 9 | branch = NULL, 10 | remote_url = NULL, 11 | commit_message = NULL, 12 | commit_paths = ".", 13 | force = FALSE 14 | ) 15 | } 16 | \arguments{ 17 | \item{path}{\verb{[string]}\cr 18 | Path to the repository, default \code{"."} which means setting up the current 19 | repository.} 20 | 21 | \item{branch}{\verb{[string]}\cr 22 | Target branch, default: current branch.} 23 | 24 | \item{remote_url}{\verb{[string]}\cr 25 | The URL of the remote Git repository to push to, defaults to the 26 | current GitHub repository.} 27 | 28 | \item{commit_message}{\verb{[string]}\cr 29 | Commit message to use, defaults to a useful message linking to the CI build 30 | and avoiding recursive CI runs.} 31 | 32 | \item{commit_paths}{\verb{[character]}\cr 33 | Restrict the set of directories and/or files added to Git before deploying. 34 | Default: deploy all files.} 35 | 36 | \item{force}{\verb{[logical]}\cr 37 | Add \code{--force} flag to git commands?} 38 | } 39 | \description{ 40 | Clones a repo, initializes author information, sets up remotes, 41 | commits, and pushes. 42 | Combines \code{\link[=step_setup_push_deploy]{step_setup_push_deploy()}} with \code{checkout = FALSE} and 43 | a suitable \code{orphan} argument, 44 | and \code{\link[=step_do_push_deploy]{step_do_push_deploy()}}. 45 | 46 | Deployment usually requires setting up SSH keys with 47 | \code{\link[=use_tic]{use_tic()}}. 48 | } 49 | \details{ 50 | Setup and deployment are combined in one step, 51 | the files to be deployed must be prepared in a previous step. 52 | This poses some restrictions on how the repository can be initialized, 53 | in particular for a nonstandard \code{path} argument only \code{orphan = TRUE} 54 | can be supported (and will be used). 55 | 56 | For more control, create two separate steps with 57 | \code{step_setup_push_deploy()} and \code{step_do_push_deploy()}, 58 | and create the files to be deployed in between these steps. 59 | } 60 | \examples{ 61 | \dontrun{ 62 | dsl_init() 63 | 64 | get_stage("script") \%>\% 65 | add_step(step_push_deploy(commit_paths = c("NAMESPACE", "man"))) 66 | 67 | dsl_get() 68 | } 69 | } 70 | \seealso{ 71 | Other deploy steps: 72 | \code{\link{step_do_push_deploy}()}, 73 | \code{\link{step_setup_push_deploy}()} 74 | 75 | Other steps: 76 | \code{\link{step_add_to_drat}()}, 77 | \code{\link{step_add_to_known_hosts}()}, 78 | \code{\link{step_build_pkgdown}()}, 79 | \code{\link{step_do_push_deploy}()}, 80 | \code{\link{step_hello_world}()}, 81 | \code{\link{step_install_pkg}}, 82 | \code{\link{step_install_ssh_keys}()}, 83 | \code{\link{step_run_code}()}, 84 | \code{\link{step_session_info}()}, 85 | \code{\link{step_setup_push_deploy}()}, 86 | \code{\link{step_setup_ssh}()}, 87 | \code{\link{step_test_ssh}()}, 88 | \code{\link{step_write_text_file}()} 89 | } 90 | \concept{deploy steps} 91 | \concept{steps} 92 | -------------------------------------------------------------------------------- /man/step_rcmdcheck.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-rcmdcheck.R 3 | \name{step_rcmdcheck} 4 | \alias{step_rcmdcheck} 5 | \title{Step: Check a package} 6 | \usage{ 7 | step_rcmdcheck( 8 | ..., 9 | warnings_are_errors = NULL, 10 | notes_are_errors = NULL, 11 | args = NULL, 12 | build_args = NULL, 13 | error_on = "warning", 14 | repos = repo_default(), 15 | timeout = Inf, 16 | check_dir = "check" 17 | ) 18 | } 19 | \arguments{ 20 | \item{...}{Ignored, used to enforce naming of arguments.} 21 | 22 | \item{warnings_are_errors, notes_are_errors}{\verb{[flag]}\cr 23 | Deprecated, use \code{error_on}.} 24 | 25 | \item{args}{\verb{[character]}\cr 26 | Passed to \code{rcmdcheck::rcmdcheck()}.\cr 27 | 28 | Default for local runs: \code{c("--no-manual", "--as-cran")}. 29 | 30 | Default for Windows: 31 | \code{c("--no-manual", "--as-cran", "--no-vignettes", "--no-build-vignettes", "--no-multiarch")}. 32 | 33 | On GitHub Actions option "--no-manual" is always used (appended to custom 34 | user input) because LaTeX is not available and installation is time 35 | consuming and error prone.\cr} 36 | 37 | \item{build_args}{\verb{[character]}\cr 38 | Passed to \code{rcmdcheck::rcmdcheck()}.\cr 39 | Default for local runs: \code{"--force"}.\cr 40 | Default for Windows: \code{c("--no-build-vignettes", "--force")}.\cr} 41 | 42 | \item{error_on}{\verb{[character]}\cr 43 | Whether to throw an error on R CMD check failures. Note that the check is 44 | always completed (unless a timeout happens), and the error is only thrown 45 | after completion. If "never", then no errors are thrown. If "error", then 46 | only ERROR failures generate errors. If "warning", then WARNING failures 47 | generate errors as well. If "note", then any check failure generated an 48 | error.} 49 | 50 | \item{repos}{\verb{[character]}\cr 51 | Passed to \code{rcmdcheck::rcmdcheck()}, default: 52 | \code{\link[=repo_default]{repo_default()}}.} 53 | 54 | \item{timeout}{\verb{[numeric]}\cr 55 | Passed to \code{rcmdcheck::rcmdcheck()}, default: 56 | \code{Inf}.} 57 | 58 | \item{check_dir}{\verb{[character]} \cr Path specifying the directory for R CMD 59 | check. Defaults to \code{"check"} for easy upload of artifacts.} 60 | } 61 | \description{ 62 | Check a package using \code{\link[rcmdcheck:rcmdcheck]{rcmdcheck::rcmdcheck()}}, 63 | which ultimately calls \verb{R CMD check}. 64 | } 65 | \section{Updating of (dependency) packages}{ 66 | 67 | Packages shipped with the R-installation will not be updated as they will be 68 | overwritten by the R-installer in each build. 69 | If you want these package to be updated, please add the following 70 | step to your workflow: \code{add_code_step(remotes::update_packages(""))}. 71 | } 72 | 73 | \examples{ 74 | dsl_init() 75 | 76 | get_stage("script") \%>\% 77 | add_step(step_rcmdcheck(error_on = "note", repos = repo_bioc())) 78 | 79 | dsl_get() 80 | } 81 | -------------------------------------------------------------------------------- /man/step_run_code.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-code.R 3 | \name{step_run_code} 4 | \alias{step_run_code} 5 | \title{Step: Run arbitrary R code} 6 | \usage{ 7 | step_run_code(call = NULL, prepare_call = NULL) 8 | } 9 | \arguments{ 10 | \item{call}{\verb{[call]}\cr 11 | An arbitrary R expression executed during the stage to which this step is 12 | added. 13 | The default is useful if you only pass \code{prepare_call}.} 14 | 15 | \item{prepare_call}{\verb{[call]}\cr 16 | An optional arbitrary R expression executed during preparation.} 17 | } 18 | \description{ 19 | Captures the expression and executes it when running the step. 20 | An optional preparatory expression can be provided that is executed 21 | during preparation. 22 | If the top-level expression is a qualified function call (of the format 23 | \code{package::fun()}), the package is installed during preparation. 24 | } 25 | \examples{ 26 | dsl_init() 27 | 28 | get_stage("install") \%>\% 29 | add_step(step_run_code(update.packages(ask = FALSE))) 30 | 31 | # Will install covr from CRAN during preparation: 32 | get_stage("after_success") \%>\% 33 | add_code_step(covr::codecov()) 34 | 35 | dsl_get() 36 | } 37 | \seealso{ 38 | Other steps: 39 | \code{\link{step_add_to_drat}()}, 40 | \code{\link{step_add_to_known_hosts}()}, 41 | \code{\link{step_build_pkgdown}()}, 42 | \code{\link{step_do_push_deploy}()}, 43 | \code{\link{step_hello_world}()}, 44 | \code{\link{step_install_pkg}}, 45 | \code{\link{step_install_ssh_keys}()}, 46 | \code{\link{step_push_deploy}()}, 47 | \code{\link{step_session_info}()}, 48 | \code{\link{step_setup_push_deploy}()}, 49 | \code{\link{step_setup_ssh}()}, 50 | \code{\link{step_test_ssh}()}, 51 | \code{\link{step_write_text_file}()} 52 | } 53 | \concept{steps} 54 | -------------------------------------------------------------------------------- /man/step_session_info.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-session-info.R 3 | \name{step_session_info} 4 | \alias{step_session_info} 5 | \title{Step: Print the current Session Info} 6 | \usage{ 7 | step_session_info() 8 | } 9 | \description{ 10 | Prints out the package information of the current session via 11 | \code{\link[sessioninfo:session_info]{sessioninfo::session_info()}}. 12 | } 13 | \examples{ 14 | dsl_init() 15 | 16 | get_stage("install") \%>\% 17 | add_step(step_session_info()) 18 | 19 | dsl_get() 20 | } 21 | \seealso{ 22 | Other steps: 23 | \code{\link{step_add_to_drat}()}, 24 | \code{\link{step_add_to_known_hosts}()}, 25 | \code{\link{step_build_pkgdown}()}, 26 | \code{\link{step_do_push_deploy}()}, 27 | \code{\link{step_hello_world}()}, 28 | \code{\link{step_install_pkg}}, 29 | \code{\link{step_install_ssh_keys}()}, 30 | \code{\link{step_push_deploy}()}, 31 | \code{\link{step_run_code}()}, 32 | \code{\link{step_setup_push_deploy}()}, 33 | \code{\link{step_setup_ssh}()}, 34 | \code{\link{step_test_ssh}()}, 35 | \code{\link{step_write_text_file}()} 36 | } 37 | \concept{steps} 38 | -------------------------------------------------------------------------------- /man/step_setup_push_deploy.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-git.R 3 | \name{step_setup_push_deploy} 4 | \alias{step_setup_push_deploy} 5 | \title{Step: Setup push deploy} 6 | \usage{ 7 | step_setup_push_deploy( 8 | path = ".", 9 | branch = NULL, 10 | orphan = FALSE, 11 | remote_url = NULL, 12 | checkout = TRUE 13 | ) 14 | } 15 | \arguments{ 16 | \item{path}{\verb{[string]}\cr 17 | Path to the repository, default \code{"."} which means setting up the current 18 | repository.} 19 | 20 | \item{branch}{\verb{[string]}\cr 21 | Target branch, default: current branch.} 22 | 23 | \item{orphan}{\verb{[flag]}\cr 24 | Create and force-push an orphan branch consisting of only one commit? 25 | This can be useful e.g. for \verb{path = "docs", branch = "gh-pages"}, 26 | but cannot be applied for pushing to the current branch.} 27 | 28 | \item{remote_url}{\verb{[string]}\cr 29 | The URL of the remote Git repository to push to, defaults to the 30 | current GitHub repository.} 31 | 32 | \item{checkout}{\verb{[flag]}\cr 33 | Check out the current contents of the repository? Defaults to \code{TRUE}, 34 | set to \code{FALSE} if the build process relies on existing contents or 35 | if you deploy to a different branch.} 36 | } 37 | \description{ 38 | Clones a repo, inits author information, and sets up remotes 39 | for a subsequent \code{\link[=step_do_push_deploy]{step_do_push_deploy()}}. 40 | } 41 | \examples{ 42 | \dontrun{ 43 | dsl_init() 44 | 45 | get_stage("deploy") \%>\% 46 | add_step(step_setup_push_deploy(path = "docs", branch = "gh-pages")) \%>\% 47 | add_step(step_build_pkgdown()) 48 | 49 | # This example needs a Git repository 50 | if (rlang::is_installed("git2r") && git2r::in_repository()) { 51 | # Deployment only works if a companion step_do_push_deploy() is added 52 | get_stage("deploy") \%>\% 53 | add_step(step_do_push_deploy(path = "docs")) 54 | } 55 | 56 | dsl_get() 57 | } 58 | } 59 | \seealso{ 60 | Other deploy steps: 61 | \code{\link{step_do_push_deploy}()}, 62 | \code{\link{step_push_deploy}()} 63 | 64 | Other steps: 65 | \code{\link{step_add_to_drat}()}, 66 | \code{\link{step_add_to_known_hosts}()}, 67 | \code{\link{step_build_pkgdown}()}, 68 | \code{\link{step_do_push_deploy}()}, 69 | \code{\link{step_hello_world}()}, 70 | \code{\link{step_install_pkg}}, 71 | \code{\link{step_install_ssh_keys}()}, 72 | \code{\link{step_push_deploy}()}, 73 | \code{\link{step_run_code}()}, 74 | \code{\link{step_session_info}()}, 75 | \code{\link{step_setup_ssh}()}, 76 | \code{\link{step_test_ssh}()}, 77 | \code{\link{step_write_text_file}()} 78 | } 79 | \concept{deploy steps} 80 | \concept{steps} 81 | -------------------------------------------------------------------------------- /man/step_setup_ssh.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-ssh.R 3 | \name{step_setup_ssh} 4 | \alias{step_setup_ssh} 5 | \title{Step: Setup SSH} 6 | \usage{ 7 | step_setup_ssh( 8 | private_key_name = "TIC_DEPLOY_KEY", 9 | host = "github.com", 10 | url = paste0("git@", host), 11 | verbose = "" 12 | ) 13 | } 14 | \arguments{ 15 | \item{private_key_name}{\code{string}\cr 16 | Only needed when deploying from builds on GitHub Actions. 17 | If you have set a custom name for the private key during creation of the 18 | SSH key pair via tic::use_ghactions_deploy()] or \code{\link[=use_tic]{use_tic()}}, pass this 19 | name here.} 20 | 21 | \item{host}{\verb{[string]}\cr 22 | The host name to add to the \code{known_hosts} file, default: \code{github.com}.} 23 | 24 | \item{url}{\verb{[string]}\cr 25 | URL to establish SSH connection with, by default \code{git@github.com}} 26 | 27 | \item{verbose}{\verb{[string]}\cr 28 | Verbosity, by default \code{""}. Use \code{-v} or \code{"-vvv"} for more verbosity.} 29 | } 30 | \description{ 31 | Adds to known hosts, installs private key, and tests the connection. 32 | Chaining \code{\link[=step_install_ssh_keys]{step_install_ssh_keys()}}, \code{\link[=step_add_to_known_hosts]{step_add_to_known_hosts()}} 33 | and \code{\link[=step_test_ssh]{step_test_ssh()}}. 34 | \code{\link[=use_tic]{use_tic()}} encodes a private key as an environment variable for use with 35 | this function. 36 | } 37 | \examples{ 38 | dsl_init() 39 | 40 | get_stage("script") \%>\% 41 | add_step(step_setup_ssh(host = "gitlab.com")) 42 | 43 | dsl_get() 44 | } 45 | \seealso{ 46 | Other steps: 47 | \code{\link{step_add_to_drat}()}, 48 | \code{\link{step_add_to_known_hosts}()}, 49 | \code{\link{step_build_pkgdown}()}, 50 | \code{\link{step_do_push_deploy}()}, 51 | \code{\link{step_hello_world}()}, 52 | \code{\link{step_install_pkg}}, 53 | \code{\link{step_install_ssh_keys}()}, 54 | \code{\link{step_push_deploy}()}, 55 | \code{\link{step_run_code}()}, 56 | \code{\link{step_session_info}()}, 57 | \code{\link{step_setup_push_deploy}()}, 58 | \code{\link{step_test_ssh}()}, 59 | \code{\link{step_write_text_file}()} 60 | } 61 | \concept{steps} 62 | -------------------------------------------------------------------------------- /man/step_test_ssh.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-ssh.R 3 | \name{step_test_ssh} 4 | \alias{step_test_ssh} 5 | \title{Step: Test SSH connection} 6 | \usage{ 7 | step_test_ssh( 8 | url = "git@github.com", 9 | verbose = "", 10 | private_key_name = "TIC_DEPLOY_KEY" 11 | ) 12 | } 13 | \arguments{ 14 | \item{url}{\verb{[string]}\cr 15 | URL to establish SSH connection with, by default \code{git@github.com}} 16 | 17 | \item{verbose}{\verb{[string]}\cr 18 | Verbosity, by default \code{""}. Use \code{-v} or \code{"-vvv"} for more verbosity.} 19 | 20 | \item{private_key_name}{\code{string}\cr 21 | Only needed when deploying from builds on GitHub Actions. 22 | If you have set a custom name for the private key during creation of the 23 | SSH key pair via tic::use_ghactions_deploy()] or \code{\link[=use_tic]{use_tic()}}, pass this 24 | name here.} 25 | } 26 | \description{ 27 | Establishes an SSH connection. 28 | This step doesn't fail if the connection cannot be established, 29 | but prints verbose output by default. 30 | It is useful for troubleshooting deployment problems. 31 | } 32 | \examples{ 33 | dsl_init() 34 | 35 | get_stage("script") \%>\% 36 | add_step(step_test_ssh(verbose = "-vvv")) 37 | 38 | dsl_get() 39 | } 40 | \seealso{ 41 | Other steps: 42 | \code{\link{step_add_to_drat}()}, 43 | \code{\link{step_add_to_known_hosts}()}, 44 | \code{\link{step_build_pkgdown}()}, 45 | \code{\link{step_do_push_deploy}()}, 46 | \code{\link{step_hello_world}()}, 47 | \code{\link{step_install_pkg}}, 48 | \code{\link{step_install_ssh_keys}()}, 49 | \code{\link{step_push_deploy}()}, 50 | \code{\link{step_run_code}()}, 51 | \code{\link{step_session_info}()}, 52 | \code{\link{step_setup_push_deploy}()}, 53 | \code{\link{step_setup_ssh}()}, 54 | \code{\link{step_write_text_file}()} 55 | } 56 | \concept{steps} 57 | -------------------------------------------------------------------------------- /man/step_write_text_file.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/steps-write-text-file.R 3 | \name{step_write_text_file} 4 | \alias{step_write_text_file} 5 | \title{Step: Write a text file} 6 | \usage{ 7 | step_write_text_file(..., path) 8 | } 9 | \arguments{ 10 | \item{...}{\verb{[character]}\cr 11 | Contents of the text file.} 12 | 13 | \item{path}{\verb{[string]}\cr 14 | Path to the new text file.} 15 | } 16 | \description{ 17 | Creates a text file with arbitrary contents 18 | } 19 | \examples{ 20 | dsl_init() 21 | 22 | get_stage("script") \%>\% 23 | add_step(step_write_text_file("Hi!", path = "hello.txt")) 24 | 25 | dsl_get() 26 | } 27 | \seealso{ 28 | Other steps: 29 | \code{\link{step_add_to_drat}()}, 30 | \code{\link{step_add_to_known_hosts}()}, 31 | \code{\link{step_build_pkgdown}()}, 32 | \code{\link{step_do_push_deploy}()}, 33 | \code{\link{step_hello_world}()}, 34 | \code{\link{step_install_pkg}}, 35 | \code{\link{step_install_ssh_keys}()}, 36 | \code{\link{step_push_deploy}()}, 37 | \code{\link{step_run_code}()}, 38 | \code{\link{step_session_info}()}, 39 | \code{\link{step_setup_push_deploy}()}, 40 | \code{\link{step_setup_ssh}()}, 41 | \code{\link{step_test_ssh}()} 42 | } 43 | \concept{steps} 44 | -------------------------------------------------------------------------------- /man/tic-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tic-package.R 3 | \docType{package} 4 | \name{tic-package} 5 | \alias{tic} 6 | \alias{tic-package} 7 | \title{tic: Tasks Integrating Continuously: CI-Agnostic Workflow Definitions} 8 | \description{ 9 | Provides a way to describe common build and deployment workflows for R-based projects: packages, websites (e.g. blogdown, pkgdown), or data processing (e.g. research compendia). The recipe is described independent of the continuous integration tool used for processing the workflow (e.g. 'GitHub Actions' or 'Circle CI'). This package has been peer-reviewed by rOpenSci (v0.3.0.9004). 10 | } 11 | \details{ 12 | The \code{\link[=use_tic]{use_tic()}} function prepares a code repository for use with 13 | this package. 14 | See \link{DSL} for an overview of \pkg{tic}'s domain-specific 15 | language for defining stages and steps, 16 | \code{\link[=step_hello_world]{step_hello_world()}} and the links therein for available steps, 17 | and \link{macro} for an overview over the available macros that bundle 18 | several steps. 19 | } 20 | \seealso{ 21 | Useful links: 22 | \itemize{ 23 | \item \url{https://github.com/ropensci/tic} 24 | \item Report bugs at \url{https://github.com/ropensci/tic/issues} 25 | } 26 | 27 | } 28 | \author{ 29 | \strong{Maintainer}: Eli Miller \email{eli@eli.dev} (\href{https://orcid.org/0000-0002-2127-9456}{ORCID}) 30 | 31 | Authors: 32 | \itemize{ 33 | \item Patrick Schratz (\href{https://orcid.org/0000-0003-0748-6624}{ORCID}) 34 | \item Kirill Müller (\href{https://orcid.org/0000-0002-1416-3412}{ORCID}) 35 | \item Mika Braginsky \email{mika.br@gmail.com} 36 | \item Karthik Ram \email{karthik.ram@gmail.com} 37 | \item Jeroen Ooms \email{jeroenooms@gmail.com} 38 | } 39 | 40 | Other contributors: 41 | \itemize{ 42 | \item Max Held (Max reviewed the package for ropensci, see ) [reviewer] 43 | \item Anna Krystalli (Anna reviewed the package for ropensci, see ) [reviewer] 44 | \item Laura DeCicco (Laura reviewed the package for ropensci, see ) [reviewer] 45 | \item rOpenSci (019jywm96) [funder] 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /man/update_yml.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/update-yaml.R 3 | \name{update_yml} 4 | \alias{update_yml} 5 | \title{Update tic YAML Templates} 6 | \usage{ 7 | update_yml(template_in = NULL, template_out = NULL) 8 | } 9 | \arguments{ 10 | \item{template_in}{\verb{[character]}\cr 11 | Path to template which should be updated. By default all standard template 12 | paths of GitHub Actions or Circle CI will be searched and 13 | updated if they exist. Alternatively a full path to a single template can 14 | be passed.} 15 | 16 | \item{template_out}{\verb{[character]}\cr 17 | Where the updated template should be written to. This is mainly used for 18 | internal testing purposes and should not be set by the user.} 19 | } 20 | \description{ 21 | Updates YAML templates to their 22 | latest versions. Currently only GitHub Actions and Circle CI templates are 23 | supported. 24 | } 25 | \details{ 26 | By default all workflow files starting with \code{tic} are matched. This 27 | means that you can have multiple YAML files with update support, e.g. 28 | \code{"tic.yml"} and \code{"tic-db.yml"}. 29 | } 30 | \section{Formatting requirements of tic YAML templates}{ 31 | To ensure that 32 | updating of 'tic' templates works, ensure the following points: 33 | \itemize{ 34 | \item Your template contains the type (e.g. linux-matrix-deploy) and the revision 35 | date in its first two lines. 36 | \item When inserting comments into custom code blocks, only one-line comments are 37 | allowed. Otherwise the update heuristic gets in trouble. 38 | } 39 | } 40 | 41 | \examples{ 42 | \dontrun{ 43 | # auto-search 44 | update_yml() 45 | 46 | update_yml("tic.yml") 47 | 48 | # custom named templates 49 | update_yml("custom-name.yml") 50 | 51 | # full paths 52 | update_yml("~/path/to/repo/.github/workflows/tic.yml") 53 | } 54 | } 55 | \seealso{ 56 | yaml_templates 57 | } 58 | -------------------------------------------------------------------------------- /man/use_ghactions_deploy.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/gh-actions.R 3 | \name{use_ghactions_deploy} 4 | \alias{use_ghactions_deploy} 5 | \title{Setup deployment for GitHub Actions} 6 | \usage{ 7 | use_ghactions_deploy( 8 | path = usethis::proj_get(), 9 | repo = get_repo_slug(remote), 10 | key_name_private = "TIC_DEPLOY_KEY", 11 | key_name_public = "Deploy key for GitHub Actions", 12 | remote = "origin" 13 | ) 14 | } 15 | \arguments{ 16 | \item{path}{\verb{[string]} \cr 17 | The path to the repository.} 18 | 19 | \item{repo}{\verb{[string]}\cr 20 | The repository slug to use. Must follow the "\code{user/repo}" structure.} 21 | 22 | \item{key_name_private}{\verb{[string]}\cr 23 | The name of the private key of the SSH key pair which will be created. 24 | If not supplied, \code{"TIC_DEPLOY_KEY"} will be used.} 25 | 26 | \item{key_name_public}{\verb{[string]}\cr 27 | The name of the private key of the SSH key pair which will be created. 28 | If not supplied, \code{"Deploy key for GitHub Actions"} will be used.} 29 | 30 | \item{remote}{\verb{[string]}\cr 31 | The GitHub remote which should be used. Defaults to "origin".} 32 | } 33 | \description{ 34 | \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}} 35 | 36 | Creates a public-private key pair, adds the public key to the GitHub 37 | repository via \code{github_add_key()}, and stores the private key as a "secret" 38 | in the GitHub repo. 39 | } 40 | -------------------------------------------------------------------------------- /man/use_tic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/use_tic.R 3 | \name{use_tic} 4 | \alias{use_tic} 5 | \title{Initialize CI testing using tic} 6 | \usage{ 7 | use_tic( 8 | wizard = interactive(), 9 | linux = "ghactions", 10 | mac = "ghactions", 11 | windows = "ghactions", 12 | deploy = "ghactions", 13 | matrix = "none", 14 | private_key_name = "TIC_DEPLOY_KEY", 15 | quiet = FALSE 16 | ) 17 | } 18 | \arguments{ 19 | \item{wizard}{\verb{[flag]}\cr Interactive operation? If \code{TRUE}, a menu will be 20 | shown.} 21 | 22 | \item{linux}{\verb{[string]}\cr Which CI provider(s) to use to test on Linux. 23 | Possible options are \code{"circle"}, \code{"ghactions"}, \code{"none"}/\code{NULL} 24 | and \code{"all"}.} 25 | 26 | \item{mac}{\verb{[string]}\cr Which CI provider(s) to use to test on macOS 27 | Possible options are \code{"none"}/\code{NULL} and \code{"ghactions"}.} 28 | 29 | \item{windows}{\verb{[string]}\cr Which CI provider(s) to use to test on Windows 30 | Possible options are \code{"none"}/\code{NULL}, and \code{"ghactions"}.} 31 | 32 | \item{deploy}{\verb{[string]}\cr Which CI provider(s) to use to deploy artifacts 33 | such as pkgdown documentation. Possible options are "circle"\verb{, }"ghactions"\verb{, }"none"\code{/}NULL\code{and}"all"`.} 34 | 35 | \item{matrix}{\verb{[string]}\cr For which CI provider(s) to set up matrix builds. 36 | Possible options are \code{"circle"}, \code{"ghactions"}, \code{"none"}/\code{NULL} 37 | and \code{"all"}.} 38 | 39 | \item{private_key_name}{\code{string}\cr 40 | Only needed when deploying from builds on GitHub Actions. 41 | If you have set a custom name for the private key during creation of the 42 | SSH key pair via tic::use_ghactions_deploy()] or \code{\link[=use_tic]{use_tic()}}, pass this 43 | name here.} 44 | 45 | \item{quiet}{\verb{[flag]}\cr Less verbose output? Default: \code{FALSE}.} 46 | } 47 | \description{ 48 | Prepares a repo for building and deploying supported by 49 | \pkg{tic}. 50 | } 51 | \details{ 52 | \enumerate{ 53 | \item Query information which CI providers should be used 54 | \item Setup permissions for providers selected for deployment 55 | \item Create YAML files for selected providers 56 | \item Create a default \code{tic.R} file depending on the repo type 57 | (package, website, bookdown, ...) 58 | } 59 | } 60 | \examples{ 61 | # Requires interactive mode 62 | if (FALSE) { 63 | use_tic() 64 | 65 | # Pre-specified settings favoring Circle CI: 66 | use_tic( 67 | wizard = FALSE, 68 | linux = "circle", 69 | mac = "ghactions", 70 | windows = "ghactions", 71 | deploy = "circle", 72 | matrix = "all" 73 | ) 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /man/use_tic_badge.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/use-badge.R 3 | \name{use_tic_badge} 4 | \alias{use_tic_badge} 5 | \title{Add a CI Status Badge to README files} 6 | \usage{ 7 | use_tic_badge(provider, branch = NULL, label = "tic") 8 | } 9 | \arguments{ 10 | \item{provider}{\code{character(1)}\cr 11 | The CI provider to generate a badge for. Only \code{ghactions} is currently 12 | supported} 13 | 14 | \item{branch}{\code{character(1)}\cr 15 | Which branch should the badge represent? Defaults to the default repo 16 | branch.} 17 | 18 | \item{label}{\code{character(1)}\cr 19 | Text to use for the badge.} 20 | } 21 | \description{ 22 | Adds a CI status badge to \code{README.Rmd} or \code{README.md}. By default the label 23 | is \code{"tic"}. 24 | 25 | A custom branch can be specified via argument \code{branch}. 26 | } 27 | \examples{ 28 | \dontrun{ 29 | use_tic_badge(provider = "ghactions") 30 | 31 | # use a different branch 32 | use_tic_badge(provider = "ghactions", branch = "develop") 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /man/use_tic_r.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/use_tic.R 3 | \name{use_tic_r} 4 | \alias{use_tic_r} 5 | \title{Add a tic.R file to the repo} 6 | \usage{ 7 | use_tic_r(repo_type, deploy_on = "none") 8 | } 9 | \arguments{ 10 | \item{repo_type}{(\code{character(1)})\cr 11 | Which type of template should be used. Possible values are \code{"package"}, 12 | \code{"site"}, \code{"blogdown"}, \code{"bookdown"} or \code{"unknown"}.} 13 | 14 | \item{deploy_on}{(\code{character(1)})\cr 15 | Which CI provider should perform deployment? Defaults to \code{NULL} which means 16 | no deployment will be done. Possible values are \code{"ghactions"} or \code{"circle"}.} 17 | } 18 | \description{ 19 | Adds a \code{tic.R} file to containing the macros/steps/stages to be run during 20 | CI runs. 21 | 22 | The content depends on the repo type (detected automatically when used within 23 | \code{\link[=use_tic]{use_tic()}}). 24 | } 25 | \examples{ 26 | \dontrun{ 27 | use_tic_r("package") 28 | use_tic_r("package", deploy_on = "ghactions") 29 | use_tic_r("blogdown", deploy_on = "all") 30 | } 31 | } 32 | \seealso{ 33 | \link{yaml_templates}, \code{\link[=use_tic_badge]{use_tic_badge()}} 34 | } 35 | -------------------------------------------------------------------------------- /man/use_update_tic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/update-yaml.R 3 | \name{use_update_tic} 4 | \alias{use_update_tic} 5 | \title{Update tic Templates} 6 | \usage{ 7 | use_update_tic() 8 | } 9 | \description{ 10 | Adds a GitHub Actions workflow (\code{update-tic.yml}) to check for tic template 11 | updates once a day. 12 | 13 | Internally, \code{\link[=update_yml]{update_yml()}} is called. A Pull Request will be opened if 14 | a newer upstream version of the local tic template is found. 15 | 16 | This workflow relies on a GITHUB_PAT with "workflow" scopes if GitHub Actions 17 | templates should be updated. 18 | Generate a GITHUB PAT and add it as a secret to your repo with 19 | \code{\link[=gha_add_secret]{gha_add_secret()}}. 20 | } 21 | \examples{ 22 | \dontrun{ 23 | use_update_tic() 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /pkgdown/_pkgdown.yml: -------------------------------------------------------------------------------- 1 | url: https://docs.ropensci.org/tic/dev 2 | 3 | template: 4 | bootstrap: 5 5 | package: rotemplate 6 | 7 | development: 8 | mode: auto 9 | version_label: default 10 | version_tooltip: "Version" 11 | 12 | reference: 13 | - title: DSL 14 | contents: 15 | - tic-package 16 | - DSL 17 | - starts_with("dsl_") 18 | - title: YAML templates 19 | contents: 20 | - ends_with("yml") 21 | - use_update_tic 22 | - title: Macros 23 | contents: 24 | - macro 25 | - starts_with("do_") 26 | - contains("macro") 27 | - title: Steps 28 | contents: 29 | - starts_with("step_") 30 | - TicStep 31 | - title: Stages 32 | contents: 33 | - stages 34 | - title: CI Metadata 35 | contents: 36 | - ci 37 | - title: Executing locally 38 | contents: 39 | - run_all_stages 40 | - prepare_all_stages 41 | - run_stage 42 | - title: Setup 43 | contents: 44 | - use_tic 45 | - use_tic_r 46 | - use_tic_badge 47 | - title: Deployment 48 | contents: 49 | - use_ghactions_deploy 50 | - gha_add_secret 51 | - title: Serialization 52 | contents: 53 | - starts_with("base64") 54 | - title: CRAN repository functions 55 | contents: 56 | - starts_with("repo") 57 | - title: Helpers 58 | contents: 59 | - github_helpers 60 | - ssh_key_helpers 61 | - github_repo 62 | - title: Deprecated 63 | contents: 64 | - Deprecated 65 | 66 | toc: 67 | depth: 3 68 | 69 | navbar: 70 | title: 71 | type: default 72 | components: 73 | overview: 74 | text: Introduction 75 | menu: 76 | - text: Feature Overview 77 | href: articles/features.html 78 | - text: The CI Build Lifecycle 79 | href: articles/build-lifecycle.html 80 | - text: CI Client Packages 81 | href: articles/ci-client-packages.html 82 | - text: CI Providers 83 | href: articles/ci-providers.html 84 | - text: FAQ 85 | href: articles/faq.html 86 | advanced: 87 | text: Advanced 88 | menu: 89 | - text: Advanced Usage 90 | href: articles/advanced.html 91 | - text: Deployment 92 | href: articles/deployment.html 93 | - text: Custom Steps 94 | href: articles/custom-steps.html 95 | - text: Updating Templates 96 | href: articles/updating.html 97 | 98 | structure: 99 | left: [home, intro, reference, overview, advanced, news] 100 | right: [search, github] 101 | 102 | authors: 103 | Kirill Müller: 104 | href: https://krlmlr.info 105 | Patrick Schratz: 106 | href: https://pat-s.me 107 | 108 | -------------------------------------------------------------------------------- /pkgdown/extra.css: -------------------------------------------------------------------------------- 1 | /* Syntax highlighting theme */ 2 | .fl {color: #1514b5;} 3 | .co {color: #888888;} /* comments */ 4 | .ch, .st {color: green;} /* strings */ 5 | .dv, .ot {color: darkblue;} /* numbers, logicals */ 6 | .sourceCode.r .op {color: #505050;} /* operators */ 7 | .sourceCode.r .dt {color: #303030;} /* function argument names, #303030 - darkgray */ 8 | .sourceCode.r .kw, .fu, .cf, /* function names */ 9 | .sourceCode a:link, 10 | .sourceCode a:active, 11 | .sourceCode a:visited {color:darkred;} 12 | /* 13 | .message {color: darkgreen;} 14 | .warning {color: orange;} 15 | .error {color: red;} 16 | */ 17 | /* LEGEND for highlighting: 18 | .co comments 19 | .ch string (character?) 20 | .st string 21 | .dv numbers 22 | .ot logical values 23 | .op operator 24 | .dt function argument name 25 | .kw keyword 26 | .fu function name 27 | .cf function name. 28 | .sourceCode a:link - links in code blocs (they are function names) 29 | .cf was a present as function name `function` in this example: 30 | ps_ksvm = makeParamSet( 31 | makeNumericParam("sigma", lower = -12, upper = 12, trafo = function(x) 2^x) 32 | ) 33 | */ 34 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(tic) 3 | 4 | withr::with_envvar( 5 | list("TIC_MOCK" = "true"), 6 | test_check("tic") 7 | ) 8 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/print.md: -------------------------------------------------------------------------------- 1 | # print stages 2 | 3 | -- tic configuration summary --------------------------------------------------- 4 | i No steps defined in any stage 5 | 6 | --- 7 | 8 | -- tic configuration summary --------------------------------------------------- 9 | -- Stage: install -------------------------------------------------------------- 10 | > step_install_deps() 11 | 12 | --- 13 | 14 | -- tic configuration summary --------------------------------------------------- 15 | -- Stage: install -------------------------------------------------------------- 16 | > step_install_deps() 17 | -- Stage: script --------------------------------------------------------------- 18 | > step_rcmdcheck() 19 | 20 | --- 21 | 22 | -- Stage: deploy --------------------------------------------------------------- 23 | i No steps defined 24 | 25 | --- 26 | 27 | -- tic configuration summary --------------------------------------------------- 28 | -- Stage: install -------------------------------------------------------------- 29 | > step_install_deps() 30 | > step_session_info() 31 | -- Stage: script --------------------------------------------------------------- 32 | > step_rcmdcheck() 33 | -- Stage: deploy --------------------------------------------------------------- 34 | > step_build_pkgdown() 35 | > step_run_code(writeLines("", paste0("docs", "/.nojekyll"))) 36 | > step_run_code(dir.create(paste0("docs", "/dev"), showWarnings=FALSE)) 37 | > step_run_code(writeLines("", paste0("docs", "/dev/.nojekyll"))) 38 | 39 | --- 40 | 41 | -- tic configuration summary --------------------------------------------------- 42 | i No steps defined in any stage 43 | 44 | --- 45 | 46 | -- tic configuration summary --------------------------------------------------- 47 | -- Stage: install -------------------------------------------------------------- 48 | > step_install_deps() 49 | > step_session_info() 50 | -- Stage: deploy --------------------------------------------------------------- 51 | > step_build_bookdown() 52 | 53 | --- 54 | 55 | -- tic configuration summary --------------------------------------------------- 56 | -- Stage: install -------------------------------------------------------------- 57 | > step_install_deps() 58 | > step_session_info() 59 | -- Stage: deploy --------------------------------------------------------------- 60 | > step_build_bookdown() 61 | 62 | -------------------------------------------------------------------------------- /tests/testthat/helper-ci.R: -------------------------------------------------------------------------------- 1 | ci_ <- function() MockCI$new() 2 | 3 | ci <- memoise::memoise(ci_) 4 | -------------------------------------------------------------------------------- /tests/testthat/helper.R: -------------------------------------------------------------------------------- 1 | # borrowed from https://github.com/r-lib/usethis/blob/main/tests/testthat/helper.R 2 | proj <- new.env(parent = emptyenv()) 3 | 4 | proj_get_ <- function() proj$cur 5 | 6 | create_local_package <- function(dir = tempfile(pattern = "testpkg"), 7 | env = parent.frame(), 8 | rstudio = FALSE) { 9 | create_local_thing(dir, env, rstudio, "package") 10 | } 11 | 12 | create_local_project <- function(dir = tempfile(pattern = "testproj"), 13 | env = parent.frame(), 14 | rstudio = FALSE) { 15 | create_local_thing(dir, env, rstudio, "project") 16 | } 17 | 18 | create_local_thing <- function(dir = tempfile(pattern = pattern), 19 | env = parent.frame(), 20 | rstudio = FALSE, 21 | thing = c("package", "project")) { 22 | thing <- match.arg(thing) 23 | # if (dir.exists(dir)) { 24 | # ui_stop("Target {ui_code('dir')} {ui_path(dir)} already exists.") 25 | # } 26 | 27 | old_project <- proj_get_() # this could be `NULL`, i.e. no active project 28 | old_wd <- getwd() # not necessarily same as `old_project` 29 | 30 | withr::defer( 31 | { 32 | # ui_done("Deleting temporary project: {ui_path(dir)}") 33 | unlink(dir) 34 | }, 35 | envir = env 36 | ) 37 | # ui_silence( 38 | switch(thing, 39 | package = usethis::create_package(dir, rstudio = rstudio, open = FALSE, check_name = FALSE), 40 | project = usethis::create_project(dir, rstudio = rstudio, open = FALSE) 41 | ) 42 | # ) 43 | 44 | withr::defer(usethis::proj_set(old_project, force = TRUE), envir = env) 45 | usethis::proj_set(dir) 46 | 47 | withr::defer( 48 | { 49 | # ui_done("Restoring original working directory: {ui_path(old_wd)}") 50 | setwd(old_wd) 51 | }, 52 | envir = env 53 | ) 54 | setwd(usethis::proj_get()) 55 | 56 | invisible(usethis::proj_get()) 57 | } 58 | -------------------------------------------------------------------------------- /tests/testthat/test-base64.R: -------------------------------------------------------------------------------- 1 | test_that("roundtrip serialization", { 2 | x <- runif(10) 3 | expect_identical(base64unserialize(base64serialize(x)), x) 4 | }) 5 | -------------------------------------------------------------------------------- /tests/testthat/test-ci.R: -------------------------------------------------------------------------------- 1 | test_that("ci_can_push() never fails", { 2 | expect_type(ci_can_push(), "logical") 3 | expect_error(ci_can_push(), NA) 4 | expect_error( 5 | withr::with_envvar(c(id_rsa = NA), ci_can_push("BOGUS_TIC_TEST_ENVVAR")), 6 | NA 7 | ) 8 | }) 9 | -------------------------------------------------------------------------------- /tests/testthat/test-deploy.R: -------------------------------------------------------------------------------- 1 | Running <- R6Class( 2 | "Running", 3 | inherit = TicStep, 4 | public = list( 5 | initialize = function(running = TRUE) { 6 | private$running <- running 7 | }, 8 | prepare = function() { 9 | private$prepare_calls <- private$prepare_calls + 1L 10 | }, 11 | run = function() { 12 | private$run_calls <- private$run_calls + 1L 13 | }, 14 | check = function() private$running, 15 | get_prepare_calls = function() private$prepare_calls, 16 | get_run_calls = function() private$run_calls 17 | ), 18 | private = list( 19 | running = NULL, 20 | prepare_calls = 0L, 21 | run_calls = 0L 22 | ) 23 | ) 24 | 25 | test_that("prepare tasks", { 26 | running <- Running$new() 27 | not_running <- Running$new(FALSE) 28 | stage <- local( 29 | TicStage$new("test") %>% 30 | add_step(running) %>% 31 | add_step(not_running), 32 | dslobj_new() 33 | ) 34 | 35 | expect_output(stage$prepare_all(), "Skipping", fixed = TRUE) 36 | expect_equal(running$get_prepare_calls(), 1L) 37 | expect_equal(not_running$get_prepare_calls(), 0L) 38 | 39 | expect_output(stage$prepare_all(), "private$running", fixed = TRUE) 40 | 41 | expect_equal(running$get_run_calls(), 0L) 42 | expect_equal(not_running$get_run_calls(), 0L) 43 | }) 44 | 45 | test_that("run tasks", { 46 | running <- Running$new() 47 | not_running <- Running$new(FALSE) 48 | stage <- local( 49 | TicStage$new("asdfgh") %>% 50 | add_step(running) %>% 51 | add_step(not_running), 52 | dslobj_new() 53 | ) 54 | 55 | expect_output(stage$run_all(), "Skipping asdfgh", fixed = TRUE) 56 | 57 | expect_equal(running$get_prepare_calls(), 0L) 58 | expect_equal(not_running$get_prepare_calls(), 0L) 59 | 60 | expect_equal(running$get_run_calls(), 1L) 61 | expect_equal(not_running$get_run_calls(), 0L) 62 | 63 | expect_output(stage$run_all(), "private$running", fixed = TRUE) 64 | }) 65 | -------------------------------------------------------------------------------- /tests/testthat/test-integration-assign.R: -------------------------------------------------------------------------------- 1 | test_that("integration test: assign (#33)", { 2 | package_path <- tempfile("ticpkg", fileext = "pkg") 3 | 4 | cat("\n") 5 | dir.create(package_path) 6 | withr::with_dir( 7 | package_path, 8 | { # nolint 9 | writeLines( 10 | 'script_stage <- get_stage("script")', 11 | "tic.R" 12 | ) 13 | writeLines("^tic\\.R$", ".Rbuildignore") 14 | expect_error( 15 | callr::r( 16 | function() { 17 | tic::run_all_stages() 18 | }, 19 | show = TRUE, 20 | env = c(callr::rcmd_safe_env(), TIC_LOCAL = "true") 21 | ), 22 | NA 23 | ) 24 | expect_false(file.exists("out.txt")) 25 | } 26 | ) 27 | }) 28 | -------------------------------------------------------------------------------- /tests/testthat/test-integration-early-failure.R: -------------------------------------------------------------------------------- 1 | test_that("integration test: early failure", { 2 | package_path <- tempfile("ticpkg", fileext = "pkg") 3 | 4 | cat("\n") 5 | dir.create(package_path) 6 | 7 | tic_r <- paste0( 8 | 'get_stage("script") %>%\n', 9 | ' add_code_step(stop("oops")) %>%\n', 10 | ' add_code_step(writeLines(character(), "out.txt"))' 11 | ) 12 | 13 | withr::with_dir( 14 | package_path, 15 | { # nolint 16 | writeLines(tic_r, "tic.R") 17 | writeLines("^tic\\.R$", ".Rbuildignore") 18 | expect_error( 19 | callr::r( 20 | function() { 21 | tic::run_all_stages() 22 | }, 23 | show = TRUE, 24 | env = c(callr::rcmd_safe_env(), TIC_LOCAL = "true") 25 | ), 26 | "A step failed in stage" 27 | ) 28 | expect_false(file.exists("out.txt")) 29 | } 30 | ) 31 | }) 32 | -------------------------------------------------------------------------------- /tests/testthat/test-integration-git-commit-paths.R: -------------------------------------------------------------------------------- 1 | test_that("integration test: git commit paths", { 2 | cli::cat_boxx("integration test: git commit paths") 3 | 4 | # - Commit only a subset of changes that occur during deployment 5 | # - Check that only these changes are really committed 6 | 7 | bare_repo_path <- tempfile_slash("ticrepo") 8 | dir.create(bare_repo_path) 9 | git2r::init(bare_repo_path, bare = TRUE) 10 | 11 | package_path <- tempfile("ticpkg", fileext = "pkg") 12 | git2r::clone(bare_repo_path, package_path) 13 | 14 | tic_r <- c( 15 | 'get_stage("deploy") %>%', 16 | # step_write_text_file() evaluates eagerly, won't work here 17 | " add_code_step(writeLines(", 18 | ' as.character(Sys.time()), "time.txt"', 19 | " )) %>%", 20 | " add_code_step(writeLines(", 21 | ' as.character(Sys.time()), "deploy/time.txt"', 22 | " )) %>%", 23 | paste0( 24 | ' add_step(step_push_deploy(remote_url = "', 25 | bare_repo_path, 26 | '", commit_paths = "deploy"))' 27 | ) 28 | ) 29 | 30 | cat("\n") 31 | withr::with_dir( 32 | package_path, 33 | { # nolint 34 | writeLines(tic_r, "tic.R") 35 | writeLines("^tic\\.R$", ".Rbuildignore") 36 | dir.create("deploy") 37 | writeLines(character(), "deploy/.gitignore") 38 | git2r::config(user.name = "tic", user.email = "tic@pkg.test") 39 | git2r::add(path = ".") 40 | git2r::commit(message = "Initial commit") 41 | system("git push") # git2r::push() is only trouble 42 | } 43 | ) 44 | 45 | withr::with_dir( 46 | package_path, 47 | { # nolint 48 | callr::r( 49 | function() { 50 | tic::run_all_stages() 51 | }, 52 | show = TRUE, 53 | env = c(callr::rcmd_safe_env(), TIC_LOCAL = "true") 54 | ) 55 | } 56 | ) 57 | 58 | last_bare_commit <- git2r::last_commit(bare_repo_path) 59 | expect_match(last_bare_commit$message, "Deploy from local build") 60 | 61 | package_path_2 <- tempfile("ticpkg", fileext = "pkg") 62 | git2r::clone(bare_repo_path, package_path_2) 63 | 64 | withr::with_dir( 65 | package_path_2, 66 | { # nolint 67 | expect_false(file.exists("time.txt")) 68 | expect_true(file.exists("deploy/time.txt")) 69 | } 70 | ) 71 | }) 72 | -------------------------------------------------------------------------------- /tests/testthat/test-integration-git.R: -------------------------------------------------------------------------------- 1 | test_that("integration test: git", { 2 | cli::cat_boxx("integration test: git") 3 | 4 | base_path <- tempfile_slash("git-") 5 | dir.create(base_path) 6 | tmp <- function(x) file.path(base_path, x) 7 | 8 | 9 | bare_repo_path <- tmp("bare_repo") 10 | dir.create(bare_repo_path) 11 | git2r::init(bare_repo_path, bare = TRUE) 12 | 13 | package_path <- tmp("package") 14 | git2r::clone(bare_repo_path, package_path) 15 | 16 | cat("\n") 17 | usethis::create_package( 18 | package_path, 19 | fields = list(), rstudio = FALSE, open = FALSE 20 | ) 21 | 22 | tic_r <- c( 23 | 'get_stage("deploy") %>%', 24 | ' add_code_step(writeLines(as.character(Sys.time()), "time.txt")) %>%', 25 | paste0( 26 | ' add_step(step_push_deploy(remote_url = "', bare_repo_path, '"))' 27 | ) 28 | ) 29 | 30 | withr::with_dir( 31 | package_path, 32 | { 33 | writeLines(tic_r, "tic.R") 34 | writeLines("^tic\\.R$", ".Rbuildignore") 35 | git2r::config(user.name = "tic", user.email = "tic@pkg.test") 36 | git2r::add(path = ".") 37 | git2r::commit(message = "Initial commit") 38 | system("git push") # git2r::push() is only trouble 39 | } 40 | ) 41 | 42 | withr::with_dir( 43 | package_path, 44 | { 45 | callr::r( 46 | function() { 47 | tic::run_all_stages() 48 | }, 49 | show = TRUE, 50 | env = c(callr::rcmd_safe_env(), TIC_LOCAL = "true") 51 | ) 52 | } 53 | ) 54 | 55 | last_bare_commit <- git2r::last_commit(bare_repo_path) 56 | expect_match(last_bare_commit$message, "Deploy from local build") 57 | }) 58 | -------------------------------------------------------------------------------- /tests/testthat/test-integration-package-failure.R: -------------------------------------------------------------------------------- 1 | test_that("integration test: package failure", { 2 | # since the move to pak this tests fails during CI but succeed locally 3 | skip("failing weirdly since pak transition") 4 | 5 | cli::cat_boxx("integration test: package failure") 6 | 7 | package_path <- tempfile("ticpkg", fileext = "pkg") 8 | 9 | cat("\n") 10 | usethis::create_package( 11 | package_path, 12 | fields = list(License = "GPL-2"), rstudio = FALSE, open = FALSE 13 | ) 14 | withr::with_dir( 15 | package_path, 16 | { # nolint 17 | writeLines("do_package_checks()", "tic.R") 18 | writeLines("^tic\\.R$", ".Rbuildignore") 19 | dir.create("tests") 20 | writeLines('stop("Check failure!")', "tests/test.R") 21 | expect_error( 22 | callr::r( 23 | function() { 24 | tic::run_all_stages() 25 | }, 26 | show = TRUE, 27 | env = c(callr::rcmd_safe_env(), TIC_LOCAL = "true") 28 | ), 29 | 'A step failed in stage "script"' 30 | ) 31 | } 32 | ) 33 | }) 34 | -------------------------------------------------------------------------------- /tests/testthat/test-integration-package.R: -------------------------------------------------------------------------------- 1 | test_that("integration test: package", { 2 | # since the move to pak this tests fails during CI but succeed locally 3 | skip("failing weirdly since pak transition") 4 | 5 | cli::cat_boxx("integration test: package") 6 | 7 | package_path <- tempfile("ticpkg", fileext = "pkg") 8 | 9 | cat("\n") 10 | usethis::create_package( 11 | package_path, 12 | fields = list(License = "GPL-2"), rstudio = FALSE, open = FALSE 13 | ) 14 | withr::with_dir( 15 | package_path, 16 | { 17 | writeLines("do_package_checks()", "tic.R") 18 | writeLines("^tic\\.R$", ".Rbuildignore") 19 | callr::r( 20 | function() { 21 | tic::run_all_stages() 22 | }, 23 | show = TRUE, 24 | env = c(callr::rcmd_safe_env(), TIC_LOCAL = "true") 25 | ) 26 | } 27 | ) 28 | 29 | # This is an integration test, we're good if we have reached this point. 30 | expect_true(TRUE) 31 | }) 32 | -------------------------------------------------------------------------------- /tests/testthat/test-macro.R: -------------------------------------------------------------------------------- 1 | test_that("list_macros() returns a character", { 2 | expect_vector(list_macros(), ptype = character()) 3 | }) 4 | -------------------------------------------------------------------------------- /tests/testthat/test-print.R: -------------------------------------------------------------------------------- 1 | test_that("print stages", { 2 | # this ensures equal test output locally and during CI runs 3 | Sys.setenv("GITHUB_ACTIONS" = "true") 4 | 5 | skip_on_os("windows") 6 | dsl_init(quiet = TRUE) 7 | 8 | print(dsl_get()) 9 | expect_snapshot_output( 10 | print(dsl_get()) # , 11 | # testthat::test_path("out/empty.txt") 12 | ) 13 | 14 | get_stage("install") %>% 15 | add_step(step_install_deps()) 16 | 17 | expect_snapshot_output( 18 | print(dsl_get()) 19 | ) 20 | 21 | get_stage("script") %>% 22 | add_step(step_rcmdcheck()) 23 | 24 | expect_snapshot_output( 25 | print(dsl_get()) 26 | ) 27 | 28 | expect_snapshot_output( 29 | print(get_stage("deploy"), omit_if_empty = FALSE) 30 | ) 31 | 32 | do_pkgdown() 33 | 34 | expect_snapshot_output( 35 | print(dsl_get()) 36 | ) 37 | 38 | dsl_init(quiet = TRUE) 39 | 40 | expect_snapshot_output( 41 | print(dsl_get()) 42 | ) 43 | 44 | do_bookdown() 45 | 46 | expect_snapshot_output( 47 | print(dsl_get()) 48 | ) 49 | 50 | get_stage("install") %>% 51 | # exact duplicate with no arguments (should only appear once) 52 | add_step(step_session_info()) %>% 53 | # step with different argument (should appear) 54 | add_step(step_install_deps()) %>% 55 | # exact duplicate including arguments ((should only appear once)) 56 | add_step(step_install_deps()) 57 | 58 | expect_snapshot_output( 59 | print(dsl_get()) 60 | ) 61 | }) 62 | -------------------------------------------------------------------------------- /tests/testthat/test-repo.R: -------------------------------------------------------------------------------- 1 | test_that("can determine available packages from repos", { 2 | skip_if(getRversion() < "3.3") 3 | 4 | expect_error(available.packages(repos = repo_default()), NA) 5 | expect_error(available.packages(repos = repo_cloud()), NA) 6 | expect_error(available.packages(repos = repo_cran()), NA) 7 | expect_error(available.packages(repos = repo_bioc()), NA) 8 | }) 9 | -------------------------------------------------------------------------------- /tests/testthat/test-stages.R: -------------------------------------------------------------------------------- 1 | test_that("Only known stages can be accessed", { 2 | expect_s3_class(TicDSL$new()$get_stage("install"), "TicStage") 3 | expect_error(TicDSL$new()$get_stage("oops")) 4 | }) 5 | -------------------------------------------------------------------------------- /tests/testthat/test-tasks-base.R: -------------------------------------------------------------------------------- 1 | test_that("can't run base task", { 2 | task <- TicStep$new() 3 | expect_null(task$prepare()) 4 | expect_true(task$check()) 5 | expect_error(task$run(), "override") 6 | }) 7 | 8 | test_that("can run hello world task", { 9 | task <- step_hello_world() 10 | expect_null(task$prepare()) 11 | expect_true(task$check()) 12 | expect_output(task$run(), "world") 13 | }) 14 | -------------------------------------------------------------------------------- /tests/testthat/test-update-yaml.R: -------------------------------------------------------------------------------- 1 | # GitHub Actions --------------------------------------------------------------- 2 | 3 | test_that("update_yml() preserves custom env vars AND blocks", { 4 | create_local_package() 5 | update_yml( 6 | system.file("testdata/ghactions-test-update-yaml-env-and-blocks.yml", package = "tic"), # nolint 7 | paste0(tempdir(), "/test-update-yaml-env-and-blocks-updated.yml") 8 | ) 9 | 10 | updated <- readLines(paste0(tempdir(), "/test-update-yaml-env-and-blocks-updated.yml")) # nolint 11 | solution <- readLines(system.file("testdata/ghactions-test-update-yaml-env-and-blocks-solution.yml", package = "tic")) # nolint 12 | expect_equal(updated, solution) 13 | }) 14 | 15 | test_that("update_yml() fails with descriptive error message if diffs between 16 | local and upstream template are too large", { 17 | create_local_package() 18 | expect_error( 19 | update_yml( 20 | system.file("testdata/ghactions-check-update-fail.yml", package = "tic"), # nolint 21 | ), 22 | "Not enough valid anchors points found between local and upstream template." 23 | ) 24 | }) 25 | 26 | # Circle CI -------------------------------------------------------------------- 27 | 28 | test_that("update_yml() preserves custom env vars AND blocks - Circle CI", { 29 | create_local_package() 30 | update_yml( 31 | system.file("testdata/circle-test-update-yaml-env-and-blocks.yml", package = "tic"), # nolint 32 | paste0(tempdir(), "/circle-test-update-yaml-env-and-blocks-updated.yml") 33 | ) 34 | 35 | updated <- readLines(paste0(tempdir(), "/circle-test-update-yaml-env-and-blocks-updated.yml")) # nolint 36 | solution <- readLines(system.file("testdata/circle-test-update-yaml-env-and-blocks-solution.yml", package = "tic")) # nolint 37 | expect_equal(updated, solution) 38 | }) 39 | -------------------------------------------------------------------------------- /tests/testthat/test-utils.R: -------------------------------------------------------------------------------- 1 | test_that("deps", { 2 | expect_equal(get_deps_from_code(quote({})), character()) 3 | expect_equal(get_deps_from_code(quote(pkg::fun)), "pkg") 4 | expect_equal(get_deps_from_code(quote(pkg::fun("test"))), "pkg") 5 | expect_equal( 6 | get_deps_from_code( 7 | quote({ 8 | pkg1::fun1("test1") 9 | pkg2::fun2("test2") 10 | if (TRUE) { 11 | pkg3::fun2("test3") 12 | } 13 | }) 14 | ), 15 | paste0("pkg", 1:3) 16 | ) 17 | }) 18 | 19 | test_that("%||%", { 20 | expect_identical(NULL %||% 1, 1) 21 | expect_identical(2 %||% 1, 2) 22 | expect_identical(2 %||% NULL, 2) 23 | }) 24 | 25 | test_that("warningc()", { 26 | expect_warning(warningc("test"), "test", fixed = TRUE) 27 | }) 28 | 29 | test_that("vlapply()", { 30 | expect_identical(vlapply(1:3, `==`, 2), c(FALSE, TRUE, FALSE)) 31 | }) 32 | -------------------------------------------------------------------------------- /tic.R: -------------------------------------------------------------------------------- 1 | do_package_checks(codecov = FALSE) 2 | 3 | if (ci_on_ghactions() && ci_is_env("BUILD_PKGDOWN", "true")) { 4 | get_stage("before_deploy") %>% 5 | add_step(step_install_github("ropensci/rotemplate")) 6 | do_pkgdown() 7 | } 8 | -------------------------------------------------------------------------------- /tic.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source --no-byte-compile 21 | PackageCheckArgs: --no-tests --as-cran --no-examples 22 | PackageRoxygenize: rd,collate,namespace 23 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /vignettes/ci-client-packages.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "tic & CI Client Packages - An Overview" 3 | author: "Patrick Schratz, Kirill Müller" 4 | output: rmarkdown::html_vignette 5 | vignette: > 6 | %\VignetteIndexEntry{tic & CI Client Packages - An Overview} 7 | %\VignetteEngine{knitr::rmarkdown} 8 | %\VignetteEncoding{UTF-8} 9 | --- 10 | 11 | ```{r setup, include = FALSE} 12 | knitr::opts_chunk$set( 13 | collapse = TRUE, 14 | comment = "#>" 15 | ) 16 | ``` 17 | 18 | ## Introduction 19 | 20 | Most of the setup work that needs to be done for specific CI systems is handled by the respective R client packages such as [{circle}](https://docs.ropensci/circle/). 21 | These enable the repo on the CI system and ensure that deployment permissions are granted. 22 | 23 | After everything has been set up, the rest of the work goes to {tic}. 24 | 25 | - Creation of the CI YAML templates. 26 | - Which steps are going to be run. 27 | - Deployment: Yes/no 28 | 29 | In essence, `tic::use_tic()` is a wrapper for creating CI YAML templates and setting up deployment on the CI systems which is powered by the client packages. 30 | 31 | ## CI Client Packages 32 | 33 | Currently, the following CI client packages exist: 34 | 35 | - [{circle}]((https://docs.ropensci.org/circle/)) 36 | 37 | The client package for _travis_ was archived in November 2020. 38 | 39 | For _Appveyor_ there is [r-appveyor](https://github.com/krlmlr/r-appveyor) from Kirill Müller. 40 | This project makes it possible in the first place to run R checks on Appveyor but does not provide access to the _Appveyor_ API and is not used by {tic} currently. 41 | Also, it does not come with automation for deployment setup. 42 | Appveyor support has been removed from {tic} in December 2020 due to a strong focus on GitHub Actions. 43 | 44 | For _GitHub Actions_ there is [{ghactions}](https://github.com/maxheld83/ghactions) from Max Held which comes with functions helping to set up YAML templates and other convenience. 45 | It does not provide API access and is not used by {tic} currently. 46 | -------------------------------------------------------------------------------- /vignettes/faq.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "FAQ" 3 | output: rmarkdown::html_vignette 4 | vignette: > 5 | %\VignetteIndexEntry{FAQ} 6 | %\VignetteEngine{knitr::rmarkdown} 7 | %\VignetteEncoding{UTF-8} 8 | --- 9 | 10 | ```{r, include = FALSE} 11 | knitr::opts_chunk$set( 12 | collapse = TRUE, 13 | comment = "#>" 14 | ) 15 | ``` 16 | 17 | ## Authentication 18 | 19 | #### Q-Auth-1 20 | 21 | I am getting an error when using `circle::use_circle_deploy()` or `tic::use_ghactions_deploy()`. 22 | 23 | **Answer** 24 | 25 | In most cases this is related to API authentication issues. 26 | Ensure that the following points are met: 27 | 28 | 1. For Circle CI, install the respective GitHub App from the [GitHub Marketplace](https://github.com/marketplace). 29 | 2. Ensure that you have set the respective API keys for the problematic provider in your `.Renviron` file. 30 | Consult the help pages of the respective `use_*_deploy()` function for more help. 31 | - GitHub Actions: A `GITHUB_PAT` with "public_repo" scopes. 32 | - Circle CI: Env var `R_CIRCLE`. 33 | 34 | ## GitHub Actions 35 | 36 | #### Q-GHA-1 37 | 38 | How is {tic} different from what [r-lib/actions](https://github.com/r-lib/actions) does? 39 | 40 | **Answer** 41 | 42 | {tic} uses [r-lib/actions](https://github.com/r-lib/actions) as the base to install R in the first place. 43 | However in detail, {tic} does the following things differently which aim to enhance the CI experience: 44 | 45 | - Caching: {tic} caches the whole R library rather than only the direct dependencies of a package. 46 | This has the advantage that packages required for side actions ({pkgdown} deployment, README updates) will also be cached. 47 | 48 | - `ccache`: {tic} comes with a compiler cache for source installations of packages by default, speeding up repeated source installation highly. 49 | The compiler cache directory (`.ccache`) will also be cached (once a week). 50 | Example use case: If you installed {Rcpp} from source as a dependency of your package and have it stored in your cache and {Rcpp} now updates two days later, the reinstallation will make use of the compiler cache and install {Rcpp} instantly rather than recompiling the C code again. 51 | 52 | - Number of CPUs: {tic} uses 4 CPUs by default instead of only 1 as [r-lib/actions](https://github.com/r-lib/actions) does. 53 | This speeds up package installation a lot. 54 | 4 CPUs are max because all GitHub Actions runners have 2 hyperthreading cores available. 55 | 56 | - Use of SSH deployment keys: Once set up via `tic::use_ghactions_deploy()`, this deployment approach makes it possible to push any file of your repository to any branch of your remote. 57 | Other deployment approaches often limit you to only push to `gh-pages` branch or similar. 58 | 59 | ## Other 60 | 61 | #### Q-Other-1 62 | 63 | Is it possible to update the CI YAML templates installed by {tic} with upstream changes? 64 | 65 | **Answer** 66 | 67 | Yes! Have a look at ["Updating Templates"](https://docs.ropensci.org/tic/articles/updating.html) for more information. 68 | 69 | --- 70 | 71 | #### Q-Other-2 72 | 73 | Am I the only one using {tic}? 74 | 75 | **Answer** 76 | 77 | You can see who and how many people use {tic.R} on GitHub via this query: https://github.com/search?p=5&q=filename%3Atic.R&type=Code 78 | 79 | --- 80 | 81 | #### Q-Other-3 82 | 83 | Package {rgl} fails to install because of either 84 | 85 | - "configure: error: X11 not found but required, configure aborted." 86 | - "error: X11 not found; XQuartz (from www.xquartz.org) is required to run rgl." 87 | 88 | **Answer** 89 | 90 | The first one is usually caused by a missing installation of `XQuartz` on macOS. 91 | Add `brew install xquartz` to the runner. 92 | 93 | The second error requires to set the `DISPLAY` env var to mimic a non-headless state. 94 | Add `export DISPLAY=:99` to the stage in which {rgl} should be installed. 95 | If the warning message during loading of {rgl} should be suppressed, either env var `RGL_USE_NULL = TRUE` can be set or R option `options(rgl.useNull = TRUE)`. 96 | -------------------------------------------------------------------------------- /vignettes/img/README.md: -------------------------------------------------------------------------------- 1 | # How to open/modify `.graphml` files 2 | 3 | This filetype is specfic for the application [yEd](https://www.yworks.com/yed). 4 | You can install the application locally or use the [live version](https://www.yworks.com/products/yed-live). 5 | -------------------------------------------------------------------------------- /vignettes/img/build-lifecycle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/tic/14ca9a5ecf7771b8151e681c108fd9992a813858/vignettes/img/build-lifecycle.png -------------------------------------------------------------------------------- /vignettes/img/circleci-debug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/tic/14ca9a5ecf7771b8151e681c108fd9992a813858/vignettes/img/circleci-debug.png -------------------------------------------------------------------------------- /vignettes/img/private-key-travis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/tic/14ca9a5ecf7771b8151e681c108fd9992a813858/vignettes/img/private-key-travis.png -------------------------------------------------------------------------------- /vignettes/img/ssh-deploy-key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/tic/14ca9a5ecf7771b8151e681c108fd9992a813858/vignettes/img/ssh-deploy-key.png -------------------------------------------------------------------------------- /vignettes/img/tic-travis-usethis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/tic/14ca9a5ecf7771b8151e681c108fd9992a813858/vignettes/img/tic-travis-usethis.png -------------------------------------------------------------------------------- /vignettes/img/travis-job-id.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ropensci/tic/14ca9a5ecf7771b8151e681c108fd9992a813858/vignettes/img/travis-job-id.png --------------------------------------------------------------------------------