Skip to content

Commit 55aa14d

Browse files
authored
Merge pull request #144 from LibraryCarpentry/update-styles-2022-02-15
update styles 2022 02 15
2 parents c6b12bf + 2d4a963 commit 55aa14d

56 files changed

Lines changed: 1804 additions & 541 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.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/ISSUE_TEMPLATE.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1-
Please delete this line and the text below before submitting your contribution.
1+
<details>
2+
<summary><strong>Instructions</strong></summary>
23

3-
---
4+
Thanks for contributing! :heart:
45

5-
Thanks for contributing! If this contribution is for instructor training, please send an email to checkout@carpentries.org with a link to this contribution so we can record your progress. You’ve completed your contribution step for instructor checkout just by submitting this contribution.
6+
If this contribution is for instructor training, please email the link to this contribution to
7+
checkout@carpentries.org so we can record your progress. You've completed your contribution
8+
step for instructor checkout by submitting this contribution!
69

710
If this issue is about a specific episode within a lesson, please provide its link or filename.
811

9-
Please keep in mind that lesson maintainers are volunteers and it may be some time before they can respond to your contribution. Although not all contributions can be incorporated into the lesson materials, we appreciate your time and effort to improve the curriculum. If you have any questions about the lesson maintenance process or would like to volunteer your time as a contribution reviewer, please contact The Carpentries Team at team@carpentries.org.
12+
Keep in mind that **lesson maintainers are volunteers** and it may take them some time to
13+
respond to your contribution. Although not all contributions can be incorporated into the lesson
14+
materials, we appreciate your time and effort to improve the curriculum. If you have any questions
15+
about the lesson maintenance process or would like to volunteer your time as a contribution
16+
reviewer, please contact The Carpentries Team at team@carpentries.org.
1017

11-
---
18+
You may delete these instructions from your comment.
19+
20+
\- The Carpentries
21+
</details>

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1-
Please delete this line and the text below before submitting your contribution.
1+
<details>
2+
<summary><strong>Instructions</strong></summary>
23

3-
---
4+
Thanks for contributing! :heart:
45

5-
Thanks for contributing! If this contribution is for instructor training, please send an email to checkout@carpentries.org with a link to this contribution so we can record your progress. You’ve completed your contribution step for instructor checkout just by submitting this contribution.
6+
If this contribution is for instructor training, please email the link to this contribution to
7+
instructor.training@carpentries.org so we can record your progress. You've completed your contribution
8+
step for instructor checkout by submitting this contribution!
69

7-
Please keep in mind that lesson maintainers are volunteers and it may be some time before they can respond to your contribution. Although not all contributions can be incorporated into the lesson materials, we appreciate your time and effort to improve the curriculum. If you have any questions about the lesson maintenance process or would like to volunteer your time as a contribution reviewer, please contact The Carpentries Team at team@carpentries.org.
10+
Keep in mind that **lesson maintainers are volunteers** and it may take them some time to
11+
respond to your contribution. Although not all contributions can be incorporated into the lesson
12+
materials, we appreciate your time and effort to improve the curriculum. If you have any questions
13+
about the lesson maintenance process or would like to volunteer your time as a contribution
14+
reviewer, please contact The Carpentries Team at team@carpentries.org.
815

9-
---
16+
You may delete these instructions from your comment.
17+
18+
\- The Carpentries
19+
</details>

.github/workflows/template.yml

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
name: Test template
2+
on:
3+
push:
4+
branches: gh-pages
5+
pull_request:
6+
jobs:
7+
check-template:
8+
name: ${{ matrix.lesson-name }} (${{ matrix.os-name }})
9+
if: github.repository == 'carpentries/styles'
10+
runs-on: ${{ matrix.os }}
11+
continue-on-error: ${{ matrix.experimental }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
lesson: [swcarpentry/shell-novice, datacarpentry/r-intro-geospatial, librarycarpentry/lc-git]
16+
os: [ubuntu-20.04, macos-latest, windows-latest]
17+
experimental: [false]
18+
include:
19+
- os: ubuntu-20.04
20+
os-name: Linux
21+
- os: macos-latest
22+
os-name: macOS
23+
- os: windows-latest
24+
os-name: Windows
25+
- lesson: swcarpentry/shell-novice
26+
lesson-name: (SWC) Shell novice
27+
- lesson: datacarpentry/r-intro-geospatial
28+
lesson-name: (DC) R Intro Geospatial
29+
- lesson: librarycarpentry/lc-git
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
41+
defaults:
42+
run:
43+
shell: bash # forces 'Git for Windows' on Windows
44+
env:
45+
RSPM: 'https://packagemanager.rstudio.com/cran/__linux__/focal/latest'
46+
steps:
47+
- name: Set up Ruby
48+
uses: ruby/setup-ruby@v1
49+
with:
50+
ruby-version: '2.7'
51+
bundler-cache: true
52+
53+
- name: Set up Python
54+
uses: actions/setup-python@v2
55+
with:
56+
python-version: '3.x'
57+
58+
- name: Install GitHub Pages, Bundler, and kramdown gems
59+
run: |
60+
gem install github-pages bundler kramdown kramdown-parser-gfm
61+
62+
- name: Install Python modules
63+
run: |
64+
if [[ $RUNNER_OS == macOS || $RUNNER_OS == Linux ]]; then
65+
python3 -m pip install --upgrade pip setuptools wheel pyyaml==5.3.1 requests
66+
elif [[ $RUNNER_OS == Windows ]]; then
67+
python -m pip install --upgrade pip setuptools wheel pyyaml==5.3.1 requests
68+
fi
69+
70+
- name: Checkout the ${{ matrix.lesson }} lesson
71+
uses: actions/checkout@master
72+
with:
73+
repository: ${{ matrix.lesson }}
74+
path: lesson
75+
fetch-depth: 0
76+
77+
- name: Sync lesson with carpentries/styles
78+
working-directory: lesson
79+
run: |
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"
84+
else
85+
ref="gh-pages"
86+
fi
87+
88+
git config --global user.email "team@carpentries.org"
89+
git config --global user.name "The Carpentries Bot"
90+
91+
git remote add styles https://github.com/carpentries/styles.git
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::"
125+
126+
- name: Look for R-markdown files
127+
id: check-rmd
128+
working-directory: lesson
129+
run: |
130+
echo "::set-output name=count::$(shopt -s nullglob; files=($(find . -iname '*.Rmd')); echo ${#files[@]})"
131+
132+
- name: Set up R
133+
if: steps.check-rmd.outputs.count != 0
134+
uses: r-lib/actions/setup-r@master
135+
with:
136+
r-version: 'release'
137+
138+
- name: Install needed packages
139+
if: steps.check-rmd.outputs.count != 0
140+
working-directory: lesson
141+
run: |
142+
source('bin/dependencies.R')
143+
install_required_packages(.libPaths()[1])
144+
shell: Rscript {0}
145+
146+
- name: Query dependencies
147+
if: steps.check-rmd.outputs.count != 0
148+
working-directory: lesson
149+
run: |
150+
source('bin/dependencies.R')
151+
deps <- identify_dependencies()
152+
create_description(deps)
153+
use_bioc_repos()
154+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
155+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
156+
shell: Rscript {0}
157+
158+
- name: Restore Package Cache
159+
if: runner.os != 'Windows' && steps.check-rmd.outputs.count != 0
160+
uses: actions/cache@v2
161+
with:
162+
path: ${{ env.R_LIBS_USER }}
163+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
164+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
165+
166+
- name: Install stringi from source
167+
if: runner.os == 'Linux' && steps.check-rmd.outputs.count != 0
168+
run: install.packages('stringi', repos='https://cloud.r-project.org')
169+
shell: Rscript {0}
170+
171+
- name: Install system dependencies for R packages
172+
if: runner.os == 'Linux' && steps.check-rmd.outputs.count != 0
173+
working-directory: lesson
174+
run: |
175+
while read -r cmd
176+
do
177+
eval sudo $cmd || echo "Nothing to update"
178+
done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "20.04"), sep = "\n")')
179+
180+
- run: make site
181+
working-directory: lesson
182+
183+
- run: make lesson-check-all
184+
working-directory: lesson

.github/workflows/website.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Website
2+
on:
3+
push:
4+
branches:
5+
- gh-pages
6+
- main
7+
pull_request: []
8+
jobs:
9+
build-website:
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 }}
15+
defaults:
16+
run:
17+
shell: bash
18+
steps:
19+
- name: Set up Ruby
20+
uses: ruby/setup-ruby@v1
21+
with:
22+
ruby-version: '2.7'
23+
bundler-cache: true
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v2
27+
with:
28+
python-version: '3.x'
29+
30+
- name: Install GitHub Pages, Bundler, and kramdown gems
31+
run: |
32+
gem install github-pages bundler kramdown kramdown-parser-gfm
33+
34+
- name: Install Python modules
35+
run: |
36+
python3 -m pip install --upgrade pip setuptools wheel pyyaml==5.3.1 requests
37+
38+
- name: Checkout the lesson
39+
uses: actions/checkout@master
40+
with:
41+
fetch-depth: 0
42+
ref: ${{ github.event.pull_request.head.sha }}
43+
44+
- name: Look for R-markdown files
45+
id: check-rmd
46+
run: |
47+
echo "::set-output name=count::$(shopt -s nullglob; files=($(find . -iname '*.Rmd')); echo ${#files[@]})"
48+
49+
- name: Set up R
50+
if: steps.check-rmd.outputs.count != 0
51+
uses: r-lib/actions/setup-r@master
52+
with:
53+
r-version: 'release'
54+
55+
- name: Restore R Cache
56+
if: steps.check-rmd.outputs.count != 0
57+
uses: actions/cache@v2
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+
63+
- name: Install needed packages
64+
if: steps.check-rmd.outputs.count != 0
65+
run: |
66+
source('bin/dependencies.R')
67+
install_required_packages()
68+
shell: Rscript {0}
69+
70+
- name: Query dependencies
71+
if: steps.check-rmd.outputs.count != 0
72+
run: |
73+
source('bin/dependencies.R')
74+
deps <- identify_dependencies()
75+
create_description(deps)
76+
use_bioc_repos()
77+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
78+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
79+
shell: Rscript {0}
80+
81+
82+
- name: Install system dependencies for R packages
83+
if: steps.check-rmd.outputs.count != 0
84+
run: |
85+
while read -r cmd
86+
do
87+
eval sudo $cmd || echo "Nothing to update"
88+
done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "20.04"), sep = "\n")')
89+
90+
- name: Render the markdown and confirm that the site can be built
91+
run: make site
92+
93+
- name: Checkout github pages
94+
if: ${{ github.event_name == 'push' && steps.check-rmd.outputs.count != 0 && github.ref != 'refs/heads/gh-pages'}}
95+
uses: actions/checkout@master
96+
with:
97+
ref: gh-pages
98+
path: gh-pages
99+
100+
- name: Commit and Push
101+
if: ${{ github.event_name == 'push' && steps.check-rmd.outputs.count != 0 && github.ref != 'refs/heads/gh-pages'}}
102+
run: |
103+
# clean up gh-pages
104+
cd gh-pages
105+
git rm -rf . # remove all previous files
106+
git restore --staged . # remove things from the stage
107+
cd ..
108+
# copy everything into gh-pages site
109+
cp -r `ls -A | grep -v 'gh-pages' | grep -v '.git' | grep -v '.bundle/' | grep -v '_site'` gh-pages
110+
# move into gh-pages, add, commit, and push
111+
cd gh-pages
112+
# setup git
113+
git config --local user.email "actions@github.com"
114+
git config --local user.name "GitHub Actions"
115+
git add -A .
116+
git commit --allow-empty -m "[Github Actions] render website (via ${{ github.sha }})"
117+
git push origin gh-pages
118+
# return
119+
cd ..
120+
121+
- run: make lesson-check-all
122+
if: always()

.gitignore

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
.DS_Store
44
.ipynb_checkpoints
55
.sass-cache
6+
.jekyll-cache/
7+
.jekyll-metadata
68
__pycache__
79
_site
810
.Rproj.user
911
.Rhistory
1012
.RData
11-
12-
/Gemfile.lock
13+
.bundle/
14+
.vendor/
15+
vendor/
16+
.docker-vendor/
17+
Gemfile.lock
18+
.*history

0 commit comments

Comments
 (0)