Skip to content

Commit

Permalink
Use actions/v1 tag and update instructions (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
gadenbuie authored Oct 13, 2023
1 parent 176131d commit 799b11c
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ jobs:

# ## Suggested usage
# - name: Test app
# uses: rstudio/shinytest2/actions/test-app@v1
# uses: rstudio/shinytest2/actions/test-app@actions/v1
# with:
# app-dir: |
# tests/testthat/apps/hello

- name: Test app (main)
uses: rstudio/shinytest2/actions/test-app@v1
uses: rstudio/shinytest2/actions/test-app@actions/v1
with:
app-dir: "tests/testthat/apps/window"

Expand Down
6 changes: 6 additions & 0 deletions R/shinytest2-package.R
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
#' @useDynLib shinytest2, .registration = TRUE
NULL

release_bullets <- function() {
c(
"Is the `actions/test-app` sliding tag up-to-date? Check both `v1` and `actions/v1`."
)
}
14 changes: 12 additions & 2 deletions actions/test-app/README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Inputs available:
Typical (single app testing) GHA step usage:

``` yaml
- uses: rstudio/shinytest2/actions/test-app@v1
- uses: rstudio/shinytest2/actions/test-app@actions/v1
with:
app-dir: |
dir/to/app
Expand All @@ -38,7 +38,7 @@ Typical (single app testing) GHA step usage:
Multiple Apps can be tested by supplying multiple directories to `app-dir` separated by a newline:

```yaml
- uses: rstudio/shinytest2/actions/test-app@v1
- uses: rstudio/shinytest2/actions/test-app@actions/v1
with:
app-dir: |
dir/to/app1
Expand Down Expand Up @@ -103,7 +103,17 @@ Workflow contents:
print_yaml("example-test-app-package.yaml")
```

# Development

The `test-app` action uses a sliding git tag that follows the pattern `actions/vX`, e.g. `actions/v1`. For historical reasons, we also support the `v1` tag, but future versions will only be available under the `actions/vX` tag.

The `test-app` action release cycle is not dependent on the shinytest2 package cycle. When changes are made to the `test-app` action, you should force-update the current sliding tag version:

```bash
git tag -f v1 # update historical v1 tag
git tag -f actions/v1 # update sliding tag
git push --tags --force # push tag to github
```

# License

Expand Down
29 changes: 23 additions & 6 deletions actions/test-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Inputs available:
Typical (single app testing) GHA step usage:

``` yaml
- uses: rstudio/shinytest2/actions/test-app@v1
- uses: rstudio/shinytest2/actions/test-app@actions/v1
with:
app-dir: |
dir/to/app
Expand All @@ -33,7 +33,7 @@ Multiple Apps can be tested by supplying multiple directories to
`app-dir` separated by a newline:

``` yaml
- uses: rstudio/shinytest2/actions/test-app@v1
- uses: rstudio/shinytest2/actions/test-app@actions/v1
with:
app-dir: |
dir/to/app1
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
extra-packages:
shinytest2
- uses: rstudio/shinytest2/actions/test-app@v1
- uses: rstudio/shinytest2/actions/test-app@actions/v1
with:
app-dir: "."
```
Expand All @@ -132,7 +132,7 @@ usethis::use_github_action(
Workflow contents:

``` yaml
# Workflow derived from https://github.com/rstudio/shinytest2/tree/main/actions/test-app/example-test-app-description.yaml
# Workflow derived from https://github.com/rstudio/shinytest2/tree/main/actions/test-app/example-test-app-renv.yaml
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:
- uses: r-lib/actions/setup-renv@v2
- uses: rstudio/shinytest2/actions/test-app@v1
- uses: rstudio/shinytest2/actions/test-app@actions/v1
with:
app-dir: "."
```
Expand Down Expand Up @@ -238,11 +238,28 @@ jobs:
local::.
shinytest2
- uses: rstudio/shinytest2/actions/test-app@v1
- uses: rstudio/shinytest2/actions/test-app@actions/v1
with:
app-dir: "."
```

# Development

The `test-app` action uses a sliding git tag that follows the pattern
`actions/vX`, e.g. `actions/v1`. For historical reasons, we also support
the `v1` tag, but future versions will only be available under the
`actions/vX` tag.

The `test-app` action release cycle is not dependent on the shinytest2
package cycle. When changes are made to the `test-app` action, you
should force-update the current sliding tag version:

``` bash
git tag -f v1 # update historical v1 tag
git tag -f actions/v1 # update sliding tag
git push --tags --force # push tag to github
```

# License

The scripts and documentation in this project are released under the
Expand Down
2 changes: 1 addition & 1 deletion actions/test-app/example-test-app-description.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ jobs:
extra-packages:
shinytest2

- uses: rstudio/shinytest2/actions/test-app@v1
- uses: rstudio/shinytest2/actions/test-app@actions/v1
with:
app-dir: "."
2 changes: 1 addition & 1 deletion actions/test-app/example-test-app-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ jobs:
local::.
shinytest2

- uses: rstudio/shinytest2/actions/test-app@v1
- uses: rstudio/shinytest2/actions/test-app@actions/v1
with:
app-dir: "."
4 changes: 2 additions & 2 deletions actions/test-app/example-test-app-renv.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Workflow derived from https://github.com/rstudio/shinytest2/tree/main/actions/test-app/example-test-app-description.yaml
# Workflow derived from https://github.com/rstudio/shinytest2/tree/main/actions/test-app/example-test-app-renv.yaml
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
Expand Down Expand Up @@ -37,6 +37,6 @@ jobs:

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

- uses: rstudio/shinytest2/actions/test-app@v1
- uses: rstudio/shinytest2/actions/test-app@actions/v1
with:
app-dir: "."
18 changes: 14 additions & 4 deletions vignettes/use-ci.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,15 @@ The files that you will need to add are described below.

### `check-app.yaml`

This file contains information for GitHub Actions to build and test your application. It should look similar to this:
This file contains information for GitHub Actions to build and test your application.
You can easily set up this action in your repo with help from the [usethis package][usethis]:
```r
usethis::use_github_action(
url = "https://github.com/rstudio/shinytest2/raw/main/actions/test-app/example-test-app-renv.yaml",
save_as = "check-app.yaml"
)
```
It should look similar to this:

```yml
# Workflow derived from https://github.com/rstudio/shinytest2/tree/main/actions/test-app/example-test-app-description.yaml
Expand Down Expand Up @@ -113,10 +121,9 @@ jobs:

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

- uses: rstudio/shinytest2/actions/test-app@v1
- uses: rstudio/shinytest2/actions/test-app@actions/v1
with:
app-dir: "."
upload-snapshots: true
```
You should change the `os` and `r` version to whatever operating system and R version is being used on the platform that your application will be deployed to.
Expand Down Expand Up @@ -204,7 +211,7 @@ For a repository with this structure, the configuration is largely the same as a
The `check-app.yaml` have all App dir locations supplied to `app-dir` using the multiline yaml string syntax.

```yaml
- uses: rstudio/shinytest2/actions/test-app@v1
- uses: rstudio/shinytest2/actions/test-app@actions/v1
with:
app-dir: |
01_hello
Expand Down Expand Up @@ -273,3 +280,6 @@ This tells GitHub to install the `{shiny}` package from the `main` branch of htt
# Example workflows

To view example workflows and more description about the `test-app` GitHub Actions step, please see https://github.com/rstudio/shinytest2/tree/main/actions/test-app for more information examples.


[usethis]: https://usethis.r-lib.org

0 comments on commit 799b11c

Please sign in to comment.