Commit 53fa84a4 authored by Zhian N. Kamvar's avatar Zhian N. Kamvar
Browse files

Merge https://github.com/carpentries/styles into update-styles-2021-04-20

parents 5eee7f19 6ce5c22c
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -33,9 +33,10 @@ jobs:
      RSPM: 'https://packagemanager.rstudio.com/cran/__linux__/focal/latest'
    steps:
      - name: Set up Ruby
        uses: actions/setup-ruby@v1
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '2.7'
          bundler-cache: true

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

      - name: Install GitHub Pages, Bundler, and kramdown gems
        run: |
          gem install github-pages bundler kramdown
          gem install github-pages bundler kramdown kramdown-parser-gfm

      - name: Install Python modules
        run: |
@@ -96,7 +97,8 @@ jobs:
      - name: Install needed packages
        if: steps.check-rmd.outputs.count != 0
        run: |
          install.packages(setdiff(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'), rownames(installed.packages())))
          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
+11 −4
Original line number Diff line number Diff line
@@ -17,9 +17,10 @@ jobs:
        shell: bash
    steps:
      - name: Set up Ruby
        uses: actions/setup-ruby@v1
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '2.7'
          bundler-cache: true

      - name: Set up Python
        uses: actions/setup-python@v2
@@ -28,7 +29,7 @@ jobs:

      - name: Install GitHub Pages, Bundler, and kramdown gems
        run: |
          gem install github-pages bundler kramdown
          gem install github-pages bundler kramdown kramdown-parser-gfm

      - name: Install Python modules
        run: |
@@ -62,7 +63,8 @@ jobs:
      - name: Install needed packages
        if: steps.check-rmd.outputs.count != 0
        run: |
          install.packages(setdiff(c('remotes', 'rprojroot', 'renv', 'desc', 'rmarkdown', 'knitr'), rownames(installed.packages())))
          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
@@ -97,6 +99,11 @@ jobs:
      - 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
@@ -105,7 +112,7 @@ jobs:
          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 commit --allow-empty -m "[Github Actions] render website (via ${{ github.sha }})"
          git push origin gh-pages
          # return
          cd ..
+2 −1
Original line number Diff line number Diff line
@@ -7,4 +7,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 −0
Original line number Diff line number Diff line
@@ -8,3 +8,7 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
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
 No newline at end of file
+29 −17
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@

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

@@ -12,7 +12,7 @@ DST=_site
PYTHON3_EXE := $(shell which python3 2>/dev/null)
ifneq (, $(PYTHON3_EXE))
  ifeq (,$(findstring Microsoft/WindowsApps/python3,$(subst \,/,$(PYTHON3_EXE))))
    PYTHON := python3
    PYTHON := $(PYTHON3_EXE)
  endif
endif

@@ -21,25 +21,25 @@ ifeq (,$(PYTHON))
  ifneq (, $(PYTHON_EXE))
    PYTHON_VERSION_FULL := $(wordlist 2,4,$(subst ., ,$(shell python --version 2>&1)))
    PYTHON_VERSION_MAJOR := $(word 1,${PYTHON_VERSION_FULL})
    ifneq (3, ${PYTHON_VERSION_MAJOR})
      $(error "Your system does not appear to have Python 3 installed.")
    ifeq (3, ${PYTHON_VERSION_MAJOR})
      PYTHON := $(PYTHON_EXE)
    else
      PYTHON_NOTE = "Your system does not appear to have Python 3 installed."
    endif
    PYTHON := python
  else
      $(error "Your system does not appear to have any Python installed.")
      PYTHON_NOTE = "Your system does not appear to have any Python installed."
  endif
endif


# Controls
.PHONY : commands clean files

# Default target
.DEFAULT_GOAL := commands

## I. Commands for both workshop and lesson websites
## =================================================

.PHONY: site docker-serve repo-check clean clean-rmd

## * serve            : render website and run a local server
serve : lesson-md
	${JEKYLL} serve
@@ -50,8 +50,8 @@ site : lesson-md

## * docker-serve     : use Docker to serve the site
docker-serve :
	docker pull carpentries/lesson-docker:latest
	docker run --rm -it \
	@docker pull carpentries/lesson-docker:latest
	@docker run --rm -it \
		-v $${PWD}:/home/rstudio \
		-p 4000:4000 \
		-p 8787:8787 \
@@ -60,7 +60,7 @@ docker-serve :
		carpentries/lesson-docker:latest

## * repo-check       : check repository settings
repo-check :
repo-check : python
	@${PYTHON} bin/repo_check.py -s .

## * clean            : clean up junk files
@@ -68,6 +68,9 @@ clean :
	@rm -rf ${DST}
	@rm -rf .sass-cache
	@rm -rf bin/__pycache__
	@rm -rf .vendor
	@rm -rf .bundle
	@rm -f Gemfile.lock
	@find . -name .DS_Store -exec rm {} \;
	@find . -name '*~' -exec rm {} \;
	@find . -name '*.pyc' -exec rm {} \;
@@ -85,7 +88,7 @@ clean-rmd :
.PHONY : workshop-check

## * workshop-check   : check workshop homepage
workshop-check :
workshop-check : python
	@${PYTHON} bin/workshop_check.py .


@@ -128,18 +131,18 @@ lesson-md : ${RMD_DST}

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

## * lesson-check     : validate lesson Markdown
lesson-check : lesson-fixme
lesson-check : python lesson-fixme
	@${PYTHON} bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md

## * lesson-check-all : validate lesson Markdown, checking line lengths and trailing whitespace
lesson-check-all :
lesson-check-all : python
	@${PYTHON} bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md -l -w --permissive

## * unittest         : run unit tests on checking tools
unittest :
unittest : python
	@${PYTHON} bin/test_lesson_check.py

## * lesson-files     : show expected names of generated files for debugging
@@ -157,6 +160,15 @@ lesson-fixme :
## IV. Auxililary (plumbing) commands
## =================================================

.PHONY : commands python

## * commands         : show all commands.
commands :
	@sed -n -e '/^##/s|^##[[:space:]]*||p' $(MAKEFILE_LIST)

python :
ifeq (, $(PYTHON))
	$(error $(PYTHON_NOTE))
else
	@:
endif
Loading