Skip to content

Commit

Permalink
Merge remote-tracking branch 'styles/gh-pages' into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Dec 18, 2020
2 parents ecc39f6 + c6bb9e6 commit 4d236cd
Show file tree
Hide file tree
Showing 21 changed files with 332 additions and 132 deletions.
14 changes: 14 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"files": [
"README.md",
"_includes/authors.html"
],
"projectName": "test-module",
"projectOwner": "hsf-training",
"repoType": "github",
"repoHost": "https://github.com",
"skipCi": true,
"contributors": [
],
"contributorsPerLine": 7
}
11 changes: 6 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

Thanks for contributing! :heart:

If this contribution is for instructor training, please email the link to this contribution to
checkout@carpentries.org so we can record your progress. You've completed your contribution
step for instructor checkout by submitting this contribution!

Keep in mind that **lesson maintainers are volunteers** and it may take them some time to
respond to your contribution. Although not all contributions can be incorporated into the lesson
respond to your contribution.

To ensure that someone gets notified, you can also click on "Request a review" and add
the suggested person.

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 HSF training convenors.
Expand Down
77 changes: 42 additions & 35 deletions .github/workflows/template.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
name: Template
name: Test template
on:
push:
branches: gh-pages
pull_request:
jobs:
check-template:
name: Test lesson template
if: github.repository == 'carpentries/styles'
name: ${{ matrix.lesson-name }} (${{ matrix.os-name }})
if: github.repository == 'hsf-training/hsf-styles'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
lesson: [swcarpentry/shell-novice, datacarpentry/r-intro-geospatial, librarycarpentry/lc-git]
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
os-name: Ubuntu
- os: macos-latest
os-name: macOS
- os: windows-latest
os-name: Windows
- lesson: swcarpentry/shell-novice
lesson-name: (SWC) Shell novice
- lesson: datacarpentry/r-intro-geospatial
lesson-name: (DC) R Intro Geospatial
- lesson: librarycarpentry/lc-git
lesson-name: (LC) Intro to Git
defaults:
run:
shell: bash # forces 'Git for Windows' on Windows
env:
RSPM: 'https://packagemanager.rstudio.com/cran/__linux__/bionic/latest'
steps:
- name: Set up Ruby
uses: actions/setup-ruby@main
uses: actions/setup-ruby@v1
with:
ruby-version: '2.7.1'
ruby-version: '2.7'

- name: Set up Python
uses: actions/setup-python@v2
Expand All @@ -46,6 +61,26 @@ jobs:
path: lesson
fetch-depth: 0

- name: Determine the proper reference to use
id: styles-ref
run: |
if [[ -n "${{ github.event.pull_request.number }}" ]]; then
echo "::set-output name=ref::refs/pull/${{ github.event.pull_request.number }}/head"
else
echo "::set-output name=ref::gh-pages"
fi
- name: Sync lesson with carpentries/styles
working-directory: lesson
run: |
git config --global user.email "team@carpentries.org"
git config --global user.name "The Carpentries Bot"
git remote add styles https://github.com/carpentries/styles.git
git config --local remote.styles.tagOpt --no-tags
git fetch styles ${{ steps.styles-ref.outputs.ref }}:styles-ref
git merge -s recursive -Xtheirs --no-commit styles-ref
git commit -m "Sync lesson with carpentries/styles"
- name: Look for R-markdown files
id: check-rmd
working-directory: lesson
Expand All @@ -61,7 +96,7 @@ jobs:
- name: Install needed packages
if: steps.check-rmd.outputs.count != 0
run: |
install.packages(c('remotes', 'rprojroot', 'renv', 'desc'))
install.packages(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'))
shell: Rscript {0}

- name: Query dependencies
Expand Down Expand Up @@ -89,36 +124,8 @@ jobs:
run: |
while read -r cmd
do
eval $cmd
eval sudo $cmd
done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "18.04"), sep = "\n")')
- name: Install R lessons package dependencies
if: steps.check-rmd.outputs.count != 0
working-directory: lesson
run: |
remotes::install_deps(dependencies = TRUE)
file.remove("DESCRIPTION")
shell: Rscript {0}

- name: Determine the proper reference to use
id: styles-ref
run: |
if [[ -n "${{ github.event.pull_request.number }}" ]]; then
echo "::set-output name=ref::refs/pull/${{ github.event.pull_request.number }}/head"
else
echo "::set-output name=ref::gh-pages"
fi
- name: Sync lesson with carpentries/styles
working-directory: lesson
run: |
git config --global user.email "team@carpentries.org"
git config --global user.name "The Carpentries Bot"
git remote add styles https://github.com/carpentries/styles.git
git config --local remote.styles.tagOpt --no-tags
git fetch styles ${{ steps.styles-ref.outputs.ref }}:styles-ref
git merge -s recursive -Xtheirs --no-commit styles-ref
git commit -m "Sync lesson with carpentries/styles"
- run: make site
working-directory: lesson
85 changes: 85 additions & 0 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Website
on:
push:
branches: gh-pages
pull_request: []
jobs:
build-website:
if: ${{ !endsWith(github.repository, '/hsf-styles') }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: '2.7'

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install GitHub Pages, Bundler, and kramdown gems
run: |
gem install github-pages bundler kramdown
- name: Install Python modules
run: |
python3 -m pip install --upgrade pip setuptools wheel pyyaml==5.3.1 requests
- name: Checkout the lesson
uses: actions/checkout@master
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Look for R-markdown files
id: check-rmd
run: |
echo "::set-output name=count::$(shopt -s nullglob; files=($(find . -iname '*.Rmd')); echo ${#files[@]})"
- name: Set up R
if: steps.check-rmd.outputs.count != 0
uses: r-lib/actions/setup-r@master
with:
r-version: 'release'

- name: Install needed packages
if: steps.check-rmd.outputs.count != 0
run: |
install.packages(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'))
shell: Rscript {0}

- name: Query dependencies
if: steps.check-rmd.outputs.count != 0
run: |
source('bin/dependencies.R')
deps <- identify_dependencies()
create_description(deps)
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

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

- name: Install system dependencies for R packages
if: steps.check-rmd.outputs.count != 0
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "18.04"), sep = "\n")')
- run: make site
- run: make lesson-check
if: always()
- run: make lesson-check-all
if: always()
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.ipynb_checkpoints
.sass-cache
.jekyll-cache/
.jekyll-metadata
__pycache__
_site
.Rproj.user
Expand Down
25 changes: 25 additions & 0 deletions 404.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
layout: base
root: .
permalink: 404.html
title: "Page not found"
---

# Oops! We can't find that page.
{: style="text-align: center;"}

> ## Our apologies!
>
> We can't seem to find the page you're looking for.
> Try going back to the <a href="javascript:history.back()">previous page</a> or
> navigate to any other page using the navigation bar above
> {%- if site.kind == "lesson" -%} or the schedule below {%- endif -%}.
> If you got here by clicking on a link in the
> {%- if site.kind == "lesson" -%} lesson {%- else -%} workshop {%- endif -%},
> please report this link to the
> {%- if site.kind == "lesson" -%} lesson developers {%- else -%} workshop organizers {%- endif -%}.
{: .caution}

{% if site.kind == "lesson" %}
{% include syllabus.html %}
{% endif%}
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

source 'https://rubygems.org'

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

# Synchronize with https://pages.github.com/versions
# ruby '>=2.5.8'
ruby '>=2.5.5'

gem 'github-pages', group: :jekyll_plugins

12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ endif


# Controls
.PHONY : commands clean files install-rmd-deps
.PHONY : commands clean files

# Default target
.DEFAULT_GOAL := commands
Expand Down Expand Up @@ -93,10 +93,10 @@ workshop-check :
## III. Commands specific to lesson websites
## =================================================

.PHONY : lesson-check lesson-md lesson-files lesson-fixme
.PHONY : lesson-check lesson-md lesson-files lesson-fixme install-rmd-deps

# RMarkdown files
RMD_SRC = $(wildcard _episodes_rmd/??-*.Rmd)
RMD_SRC = $(wildcard _episodes_rmd/*.Rmd)
RMD_DST = $(patsubst _episodes_rmd/%.Rmd,_episodes/%.md,$(RMD_SRC))

# Lesson source files in the order they appear in the navigation menu.
Expand All @@ -115,18 +115,18 @@ HTML_DST = \
${DST}/conduct/index.html \
${DST}/setup/index.html \
$(patsubst _episodes/%.md,${DST}/%/index.html,$(sort $(wildcard _episodes/*.md))) \
${DST}/reference/index.html \
${DST}/reference.html \
$(patsubst _extras/%.md,${DST}/%/index.html,$(sort $(wildcard _extras/*.md))) \
${DST}/license/index.html

## * install-rmd-deps : Install R packages dependencies to build the RMarkdown lesson
install-rmd-deps:
Rscript -e 'source("bin/dependencies.R"); install_dependencies(identify_dependencies())'
@${SHELL} bin/install_r_deps.sh

## * lesson-md : convert Rmarkdown files to markdown
lesson-md : ${RMD_DST}

_episodes/%.md: _episodes_rmd/%.Rmd install-rmd-dependencies
_episodes/%.md: _episodes_rmd/%.Rmd install-rmd-deps
@mkdir -p _episodes
@bin/knit_lessons.sh $< $@

Expand Down
11 changes: 11 additions & 0 deletions _includes/authors.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<h2>Authors</h2>
The following people contributed to the content of this lesson:
<div class="author-table">
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
</div>
Note that this list does not include the contributors to the framework.
2 changes: 1 addition & 1 deletion _includes/lesson_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
/
<a href="{{ repo_url }}/blob/{{ source_branch }}/CITATION" data-checker-ignore>Cite</a>
/
<a href="mailto:{{ site.email }}">Contact</a>
<a href="mailto:{{ site.email }}">Contact (public mailing list)</a>
</div>
</div>
<div class="row">
Expand Down
2 changes: 1 addition & 1 deletion _includes/workshop_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h4>
</div>
<div class="col-md-6" align="right">
<h4>
<a href="mailto:{{ site.email }}">Contact The Carpentries</a>
<a href="mailto:{{ site.email }}">Contact (public mailing list)</a>
</h4>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions _layouts/lesson.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@
{{ content }}
</article>
{% include syllabus.html %}
{% if site.show_authors %}
<article>
{% include authors.html %}
</article>
{% endif %}
Loading

0 comments on commit 4d236cd

Please sign in to comment.