Skip to content

Commit 0bf965d

Browse files
authored
Merge pull request #25 from hpc-carpentry/generate_lesson_json
Dynamically pull repo information for HPC lessons
2 parents 47de46d + 377f9a1 commit 0bf965d

13 files changed

+666
-219
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ jobs:
3535
yaml-lint -q -n $(find _posts -regex ".*.md\|.*html") &&\
3636
yaml-lint -q -n $(find pages -regex ".*.md\|.*html")
3737
38-
- name: Get GeoJSON for instructor map
39-
run: |
40-
curl --remote-name-all https://feeds.carpentries.org/all_instructors_by_airport.geojson &&\
41-
cp all_instructors_by_airport.geojson files/.
38+
- name: Setup EESSI to give us an R module
39+
uses: eessi/github-action-eessi@v1
4240

41+
- name: Create repository data files
42+
shell: bash
43+
env:
44+
GITHUB_PAT: ${{ secrets.JEKYLL_PAT }}
45+
run: |
46+
module load R
47+
make data
4348
4449
# - name: Create PDF file of some pages
4550
# uses: docker://pandoc/latex:latest

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ gem 'faraday', '0.17.3'
44

55
group :jekyll_plugins do
66
gem 'github-pages'
7-
gem 'jekyll-get-json', "~> 0.0.2"
7+
# gem 'jekyll-get-json', "~> 0.0.2"
88
end

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ site :
2020
install :
2121
bundle install
2222

23+
## lesson data : pull lesson data from GitHub
24+
# (requires GitHub PAT provided via GITHUB_PAT env var)
25+
data:
26+
R -q -e "source('feeds/hpc-carpentry_lessons.R')"
27+
## help-wanted: list of issues that have the label "help wanted"
28+
R -q -e "source('feeds/help_wanted_issues.R')"
29+
2330
#-------------------------------------------------------------------------------
2431

2532
## clean : clean up junk files.

README.md

Lines changed: 95 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,67 @@
11
![check, build, deploy hpc-carpentry.org](https://github.com/hpc-carpentry/hpc-carpentry.github.io/workflows/check,%20build,%20deploy%20hpc-carpentry.org/badge.svg)
22

33
# The HPC Carpentry Website
4-
## NOTE: THIS IS AN ALPHA CREATION, A CLONE OF THE CARPENTRIES WEBSITE AND MAY NOT BE COMPLETELY CLEANED OF THE CARPENTRIES CONTENT
5-
6-
This is the repository for the [HPC Carpentry website](http://www.hpc-carpentry.org) (and directly based on
7-
the [Carpentries website](https://carpentries.org)).
8-
Please submit additions and fixes as pull requests to [our GitHub repository](https://github.com/hpc-carpentry/hpc-carpentry.github.io).
9-
10-
* [Setup](#setup)
11-
* [Previewing](#previewing)
12-
* [Development](#development)
13-
* [Write a Blog Post](#blog)
14-
* [Create a New Page](#page)
15-
* [Add a Workshop](#workshop)
16-
* [The Details](#details)
17-
18-
Lessons are not stored in this repository:
19-
please see the [HPC Carpentry lessons page](https://hpc-carpentry.org/lessons/), for links to the many individual lesson repositories.
20-
You can find the official Carpentries lessons at [Software Carpentry lessons page](https://software-carpentry.org/lessons/), the [Data Carpentry lessons page](https://datacarpentry.org/lessons/), or the [Library Carpentry lessons page](https://librarycarpentry.org/lessons/).
21-
22-
> HPC Carpentry, like The Carpentries (Software, Data, and Library Carpentry), is an open project,
23-
> and we welcome contributions of all kinds.
24-
> By contributing,
25-
> you are agreeing that The Carpentries may redistribute your work
26-
> under [these licenses](http://software-carpentry.org/license/),
27-
> and to abide by [our code of conduct](http://docs.carpentries.org/topic_folders/policies/code-of-conduct.html).
4+
5+
This is the repository for the [HPC Carpentry website](
6+
http://www.hpc-carpentry.org) (and directly based on the [Carpentries website](
7+
https://carpentries.org)). Please submit additions and fixes as pull requests
8+
to [our GitHub repository](
9+
https://github.com/hpc-carpentry/hpc-carpentry.github.io).
10+
11+
* [Setup](#setup)
12+
* [Previewing](#previewing)
13+
* [Development](#development)
14+
* [Write a Blog Post](#blog)
15+
* [Create a New Page](#page)
16+
* [Add a Workshop](#workshop)
17+
* [The Details](#details)
18+
19+
*Lessons are not stored in this repository.*
20+
Please see the [HPC Carpentry lessons page](
21+
https://hpc-carpentry.org/lessons/), for links to the many individual lesson
22+
repositories. You can find the official Carpentries lessons at the
23+
[Software Carpentry lessons page](https://software-carpentry.org/lessons/), the
24+
[Data Carpentry lessons page](https://datacarpentry.org/lessons/), or the
25+
[Library Carpentry lessons page](https://librarycarpentry.org/lessons/).
26+
27+
> HPC Carpentry, like The Carpentries (Software, Data, and Library Carpentry),
28+
> is an open project, and we welcome contributions of all kinds.
29+
> By contributing, you are agreeing that The Carpentries may redistribute your
30+
> work under [these licenses](http://software-carpentry.org/license/),
31+
> and to abide by [our code of conduct](
32+
> http://docs.carpentries.org/topic_folders/policies/code-of-conduct.html).
2833
2934
## Setup <a name="setup"></a>
3035

31-
The website uses [Jekyll](http://jekyllrb.com/), a static website generator written in Ruby.
32-
You need to have Version 2.7.1 or higher of Ruby and the package manager Bundler.
33-
(The package manager is used to make sure you use exactly the same versions of the Ruby Gems as we do.)
34-
After checking out the repository, please run:
36+
The website uses [Jekyll](http://jekyllrb.com/), a static website generator
37+
written in Ruby. You need to have Version 2.7.1 or higher of Ruby and the
38+
package manager Bundler. (The package manager is used to make sure you use
39+
exactly the same versions of the Ruby Gems as we do.)
40+
After checking out the repository, please install Jekyll and dependencies
41+
by running
3542

3643
```
3744
$ bundle install
3845
```
3946

40-
to install Jekyll and the software it depends on.
41-
You may consult [Using Jekyll with Pages](https://help.github.com/articles/using-jekyll-with-pages/) for further instructions.
47+
You may consult [Using Jekyll with Pages](
48+
https://help.github.com/articles/using-jekyll-with-pages/) for further
49+
instructions.
4250

4351
## Previewing <a name="previewing"></a>
4452

45-
Please do **not** use `jekyll build` or `jekyll serve` directly to build or view the website.
46-
Instead, you should use the following commands:
53+
Please do **not** use `jekyll build` or `jekyll serve` directly to build or
54+
view the website. Instead, you should use the following commands:
4755

48-
* `make` or `make commands`: list available commands.
49-
* `make serve`: build files locally and run a server at [http://0.0.0.0:4000/](http://0.0.0.0:4000/) for viewing.
50-
This is the best way to preview the site.
51-
* `make site`: build files locally, but do not serve them dynamically.
52-
* `make clean` removes the `_site` directory and any Emacs editor backup files littering the source directories.
56+
* `make` or `make commands`: list available commands.
57+
* `make data`: (optionally) generate the dynamic data (see [Data Files](#data)
58+
to see the requirements for this step)
59+
* `make serve`: build files locally and run a server at
60+
[http://0.0.0.0:4000/](http://0.0.0.0:4000/) for viewing. This is the best
61+
way to preview the site.
62+
* `make site`: build files locally, but do not serve them dynamically.
63+
* `make clean` removes the `_site` directory and any Emacs editor backup files
64+
littering the source directories.
5365

5466
The [details](#details) describes a few more advanced commands as well.
5567

@@ -58,13 +70,14 @@ The [details](#details) describes a few more advanced commands as well.
5870

5971
<a name="blog"></a>
6072
To **write a blog post**,
61-
create a file called `_posts/YYYY/MM/YYYY-MM-DD-some-title.html` or `_posts/YYYY/MM/YYYY-MM-DD-some-title.md`
62-
(for HTML and Markdown respectively).
63-
YYYY is the 4-digit year of the post, MM the 2-digit month, and DD the 2-digit day;
64-
`some-title` can be any hyphenated string of words that do not include special characters such as quotes.
73+
create a file called `_posts/YYYY/MM/YYYY-MM-DD-some-title.html` or
74+
`_posts/YYYY/MM/YYYY-MM-DD-some-title.md` (for HTML and Markdown respectively).
75+
YYYY is the 4-digit year of the post, MM the 2-digit month, and DD the 2-digit
76+
day; `some-title` can be any hyphenated string of words that do not include
77+
special characters such as quotes.
6578
Please do *not* use underscores or periods in the names.
66-
When published,
67-
your blog post will appear as `https://hpc-carpentry.org/blog/YYYY/MM/some-title.html`.
79+
When published, your blog post will appear as
80+
`https://hpc-carpentry.org/blog/YYYY/MM/some-title.html`.
6881

6982
The YAML header of a blog post must look like this:
7083

@@ -79,10 +92,10 @@ category: ["Some Category", "Some Other Category"]
7992
---
8093
~~~
8194

82-
where `YYYY-MM-DD` is replaced by the post's date and `hh:mm:ss` by the post's time.
83-
Note that the time *must* be quoted so that the colons it contains do not confuse Jekyll's YAML parser.
84-
Note also that `authors` is a list---if the post has more than one author,
85-
please format the list like this:
95+
where `YYYY-MM-DD` is replaced by the post's date and `hh:mm:ss` by the post's
96+
time. Note that the time *must* be quoted so that the colons it contains do not
97+
confuse Jekyll's YAML parser. Note also that `authors` is a *list*. If the post
98+
has more than one author, please format the list like this:
8699

87100
~~~
88101
...
@@ -108,34 +121,51 @@ You must then also add the page to `_data/navigation.yml`,
108121
which is used to generate the site's pull-down navigation menu.
109122

110123
<a name="workshop"></a>
111-
To **add a workshop**,
112-
fill in the [workshop request form](https://amy.carpentries.org/forms/workshop/) online.
113-
You should fill in this form even for self-organized workshops in order to get your workshop into the Carpentries database.
124+
To **add a workshop**, fill in the [workshop request form](
125+
https://amy.carpentries.org/forms/workshop/) online. You should fill in this
126+
form even for self-organized workshops in order to get your workshop into the
127+
Carpentries database.
114128

115129
## The Details <a name="details"></a>
116130

117131

118132
### How is the site built and rendered?
119133

120-
The website is build with a GitHub Actions (see [this file](https://github.com/hpc-carpentry/hpc-carpentry.github.io/blob/main/.github/workflows/build-and-deploy.yml)).
121-
134+
The website is built with a GitHub Action, configured in
135+
[`.github/workflows/build-and-deploy.yml`](
136+
https://github.com/hpc-carpentry/hpc-carpentry.github.io/blob/main/.github/workflows/build-and-deploy.yml).
122137
Each time a commit is pushed to the default branch of the repository (`main`)
123-
and every 6 hours, the GitHub Action does the following:
138+
and every 24 hours, the GitHub Action does the following:
139+
140+
1. Validate the YAML headers of all the pages and blog posts.
141+
1. Update the time-dependent content (list of lessons, list of "Help Wanted"
142+
issues, etc.). For details on how these data files can be generated see the
143+
next section.
144+
1. Build and deploy the website to <https://www.hpc-carpentry.org>.
145+
146+
### Data Files <a name="data"></a>
124147

125-
1. it validates the YAML headers of all the pages and blog posts
126-
1. it builds the website 1 using the latest versions of the Carpentries [data
127-
feeds](https://feeds.carpentries.org) to generate the dynamic content on the
128-
site (list of community members, list of workshops, etc.). For this, we use
129-
the [Jekyll Get JSON](https://github.com/brockfanning/jekyll-get-json)
130-
plugin.
148+
The data files for the workshops and the instructors are generated by our
149+
GitHub Action using the scripts found in the `feeds` folder.
131150

132-
### Data Files
151+
To generate these feeds locally,
152+
153+
```
154+
make data
155+
```
133156

134-
The data files for the workshops and the instructors are generated every 6 hours
135-
from AMY (via the Carpentries redash server) by the script in the
136-
[feeds.carpentries.org repository](https://github.com/carpentries/feeds.carpentries.org).
137-
These files are available at <https://feeds.carpentries.org/>.
157+
To successfully execute this step you need an appropriate R environment (with
158+
packages `colorspace`, `deplyr`, `gh`, `jsonlite`, `purrr`, and `tibble` — see
159+
[feeds/README.md](
160+
https://github.com/hpc-carpentry/hpc-carpentry.github.io/blob/main/)) and the
161+
environment variable `GITHUB_PAT` configured with your
162+
[GitHub Personal Authentication Token](
163+
https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)
164+
so that GitHub does not limit your API usage. When generating this PAT, you
165+
should *not* need to set any scopes (not even "repo"): this process is
166+
read-only, and our work is public.
138167

139168
### Styles
140169

141-
The files in the `_sass` and `assets` directories control the appearance of this site.
170+
The files in the `_sass` and `assets` directories control the appearance of
171+
this site.

_config.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ exclude:
111111
- README.md
112112
- INSTALL.md
113113
- Makefile
114+
- feeds/
114115
- vendor/
115116

116117
# Build settings
@@ -119,14 +120,12 @@ exclude:
119120
plugins:
120121
- jekyll-paginate
121122
- jekyll-redirect-from
122-
- jekyll-get-json
123+
# For HPC Carpentry, we generate the json files as part of a GitHub Action
124+
# so we don't (currently) need this dependency
125+
# - jekyll-get-json
123126

124127
## external data sources
125-
jekyll_get_json:
126-
# - data: community_lessons
127-
# json: 'https://feeds.carpentries.org/community_lessons.json'
128-
- data: help_wanted_issues
129-
json: 'https://feeds.carpentries.org/help_wanted_issues.json'
128+
# jekyll_get_json:
130129
# - data: all_badged_people
131130
# json: 'https://feeds.carpentries.org/all_badged_people.json'
132131
# - data: badges_stats

_data/community_lessons.json

Lines changed: 0 additions & 101 deletions
This file was deleted.

0 commit comments

Comments
 (0)