Skip to content

Commit d6c86ba

Browse files
committed
Merge branch 'gh-pages' into image-with-shadow-class
2 parents 1d32319 + 625c55e commit d6c86ba

File tree

15 files changed

+166
-75
lines changed

15 files changed

+166
-75
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ trim_trailing_whitespace = true
99
indent_size = 2
1010
indent_style = space
1111
max_line_length = 100 # Please keep this in sync with bin/lesson_check.py!
12+
trim_trailing_whitespace = false # keep trailing spaces in markdown - 2+ spaces are translated to a hard break (<br/>)
1213

1314
[*.r]
1415
max_line_length = 80

.github/workflows/template.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
lesson: [swcarpentry/shell-novice, datacarpentry/r-intro-geospatial, librarycarpentry/lc-git]
15-
os: [ubuntu-latest, macos-latest, windows-latest]
15+
os: [ubuntu-20.04, macos-latest, windows-latest]
1616
include:
17-
- os: ubuntu-latest
17+
- os: ubuntu-20.04
1818
os-name: Ubuntu
1919
- os: macos-latest
2020
os-name: macOS
@@ -30,12 +30,13 @@ jobs:
3030
run:
3131
shell: bash # forces 'Git for Windows' on Windows
3232
env:
33-
RSPM: 'https://packagemanager.rstudio.com/cran/__linux__/bionic/latest'
33+
RSPM: 'https://packagemanager.rstudio.com/cran/__linux__/focal/latest'
3434
steps:
3535
- name: Set up Ruby
36-
uses: actions/setup-ruby@v1
36+
uses: ruby/setup-ruby@v1
3737
with:
3838
ruby-version: '2.7'
39+
bundler-cache: true
3940

4041
- name: Set up Python
4142
uses: actions/setup-python@v2
@@ -44,7 +45,7 @@ jobs:
4445

4546
- name: Install GitHub Pages, Bundler, and kramdown gems
4647
run: |
47-
gem install github-pages bundler kramdown
48+
gem install github-pages bundler kramdown kramdown-parser-gfm
4849
4950
- name: Install Python modules
5051
run: |
@@ -96,7 +97,8 @@ jobs:
9697
- name: Install needed packages
9798
if: steps.check-rmd.outputs.count != 0
9899
run: |
99-
install.packages(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'))
100+
packages = setdiff(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'), rownames(installed.packages()))
101+
install.packages(packages, repo="https://cran.rstudio.com/")
100102
shell: Rscript {0}
101103

102104
- name: Query dependencies
@@ -118,14 +120,19 @@ jobs:
118120
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
119121
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
120122

123+
- name: Install stringi from source
124+
if: runner.os == 'Linux' && steps.check-rmd.outputs.count != 0
125+
run: install.packages('stringi', repos='https://cloud.r-project.org')
126+
shell: Rscript {0}
127+
121128
- name: Install system dependencies for R packages
122129
if: runner.os == 'Linux' && steps.check-rmd.outputs.count != 0
123130
working-directory: lesson
124131
run: |
125132
while read -r cmd
126133
do
127134
eval sudo $cmd
128-
done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "18.04"), sep = "\n")')
135+
done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "20.04"), sep = "\n")')
129136
130137
- run: make site
131138
working-directory: lesson

.github/workflows/website.yml

Lines changed: 53 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
name: Website
22
on:
33
push:
4-
branches: gh-pages
4+
branches:
5+
- gh-pages
6+
- main
57
pull_request: []
68
jobs:
79
build-website:
8-
if: github.repository != 'carpentries/styles' && (github.repository_owner == 'swcarpentry' || github.repository_owner == 'datacarpentry' || github.repository_owner == 'librarycarpentry' || github.repository_owner == 'carpentries')
9-
runs-on: ubuntu-latest
10+
if: ${{ !endsWith(github.repository, '/styles') }}
11+
runs-on: ubuntu-20.04
12+
env:
13+
RSPM: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"
14+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1015
defaults:
1116
run:
1217
shell: bash
1318
steps:
1419
- name: Set up Ruby
15-
uses: actions/setup-ruby@v1
20+
uses: ruby/setup-ruby@v1
1621
with:
1722
ruby-version: '2.7'
23+
bundler-cache: true
1824

1925
- name: Set up Python
2026
uses: actions/setup-python@v2
@@ -23,7 +29,7 @@ jobs:
2329

2430
- name: Install GitHub Pages, Bundler, and kramdown gems
2531
run: |
26-
gem install github-pages bundler kramdown
32+
gem install github-pages bundler kramdown kramdown-parser-gfm
2733
2834
- name: Install Python modules
2935
run: |
@@ -46,10 +52,19 @@ jobs:
4652
with:
4753
r-version: 'release'
4854

55+
- name: Cache R packages
56+
if: steps.check-rmd.outputs.count != 0
57+
uses: actions/cache@v1
58+
with:
59+
path: ${{ env.R_LIBS_USER }}
60+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
61+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
62+
4963
- name: Install needed packages
5064
if: steps.check-rmd.outputs.count != 0
5165
run: |
52-
install.packages(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'))
66+
packages = setdiff(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'), rownames(installed.packages()))
67+
install.packages(packages, repo="https://cran.rstudio.com/")
5368
shell: Rscript {0}
5469

5570
- name: Query dependencies
@@ -62,24 +77,45 @@ jobs:
6277
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
6378
shell: Rscript {0}
6479

65-
- name: Cache R packages
66-
if: steps.check-rmd.outputs.count != 0
67-
uses: actions/cache@v1
68-
with:
69-
path: ${{ env.R_LIBS_USER }}
70-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
71-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
7280

7381
- name: Install system dependencies for R packages
7482
if: steps.check-rmd.outputs.count != 0
7583
run: |
7684
while read -r cmd
7785
do
7886
eval sudo $cmd
79-
done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "18.04"), sep = "\n")')
87+
done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "20.04"), sep = "\n")')
88+
89+
- name: Render the markdown and confirm that the site can be built
90+
run: make site
91+
92+
- name: Checkout github pages
93+
if: ${{ github.event_name == 'push' && steps.check-rmd.outputs.count != 0 && github.ref != 'refs/heads/gh-pages'}}
94+
uses: actions/checkout@master
95+
with:
96+
ref: gh-pages
97+
path: gh-pages
98+
99+
- name: Commit and Push
100+
if: ${{ github.event_name == 'push' && steps.check-rmd.outputs.count != 0 && github.ref != 'refs/heads/gh-pages'}}
101+
run: |
102+
# clean up gh-pages
103+
cd gh-pages
104+
git rm -rf . # remove all previous files
105+
git restore --staged . # remove things from the stage
106+
cd ..
107+
# copy everything into gh-pages site
108+
cp -r `ls -A | grep -v 'gh-pages' | grep -v '.git' | grep -v '.bundle/' | grep -v '_site'` gh-pages
109+
# move into gh-pages, add, commit, and push
110+
cd gh-pages
111+
# setup git
112+
git config --local user.email "actions@github.com"
113+
git config --local user.name "GitHub Actions"
114+
git add -A .
115+
git commit --allow-empty -m "[Github Actions] render website (via ${{ github.sha }})"
116+
git push origin gh-pages
117+
# return
118+
cd ..
80119
81-
- run: make site
82-
- run: make lesson-check
83-
if: always()
84120
- run: make lesson-check-all
85121
if: always()

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
.ipynb_checkpoints
55
.sass-cache
66
.jekyll-cache/
7+
.jekyll-metadata
78
__pycache__
89
_site
910
.Rproj.user

404.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
layout: base
3+
root: .
4+
permalink: 404.html
5+
title: "Page not found"
6+
---
7+
8+
# Oops! We can't find that page.
9+
{: style="text-align: center;"}
10+
11+
> ## Our apologies!
12+
>
13+
> We can't seem to find the page you're looking for.
14+
> Try going back to the <a href="javascript:history.back()">previous page</a> or
15+
> navigate to any other page using the navigation bar above
16+
> {%- if site.kind == "lesson" -%} or the schedule below {%- endif -%}.
17+
> If you got here by clicking on a link in the
18+
> {%- if site.kind == "lesson" -%} lesson {%- else -%} workshop {%- endif -%},
19+
> please report this link to the
20+
> {%- if site.kind == "lesson" -%} lesson developers {%- else -%} workshop organizers {%- endif -%}.
21+
{: .caution}
22+
23+
{% if site.kind == "lesson" %}
24+
{% include syllabus.html %}
25+
{% endif%}

Gemfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
source 'https://rubygems.org'
44

5-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
66

77
# Synchronize with https://pages.github.com/versions
88
ruby '>=2.7.1'
99

1010
gem 'github-pages', group: :jekyll_plugins
11+
12+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0.0')
13+
gem 'webrick', '>= 1.6.1'
14+
end

Makefile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# Settings
55
MAKEFILES=Makefile $(wildcard *.mk)
6-
JEKYLL=bundle config --local set path .vendor/bundle && bundle install && bundle update && bundle exec jekyll
6+
JEKYLL=bundle config set --local path .vendor/bundle && bundle install && bundle update && bundle exec jekyll
77
PARSER=bin/markdown_ast.rb
88
DST=_site
99

@@ -31,15 +31,14 @@ ifeq (,$(PYTHON))
3131
endif
3232

3333

34-
# Controls
35-
.PHONY : commands clean files
36-
3734
# Default target
3835
.DEFAULT_GOAL := commands
3936

4037
## I. Commands for both workshop and lesson websites
4138
## =================================================
4239

40+
.PHONY: site docker-serve repo-check clean clean-rmd
41+
4342
## * serve : render website and run a local server
4443
serve : lesson-md
4544
${JEKYLL} serve
@@ -50,8 +49,8 @@ site : lesson-md
5049

5150
## * docker-serve : use Docker to serve the site
5251
docker-serve :
53-
docker pull carpentries/lesson-docker:latest
54-
docker run --rm -it \
52+
@docker pull carpentries/lesson-docker:latest
53+
@docker run --rm -it \
5554
-v $${PWD}:/home/rstudio \
5655
-p 4000:4000 \
5756
-p 8787:8787 \
@@ -68,6 +67,9 @@ clean :
6867
@rm -rf ${DST}
6968
@rm -rf .sass-cache
7069
@rm -rf bin/__pycache__
70+
@rm -rf .vendor
71+
@rm -rf .bundle
72+
@rm -f Gemfile.lock
7173
@find . -name .DS_Store -exec rm {} \;
7274
@find . -name '*~' -exec rm {} \;
7375
@find . -name '*.pyc' -exec rm {} \;
@@ -96,7 +98,7 @@ workshop-check :
9698
.PHONY : lesson-check lesson-md lesson-files lesson-fixme install-rmd-deps
9799

98100
# RMarkdown files
99-
RMD_SRC = $(wildcard _episodes_rmd/??-*.Rmd)
101+
RMD_SRC = $(wildcard _episodes_rmd/*.Rmd)
100102
RMD_DST = $(patsubst _episodes_rmd/%.Rmd,_episodes/%.md,$(RMD_SRC))
101103

102104
# Lesson source files in the order they appear in the navigation menu.
@@ -128,7 +130,7 @@ lesson-md : ${RMD_DST}
128130

129131
_episodes/%.md: _episodes_rmd/%.Rmd install-rmd-deps
130132
@mkdir -p _episodes
131-
@bin/knit_lessons.sh $< $@
133+
@$(SHELL) bin/knit_lessons.sh $< $@
132134

133135
## * lesson-check : validate lesson Markdown
134136
lesson-check : lesson-fixme
@@ -157,6 +159,8 @@ lesson-fixme :
157159
## IV. Auxililary (plumbing) commands
158160
## =================================================
159161

162+
.PHONY : commands
163+
160164
## * commands : show all commands.
161165
commands :
162166
@sed -n -e '/^##/s|^##[[:space:]]*||p' $(MAKEFILE_LIST)

0 commit comments

Comments
 (0)