Skip to content

Commit

Permalink
Add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Cazelles authored and KevCaz committed Nov 16, 2023
1 parent d55b882 commit a8531aa
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 84 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/R-CMD-build-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release-event-release
on:
release:
types: [published]

name: build-and-release

jobs:
buildRPkgs:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: build archives
run: make rpkgs
- name: Create docker image
run: make docker

buildDocker:
needs: buildRPkgs
runs-on: ubuntu-latest
steps:
- uses: docker/setup-buildx-action@v2
52 changes: 0 additions & 52 deletions .github/workflows/R-CMD-build.yaml

This file was deleted.

11 changes: 2 additions & 9 deletions .github/workflows/R-CMD-check-all.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# see https://github.com/dorny/paths-filter
on:
push:
branches: [main, master]
Expand All @@ -17,7 +16,7 @@ jobs:
packages: ${{ steps.filter.outputs.changes }}
steps:
# For pull requests it's not necessary to checkout the code
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: filter
with:
Expand All @@ -26,7 +25,7 @@ jobs:
testpkg02: 'testpkg02/**'
# JOB to build and test each of modified packages
buildPackages:
checkPackages:
needs: changes
# https://github.com/dorny/paths-filter/issues/66
if: ${{ needs.changes.outputs.packages != '[]' && needs.changes.outputs.packages != '' }}
Expand All @@ -39,9 +38,3 @@ jobs:
secrets: inherit
with:
pkg-path: ${{ matrix.package }}

buildDocker:
runs-on: ubuntu-latest
needs: buildPackages
steps:
- uses: docker/setup-buildx-action@v2
5 changes: 1 addition & 4 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
Expand Down Expand Up @@ -50,6 +50,3 @@ jobs:
lint_package(linters = with_defaults(object_name_linter("camelCase"), line_length_linter(160L), object_length_linter(length = 60L)))
shell: Rscript {0}
working-directory: ${{ inputs.pkg-path }}

- name: Build archive
run: R CMD build ${{ inputs.pkg-path }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.tar.gz
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# monoRepoR
Test repo to apply the same worklows on several packages in a mono repo.

Demo repo to apply the same worklows on several packages in a mono repo.


## Generating test packages

```R
# create testpkg01
usethis::create_package("testpkg01") # NB: this prompts a message that requires an answer
## NB: the command line below prompts a message that requires an answer
usethis::create_package("testpkg01")
usethis::use_mit_license()
devtools::load_all()
devtools::document()
Expand Down
11 changes: 4 additions & 7 deletions dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ FROM rocker/r-ubuntu:22.04

RUN apt-get update \
&& apt-get dist-upgrade -y \
&& apt-get install -y \
default-jdk git apt-transport-https gpg-agent openssh-server \
unixodbc unixodbc-dev libaio1 libaio-dev curl netbase \
r-cran-anytime r-cran-cli r-cran-data.table r-cran-dbi r-cran-dplyr \
r-cran-fontawesome
&& apt-get autoremove -y \
&& apt-get autoclean -y
&& apt-get install -y r-cran-anytime

COPY *.tar.gz install_pkg.R ./
RUN Rscript install_pkg.R
2 changes: 2 additions & 0 deletions install_pkg.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pkg <- list.files(path = ".", pattern = "^test*\\.tar\\.gz")
lapply(pkg, install.packages, repos = NULL, type = "source")
6 changes: 6 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
rpkgs:
R CMD build testpkg01
R CMD build testpkg02

docker:
docker build -t ex_custom_docker .
3 changes: 3 additions & 0 deletions testpkg01/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Imports:
datasets,
utils
2 changes: 1 addition & 1 deletion testpkg01/NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Generated by roxygen2: do not edit by hand

export(hello)
export(hello_co2)
5 changes: 0 additions & 5 deletions testpkg01/R/hello.R

This file was deleted.

5 changes: 5 additions & 0 deletions testpkg01/R/hello_co2.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#' Hello world
#' @export
hello_co2 <- function() {
utils::head(datasets::CO2)
}
8 changes: 4 additions & 4 deletions testpkg01/man/hello.Rd → testpkg01/man/hello_co2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a8531aa

Please sign in to comment.