Browse code

change actions

Zuguang Gu authored on 01/07/2021 13:40:44
Showing 1 changed files

... ...
@@ -14,12 +14,54 @@ name: R-CMD-check
14 14
 
15 15
 jobs:
16 16
   R-CMD-check:
17
-    runs-on: macOS-latest
17
+    runs-on: ${{ matrix.config.os }}
18
+
19
+    name: ${{ matrix.config.os }} (${{ matrix.config.r }})
20
+
21
+    strategy:
22
+      fail-fast: false
23
+      matrix:
24
+        config:
25
+          - {os: windows-latest, r: 'release'}
26
+          - {os: macOS-latest, r: 'release'}
27
+          - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
28
+          - {os: ubuntu-20.04,   r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", http-user-agent: "R/4.1.0 (ubuntu-20.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
29
+
18 30
     env:
31
+      R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
32
+      RSPM: ${{ matrix.config.rspm }}
19 33
       GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
34
+
20 35
     steps:
21 36
       - uses: actions/checkout@v2
37
+
22 38
       - uses: r-lib/actions/setup-r@v1
39
+        with:
40
+          r-version: ${{ matrix.config.r }}
41
+
42
+      - uses: r-lib/actions/setup-pandoc@v1
43
+
44
+      - name: Query dependencies
45
+        run: |
46
+          install.packages('remotes')
47
+          saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
48
+          writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
49
+        shell: Rscript {0}
50
+
51
+      - name: Restore R package cache
52
+        uses: actions/cache@v2
53
+        with:
54
+          path: ${{ env.R_LIBS_USER }}
55
+          key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
56
+          restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
57
+
58
+      - name: Install system dependencies
59
+        if: runner.os == 'Linux'
60
+        run: |
61
+          while read -r cmd
62
+          do
63
+            eval sudo $cmd
64
+          done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
23 65
       - name: Install X11 dependencies on MacOS
24 66
         if: runner.os == 'macOS'
25 67
         run: |
... ...
@@ -27,11 +69,21 @@ jobs:
27 69
       - name: Install dependencies
28 70
         run: |
29 71
           setRepositories(ind = 1:5)
30
-          install.packages(c("remotes", "rcmdcheck"))
31 72
           remotes::install_deps(dependencies = TRUE)
73
+          remotes::install_cran("rcmdcheck")
32 74
         shell: Rscript {0}
75
+
33 76
       - name: Check
77
+        env:
78
+          _R_CHECK_CRAN_INCOMING_REMOTE_: false
34 79
         run: |
35 80
           options(crayon.enabled = TRUE)
36
-          rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error")
81
+          rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
37 82
         shell: Rscript {0}
83
+
84
+      - name: Upload check results
85
+        if: failure()
86
+        uses: actions/upload-artifact@main
87
+        with:
88
+          name: ${{ runner.os }}-r${{ matrix.config.r }}-results
89
+          path: check