Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STY: Sync with carpentries remote styles #22

Merged
merged 65 commits into from
May 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
1d32319
add image-with-shadow class
tobyhodges Nov 5, 2020
d021e1f
add patch to clean gh-pages before committing (#545)
zkamvar Feb 10, 2021
f419f9c
Fix Kramdown parser crash
maxim-belkin Feb 15, 2021
ec29c6b
Merge pull request #546 from maxim-belkin/fix543
zkamvar Feb 16, 2021
2a550c7
bin/util.py: Change ruby executable to "bundle exec ruby"
reid-a Feb 22, 2021
a4e53f9
Change link colours (#549)
baileythegreen Feb 22, 2021
03fb1a0
bin/workshop_check.py: update default contact email address
tobyhodges Mar 4, 2021
a841a56
Gemfile: add 'webrick' dependency for Ruby 3.0.0 and above
josephmje Mar 5, 2021
32f7bd1
lesson_check.py allow for missing life_cycle
zkamvar Mar 10, 2021
b2f42c2
update with Maxim's suggestion
zkamvar Mar 10, 2021
a283c4b
Merge pull request #557 from zkamvar/znk-fix-556
zkamvar Mar 10, 2021
0554a8d
Add catch for None type code block in lesson_check
zkamvar Mar 11, 2021
cce6a66
fix syntax
zkamvar Mar 11, 2021
091d31a
Merge pull request #558 from zkamvar/znk-fix-550
zkamvar Mar 11, 2021
905d24a
Makefile: fix 'bundle config' command flags
maxim-belkin Mar 16, 2021
4e81182
Merge pull request #559 from maxim-belkin/bundle-config-fix
zkamvar Mar 17, 2021
b43257a
Makefile: clean target: remove .vendor, .bundle, Gemfile.lock
maxim-belkin Mar 18, 2021
39a32f6
Makefile: silence Docker commands
maxim-belkin Mar 18, 2021
588f2af
Merge pull request #561 from maxim-belkin/silence-docker-commands
zkamvar Mar 18, 2021
ed77eda
use Ruby's official GH Actions
fmichonneau Mar 19, 2021
b46187f
Makefile: use SHELL to call bin/knit_lesson.sh
maxim-belkin Mar 19, 2021
b1ca20a
Makefile: fix up PHONY targets
maxim-belkin Mar 19, 2021
943c8d9
Fix GitHub actions for lessons in Rmarkdown
maxim-belkin Mar 19, 2021
13d218a
Merge pull request #565 from maxim-belkin/attempt-to-fix-r-on-windows
zkamvar Mar 19, 2021
625c55e
Merge pull request #563 from maxim-belkin/phony-targets
zkamvar Mar 19, 2021
d6c86ba
Merge branch 'gh-pages' into image-with-shadow-class
tobyhodges Mar 22, 2021
4df32a8
apply single shadow to image class
tobyhodges Mar 22, 2021
93dfc15
use grey shadow instead of transparent black
tobyhodges Mar 22, 2021
4b20368
expand image-with-shadow selection
tobyhodges Mar 23, 2021
d0c90ee
Merge pull request carpentries/styles#514
maxim-belkin Mar 23, 2021
5a010ab
Makefile: don't fail when Python isn't found
maxim-belkin Mar 23, 2021
50fd61f
Merge pull request carpentries/styles#566
maxim-belkin Mar 24, 2021
1bad008
bin/dependencies.R: handle 'no packages were specified' error
maxim-belkin Mar 27, 2021
4b3d44a
Merge pull request #567 from maxim-belkin/no-missing-dependencies
zkamvar Mar 29, 2021
4df5052
Don't check links.md in lessons that use remote theme
maxim-belkin Apr 14, 2021
9a73007
add link references to code_of_conduct.md (#572)
tobyhodges Apr 14, 2021
ced2244
Update links.md
alanocallaghan Apr 15, 2021
72d2b85
Merge pull request #575 from Alanocallaghan/patch-1
zkamvar Apr 15, 2021
494e2d6
add source_dir argument
zkamvar Apr 15, 2021
efe8c04
lesson_check.py: add 'source_dir' as an argument to using_remote_theme()
maxim-belkin Apr 15, 2021
01fa7e6
Improved relative_root_path
maxim-belkin Apr 16, 2021
8541f28
update contributing guide
tobyhodges Apr 17, 2021
4a9721d
Merge pull request #579 from tobyhodges/patch-8
zkamvar Apr 17, 2021
a56a34e
add further languages for box titles (#580)
bkmgit Apr 20, 2021
6ce5c22
Merge pull request #578 from maxim-belkin/fix-404
zkamvar Apr 20, 2021
0c92757
bin/lesson_check.py: allow comments and empty lines in links.md
maxim-belkin Apr 21, 2021
7e94928
bin/lesson_check.py: one more fix for using_remote_theme()
maxim-belkin Apr 22, 2021
14ca369
Merge pull request #585 from maxim-belkin/one-last-fix
zkamvar Apr 23, 2021
ac0a2bf
Template workflow: add two more lessons
maxim-belkin Apr 21, 2021
091ecf7
add make lesson-check-all step
zkamvar Apr 22, 2021
902705d
Set working directory for the 'make site' step
maxim-belkin Apr 22, 2021
97c32b9
Merge pull request #584 from maxim-belkin/add-two-more-lessons
zkamvar Apr 23, 2021
d3f553d
Template workflow: smarter syncing with the styles repo
maxim-belkin Apr 21, 2021
db953ba
Apply Zhian's suggestions
maxim-belkin Apr 23, 2021
2abba21
Merge pull request #583 from maxim-belkin/better-syncing
zkamvar Apr 23, 2021
973177e
add math support with katex (#573)
alanocallaghan Apr 27, 2021
456c214
bin/util.py: remove unused 'IMAGE_FILE_SUFFIX' var (#590)
maxim-belkin Apr 30, 2021
6d5b41e
Merge pull request carpentries/styles#582
maxim-belkin May 6, 2021
d3e11ab
bin/lesson_check.py: use proper function
maxim-belkin May 6, 2021
5e32b18
Merge pull request carpentries/styles#593
maxim-belkin May 6, 2021
0f1cec8
bin/lesson_check.py: allow exceptions to line length limit
maxim-belkin May 6, 2021
c82a669
Merge pull request carpentries/styles#594
maxim-belkin May 6, 2021
5b9bff4
lesson_check.py: harden single-line image/link pattern
maxim-belkin May 9, 2021
af7efa5
Merge pull request carpentries/styles#597
maxim-belkin May 9, 2021
1352906
sync styles
josephmje May 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 182 additions & 0 deletions .github/workflows/template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
name: Test template
on:
push:
branches: gh-pages
pull_request:
jobs:
check-template:
name: ${{ matrix.lesson-name }} (${{ matrix.os-name }})
if: github.repository == 'carpentries/styles'
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
lesson: [swcarpentry/shell-novice, datacarpentry/r-intro-geospatial, librarycarpentry/lc-git]
os: [ubuntu-20.04, macos-latest, windows-latest]
experimental: [false]
include:
- os: ubuntu-20.04
os-name: Linux
- 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
- lesson: datacarpentry/astronomy-python
lesson-name: (DC) Foundations of Astronomical Data Science
experimental: true
os: ubuntu-20.04
os-name: Linux
- lesson: carpentries/lesson-example
lesson-name: (CP) Lesson Example
experimental: false
os: ubuntu-20.04
os-name: Linux
defaults:
run:
shell: bash # forces 'Git for Windows' on Windows
env:
RSPM: 'https://packagemanager.rstudio.com/cran/__linux__/focal/latest'
steps:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true

- 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 kramdown-parser-gfm

- name: Install Python modules
run: |
if [[ $RUNNER_OS == macOS || $RUNNER_OS == Linux ]]; then
python3 -m pip install --upgrade pip setuptools wheel pyyaml==5.3.1 requests
elif [[ $RUNNER_OS == Windows ]]; then
python -m pip install --upgrade pip setuptools wheel pyyaml==5.3.1 requests
fi

- name: Checkout the ${{ matrix.lesson }} lesson
uses: actions/checkout@master
with:
repository: ${{ matrix.lesson }}
path: lesson
fetch-depth: 0

- name: Sync lesson with carpentries/styles
working-directory: lesson
run: |
echo "::group::Fetch Styles"
if [[ -n "${{ github.event.pull_request.number }}" ]]
then
ref="refs/pull/${{ github.event.pull_request.number }}/head"
else
ref="gh-pages"
fi

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 fetch styles $ref:styles-ref
echo "::endgroup::"
echo "::group::Synchronize Styles"
# Sync up only if necessary
if [[ $(git rev-list --count HEAD..styles-ref) != 0 ]]
then

# The merge command below might fail for lessons that use remote theme
# https://github.com/carpentries/carpentries-theme
echo "Testing merge using recursive strategy, accepting upstream changes without committing"
if ! git merge -s recursive -Xtheirs --no-commit styles-ref
then

# Remove "deleted by us, unmerged" files from the staging area.
# these are the files that were removed from the lesson
# but are still present in the carpentries/styles repo
echo "Removing previously deleted files"
git rm $(git diff --name-only --diff-filter=DU)

# If there are still "unmerged" files,
# let's raise an error and look into this more closely
if [[ -n $(git diff --name-only --diff-filter=U) ]]
then
echo "There were unmerged files in ${{ matrix.lesson-name }}:"
echo "$(git diff --compact-summary --diff-filter=U)"
exit 1
fi
fi

echo "Committing changes"
git commit -m "Sync lesson with carpentries/styles"
fi
echo "::endgroup::"

- name: Look for R-markdown files
id: check-rmd
working-directory: lesson
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: |
packages = setdiff(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'), rownames(installed.packages()))
install.packages(packages, repo="https://cran.rstudio.com/")
shell: Rscript {0}

- name: Query dependencies
if: steps.check-rmd.outputs.count != 0
working-directory: lesson
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: runner.os != 'Windows' && 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 stringi from source
if: runner.os == 'Linux' && steps.check-rmd.outputs.count != 0
run: install.packages('stringi', repos='https://cloud.r-project.org')
shell: Rscript {0}

- name: Install system dependencies for R packages
if: runner.os == 'Linux' && steps.check-rmd.outputs.count != 0
working-directory: lesson
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'cat(remotes::system_requirements("ubuntu", "20.04"), sep = "\n")')

- run: make site
working-directory: lesson

- run: make lesson-check-all
working-directory: lesson
121 changes: 121 additions & 0 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Website
on:
push:
branches:
- gh-pages
- main
pull_request: []
jobs:
build-website:
if: ${{ !endsWith(github.repository, '/styles') }}
runs-on: ubuntu-20.04
env:
RSPM: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
defaults:
run:
shell: bash
steps:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true

- 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 kramdown-parser-gfm

- 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: 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 needed packages
if: steps.check-rmd.outputs.count != 0
run: |
packages = setdiff(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'), rownames(installed.packages()))
install.packages(packages, repo="https://cran.rstudio.com/")
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: 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", "20.04"), sep = "\n")')

- name: Render the markdown and confirm that the site can be built
run: make site

- name: Checkout github pages
if: ${{ github.event_name == 'push' && steps.check-rmd.outputs.count != 0 && github.ref != 'refs/heads/gh-pages'}}
uses: actions/checkout@master
with:
ref: gh-pages
path: gh-pages

- name: Commit and Push
if: ${{ github.event_name == 'push' && steps.check-rmd.outputs.count != 0 && github.ref != 'refs/heads/gh-pages'}}
run: |
# clean up gh-pages
cd gh-pages
git rm -rf . # remove all previous files
git restore --staged . # remove things from the stage
cd ..
# copy everything into gh-pages site
cp -r `ls -A | grep -v 'gh-pages' | grep -v '.git' | grep -v '.bundle/' | grep -v '_site'` gh-pages
# move into gh-pages, add, commit, and push
cd gh-pages
# setup git
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add -A .
git commit --allow-empty -m "[Github Actions] render website (via ${{ github.sha }})"
git push origin gh-pages
# return
cd ..

- run: make lesson-check-all
if: always()
3 changes: 2 additions & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ we pledge to follow the [Carpentry Code of Conduct][coc].
Instances of abusive, harassing, or otherwise unacceptable behavior
may be reported by following our [reporting guidelines][coc-reporting].

{% include links.md %}
[coc]: https://docs.carpentries.org/topic_folders/policies/code-of-conduct.html
[coc-reporting]: https://docs.carpentries.org/topic_folders/policies/incident-reporting.html
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ ruby '>=2.7.1'
gem 'github-pages', group: :jekyll_plugins

if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0.0')
gem 'webrick', '>=1.6.1'
end
gem 'webrick', '>= 1.6.1'
end
Loading