8
8
name : ${{ matrix.lesson-name }} (${{ matrix.os-name }})
9
9
if : github.repository == 'carpentries/styles'
10
10
runs-on : ${{ matrix.os }}
11
+ continue-on-error : ${{ matrix.experimental }}
11
12
strategy :
12
13
fail-fast : false
13
14
matrix :
14
15
lesson : [swcarpentry/shell-novice, datacarpentry/r-intro-geospatial, librarycarpentry/lc-git]
15
- os : [ubuntu-latest, macos-latest, windows-latest]
16
+ os : [ubuntu-20.04, macos-latest, windows-latest]
17
+ experimental : [false]
16
18
include :
17
- - os : ubuntu-latest
18
- os-name : Ubuntu
19
+ - os : ubuntu-20.04
20
+ os-name : Linux
19
21
- os : macos-latest
20
22
os-name : macOS
21
23
- os : windows-latest
@@ -26,16 +28,27 @@ jobs:
26
28
lesson-name : (DC) R Intro Geospatial
27
29
- lesson : librarycarpentry/lc-git
28
30
lesson-name : (LC) Intro to Git
31
+ - lesson : datacarpentry/astronomy-python
32
+ lesson-name : (DC) Foundations of Astronomical Data Science
33
+ experimental : true
34
+ os : ubuntu-20.04
35
+ os-name : Linux
36
+ - lesson : carpentries/lesson-example
37
+ lesson-name : (CP) Lesson Example
38
+ experimental : false
39
+ os : ubuntu-20.04
40
+ os-name : Linux
29
41
defaults :
30
42
run :
31
43
shell : bash # forces 'Git for Windows' on Windows
32
44
env :
33
- RSPM : ' https://packagemanager.rstudio.com/cran/__linux__/bionic /latest'
45
+ RSPM : ' https://packagemanager.rstudio.com/cran/__linux__/focal /latest'
34
46
steps :
35
47
- name : Set up Ruby
36
- uses : actions /setup-ruby@v1
48
+ uses : ruby /setup-ruby@v1
37
49
with :
38
50
ruby-version : ' 2.7'
51
+ bundler-cache : true
39
52
40
53
- name : Set up Python
41
54
uses : actions/setup-python@v2
44
57
45
58
- name : Install GitHub Pages, Bundler, and kramdown gems
46
59
run : |
47
- gem install github-pages bundler kramdown
60
+ gem install github-pages bundler kramdown kramdown-parser-gfm
48
61
49
62
- name : Install Python modules
50
63
run : |
@@ -61,25 +74,54 @@ jobs:
61
74
path : lesson
62
75
fetch-depth : 0
63
76
64
- - name : Determine the proper reference to use
65
- id : styles-ref
77
+ - name : Sync lesson with carpentries/styles
78
+ working-directory : lesson
66
79
run : |
67
- if [[ -n "${{ github.event.pull_request.number }}" ]]; then
68
- echo "::set-output name=ref::refs/pull/${{ github.event.pull_request.number }}/head"
80
+ echo "::group::Fetch Styles"
81
+ if [[ -n "${{ github.event.pull_request.number }}" ]]
82
+ then
83
+ ref="refs/pull/${{ github.event.pull_request.number }}/head"
69
84
else
70
- echo "::set-output name= ref:: gh-pages"
85
+ ref=" gh-pages"
71
86
fi
72
87
73
- - name : Sync lesson with carpentries/styles
74
- working-directory : lesson
75
- run : |
76
88
git config --global user.email "team@carpentries.org"
77
89
git config --global user.name "The Carpentries Bot"
90
+
78
91
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"
92
+ git fetch styles $ref:styles-ref
93
+ echo "::endgroup::"
94
+ echo "::group::Synchronize Styles"
95
+ # Sync up only if necessary
96
+ if [[ $(git rev-list --count HEAD..styles-ref) != 0 ]]
97
+ then
98
+
99
+ # The merge command below might fail for lessons that use remote theme
100
+ # https://github.com/carpentries/carpentries-theme
101
+ echo "Testing merge using recursive strategy, accepting upstream changes without committing"
102
+ if ! git merge -s recursive -Xtheirs --no-commit styles-ref
103
+ then
104
+
105
+ # Remove "deleted by us, unmerged" files from the staging area.
106
+ # these are the files that were removed from the lesson
107
+ # but are still present in the carpentries/styles repo
108
+ echo "Removing previously deleted files"
109
+ git rm $(git diff --name-only --diff-filter=DU)
110
+
111
+ # If there are still "unmerged" files,
112
+ # let's raise an error and look into this more closely
113
+ if [[ -n $(git diff --name-only --diff-filter=U) ]]
114
+ then
115
+ echo "There were unmerged files in ${{ matrix.lesson-name }}:"
116
+ echo "$(git diff --compact-summary --diff-filter=U)"
117
+ exit 1
118
+ fi
119
+ fi
120
+
121
+ echo "Committing changes"
122
+ git commit -m "Sync lesson with carpentries/styles"
123
+ fi
124
+ echo "::endgroup::"
83
125
84
126
- name : Look for R-markdown files
85
127
id : check-rmd
@@ -96,8 +138,10 @@ jobs:
96
138
97
139
- name : Install needed packages
98
140
if : steps.check-rmd.outputs.count != 0
141
+ working-directory : lesson
99
142
run : |
100
- install.packages(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'))
143
+ source('bin/dependencies.R')
144
+ install_required_packages(.libPaths()[1])
101
145
shell : Rscript {0}
102
146
103
147
- name : Query dependencies
@@ -107,26 +151,35 @@ jobs:
107
151
source('bin/dependencies.R')
108
152
deps <- identify_dependencies()
109
153
create_description(deps)
154
+ use_bioc_repos()
110
155
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
111
156
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
112
157
shell : Rscript {0}
113
158
114
- - name : Cache R packages
159
+ - name : Restore Package Cache
115
160
if : runner.os != 'Windows' && steps.check-rmd.outputs.count != 0
116
- uses : actions/cache@v1
161
+ uses : actions/cache@v2
117
162
with :
118
163
path : ${{ env.R_LIBS_USER }}
119
164
key : ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
120
165
restore-keys : ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
121
166
167
+ - name : Install stringi from source
168
+ if : runner.os == 'Linux' && steps.check-rmd.outputs.count != 0
169
+ run : install.packages('stringi', repos='https://cloud.r-project.org')
170
+ shell : Rscript {0}
171
+
122
172
- name : Install system dependencies for R packages
123
173
if : runner.os == 'Linux' && steps.check-rmd.outputs.count != 0
124
174
working-directory : lesson
125
175
run : |
126
176
while read -r cmd
127
177
do
128
- eval sudo $cmd
129
- done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "18 .04"), sep = "\n")')
178
+ eval sudo $cmd || echo "Nothing to update"
179
+ done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "20 .04"), sep = "\n")')
130
180
131
181
- run : make site
132
182
working-directory : lesson
183
+
184
+ - run : make lesson-check-all
185
+ working-directory : lesson
0 commit comments