8 name: ${{ matrix.lesson-name }} (${{ matrix.os-name }})
9 if: github.repository == 'carpentries/styles'
10 runs-on: ${{ matrix.os }}
14 lesson: [swcarpentry/shell-novice, datacarpentry/r-intro-geospatial, librarycarpentry/lc-git]
15 os: [ubuntu-latest, macos-latest, windows-latest]
23 - lesson: swcarpentry/shell-novice
24 lesson-name: (SWC) Shell novice
25 - lesson: datacarpentry/r-intro-geospatial
26 lesson-name: (DC) R Intro Geospatial
27 - lesson: librarycarpentry/lc-git
28 lesson-name: (LC) Intro to Git
31 shell: bash # forces 'Git for Windows' on Windows
33 RSPM: 'https://packagemanager.rstudio.com/cran/__linux__/bionic/latest'
36 uses: actions/setup-ruby@main
41 uses: actions/setup-python@v2
45 - name: Install GitHub Pages, Bundler, and kramdown gems
47 gem install github-pages bundler kramdown
49 - name: Install Python modules
51 if [[ $RUNNER_OS == macOS || $RUNNER_OS == Linux ]]; then
52 python3 -m pip install --upgrade pip setuptools wheel pyyaml==5.3.1 requests
53 elif [[ $RUNNER_OS == Windows ]]; then
54 python -m pip install --upgrade pip setuptools wheel pyyaml==5.3.1 requests
57 - name: Checkout the ${{ matrix.lesson }} lesson
58 uses: actions/checkout@master
60 repository: ${{ matrix.lesson }}
64 - name: Determine the proper reference to use
67 if [[ -n "${{ github.event.pull_request.number }}" ]]; then
68 echo "::set-output name=ref::refs/pull/${{ github.event.pull_request.number }}/head"
70 echo "::set-output name=ref::gh-pages"
73 - name: Sync lesson with carpentries/styles
74 working-directory: lesson
76 git config --global user.email "team@carpentries.org"
77 git config --global user.name "The Carpentries Bot"
78 git remote add styles https://github.com/carpentries/styles.git
79 git config --local remote.styles.tagOpt --no-tags
80 git fetch styles ${{ steps.styles-ref.outputs.ref }}:styles-ref
81 git merge -s recursive -Xtheirs --no-commit styles-ref
82 git commit -m "Sync lesson with carpentries/styles"
84 - name: Look for R-markdown files
86 working-directory: lesson
88 echo "::set-output name=count::$(shopt -s nullglob; files=($(find . -iname '*.Rmd')); echo ${#files[@]})"
91 if: steps.check-rmd.outputs.count != 0
92 uses: r-lib/actions/setup-r@master
96 - name: Install needed packages
97 if: steps.check-rmd.outputs.count != 0
99 install.packages(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'))
102 - name: Query dependencies
103 if: steps.check-rmd.outputs.count != 0
104 working-directory: lesson
106 source('bin/dependencies.R')
107 deps <- identify_dependencies()
108 create_description(deps)
109 saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
110 writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
113 - name: Cache R packages
114 if: runner.os != 'Windows' && steps.check-rmd.outputs.count != 0
115 uses: actions/cache@v1
117 path: ${{ env.R_LIBS_USER }}
118 key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
119 restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
121 - name: Install system dependencies for R packages
122 if: runner.os == 'Linux' && steps.check-rmd.outputs.count != 0
123 working-directory: lesson
128 done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "18.04"), sep = "\n")')
131 working-directory: lesson