88 name : ${{ matrix.lesson-name }} (${{ matrix.os-name }})
99 if : github.repository == 'carpentries/styles'
1010 runs-on : ${{ matrix.os }}
11+ continue-on-error : ${{ matrix.experimental }}
1112 strategy :
1213 fail-fast : false
1314 matrix :
1415 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]
1618 include :
17- - os : ubuntu-latest
18- os-name : Ubuntu
19+ - os : ubuntu-20.04
20+ os-name : Linux
1921 - os : macos-latest
2022 os-name : macOS
2123 - os : windows-latest
@@ -26,16 +28,27 @@ jobs:
2628 lesson-name : (DC) R Intro Geospatial
2729 - lesson : librarycarpentry/lc-git
2830 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
2941 defaults :
3042 run :
3143 shell : bash # forces 'Git for Windows' on Windows
3244 env :
33- RSPM : ' https://packagemanager.rstudio.com/cran/__linux__/bionic /latest'
45+ RSPM : ' https://packagemanager.rstudio.com/cran/__linux__/focal /latest'
3446 steps :
3547 - name : Set up Ruby
36- uses : actions /setup-ruby@v1
48+ uses : ruby /setup-ruby@v1
3749 with :
3850 ruby-version : ' 2.7'
51+ bundler-cache : true
3952
4053 - name : Set up Python
4154 uses : actions/setup-python@v2
4457
4558 - name : Install GitHub Pages, Bundler, and kramdown gems
4659 run : |
47- gem install github-pages bundler kramdown
60+ gem install github-pages bundler kramdown kramdown-parser-gfm
4861
4962 - name : Install Python modules
5063 run : |
@@ -61,25 +74,54 @@ jobs:
6174 path : lesson
6275 fetch-depth : 0
6376
64- - name : Determine the proper reference to use
65- id : styles-ref
77+ - name : Sync lesson with carpentries/styles
78+ working-directory : lesson
6679 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"
6984 else
70- echo "::set-output name= ref:: gh-pages"
85+ ref=" gh-pages"
7186 fi
7287
73- - name : Sync lesson with carpentries/styles
74- working-directory : lesson
75- run : |
7688 git config --global user.email "[email protected] " 7789 git config --global user.name "The Carpentries Bot"
90+
7891 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::"
83125
84126 - name : Look for R-markdown files
85127 id : check-rmd
96138 - name : Install needed packages
97139 if : steps.check-rmd.outputs.count != 0
98140 run : |
99- install.packages(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'))
141+ packages = setdiff(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'), rownames(installed.packages()))
142+ install.packages(packages, repo="https://cran.rstudio.com/")
100143 shell : Rscript {0}
101144
102145 - name : Query dependencies
@@ -118,14 +161,22 @@ jobs:
118161 key : ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
119162 restore-keys : ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
120163
164+ - name : Install stringi from source
165+ if : runner.os == 'Linux' && steps.check-rmd.outputs.count != 0
166+ run : install.packages('stringi', repos='https://cloud.r-project.org')
167+ shell : Rscript {0}
168+
121169 - name : Install system dependencies for R packages
122170 if : runner.os == 'Linux' && steps.check-rmd.outputs.count != 0
123171 working-directory : lesson
124172 run : |
125173 while read -r cmd
126174 do
127175 eval sudo $cmd
128- done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "18 .04"), sep = "\n")')
176+ done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "20 .04"), sep = "\n")')
129177
130178 - run : make site
131179 working-directory : lesson
180+
181+ - run : make lesson-check-all
182+ working-directory : lesson
0 commit comments