From a3269a056937f25046df6ac38cf6db63905f5bb1 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 15 Jul 2022 15:31:22 +0800 Subject: [PATCH] Add R GitHub action file (#12868) * fix travis, update rbuildignore * add comment --- .../codegen/languages/RClientCodegen.java | 1 + .../src/main/resources/r/.travis.yml | 1 + .../main/resources/r/Rbuildignore.mustache | 1 + .../src/main/resources/r/r-client.mustache | 26 +++++++++++++++++++ samples/client/petstore/R/.Rbuildignore | 1 + .../R/.github/workflows/r-client.yaml | 26 +++++++++++++++++++ .../petstore/R/.openapi-generator/FILES | 1 + samples/client/petstore/R/.travis.yml | 1 + 8 files changed, 58 insertions(+) create mode 100644 modules/openapi-generator/src/main/resources/r/r-client.mustache create mode 100644 samples/client/petstore/R/.github/workflows/r-client.yaml diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java index 3401ae3ae3f..9fcf0f4a649 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java @@ -250,6 +250,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig { supportingFiles.add(new SupportingFile("api_client.mustache", File.separator + "R", "api_client.R")); supportingFiles.add(new SupportingFile("NAMESPACE.mustache", "", "NAMESPACE")); supportingFiles.add(new SupportingFile("testthat.mustache", File.separator + "tests", "testthat.R")); + supportingFiles.add(new SupportingFile("r-client.mustache", File.separator + ".github" + File.separator + "workflows", "r-client.yaml")); // add lambda for mustache templates to fix license field additionalProperties.put("lambdaLicense", new Mustache.Lambda() { diff --git a/modules/openapi-generator/src/main/resources/r/.travis.yml b/modules/openapi-generator/src/main/resources/r/.travis.yml index 543bf1463d3..b96a0ef5a85 100644 --- a/modules/openapi-generator/src/main/resources/r/.travis.yml +++ b/modules/openapi-generator/src/main/resources/r/.travis.yml @@ -6,6 +6,7 @@ cache: r_packages: - jsonlite - httr +- testthat # uncomment below to install deps with devtools #install: #- R -e 'devtools::install_deps(dep = T)' diff --git a/modules/openapi-generator/src/main/resources/r/Rbuildignore.mustache b/modules/openapi-generator/src/main/resources/r/Rbuildignore.mustache index b270aa54fb1..b3cedf7751b 100644 --- a/modules/openapi-generator/src/main/resources/r/Rbuildignore.mustache +++ b/modules/openapi-generator/src/main/resources/r/Rbuildignore.mustache @@ -11,6 +11,7 @@ ^\.gitignore$ ^\.openapi-generator-ignore$ ^\.travis\.yml$ +^\.github$ ^\.openapi-generator$ ^docs$ ^git_push\.sh$ diff --git a/modules/openapi-generator/src/main/resources/r/r-client.mustache b/modules/openapi-generator/src/main/resources/r/r-client.mustache new file mode 100644 index 00000000000..567ce17f2fb --- /dev/null +++ b/modules/openapi-generator/src/main/resources/r/r-client.mustache @@ -0,0 +1,26 @@ +# This file is automatically generated by openapi-generator (https://openapi-generator.tech) +# +# Based on https://github.com/r-lib/actions/tree/v2/examples +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: R-CMD-check + +jobs: + R-CMD-check: + runs-on: ubuntu-latest + env: + R_KEEP_PKG_SOURCE: yes + steps: + - uses: actions/checkout@v2 + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + - uses: r-lib/actions/check-r-package@v2 diff --git a/samples/client/petstore/R/.Rbuildignore b/samples/client/petstore/R/.Rbuildignore index e146ddffb84..b87ca497759 100644 --- a/samples/client/petstore/R/.Rbuildignore +++ b/samples/client/petstore/R/.Rbuildignore @@ -11,6 +11,7 @@ ^\.gitignore$ ^\.openapi-generator-ignore$ ^\.travis\.yml$ +^\.github$ ^\.openapi-generator$ ^docs$ ^git_push\.sh$ diff --git a/samples/client/petstore/R/.github/workflows/r-client.yaml b/samples/client/petstore/R/.github/workflows/r-client.yaml new file mode 100644 index 00000000000..567ce17f2fb --- /dev/null +++ b/samples/client/petstore/R/.github/workflows/r-client.yaml @@ -0,0 +1,26 @@ +# This file is automatically generated by openapi-generator (https://openapi-generator.tech) +# +# Based on https://github.com/r-lib/actions/tree/v2/examples +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: R-CMD-check + +jobs: + R-CMD-check: + runs-on: ubuntu-latest + env: + R_KEEP_PKG_SOURCE: yes + steps: + - uses: actions/checkout@v2 + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + - uses: r-lib/actions/check-r-package@v2 diff --git a/samples/client/petstore/R/.openapi-generator/FILES b/samples/client/petstore/R/.openapi-generator/FILES index 3046316ea30..3c5469b531d 100644 --- a/samples/client/petstore/R/.openapi-generator/FILES +++ b/samples/client/petstore/R/.openapi-generator/FILES @@ -1,4 +1,5 @@ .Rbuildignore +.github/workflows/r-client.yaml .gitignore .travis.yml DESCRIPTION diff --git a/samples/client/petstore/R/.travis.yml b/samples/client/petstore/R/.travis.yml index 543bf1463d3..b96a0ef5a85 100644 --- a/samples/client/petstore/R/.travis.yml +++ b/samples/client/petstore/R/.travis.yml @@ -6,6 +6,7 @@ cache: r_packages: - jsonlite - httr +- testthat # uncomment below to install deps with devtools #install: #- R -e 'devtools::install_deps(dep = T)'