Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
DawievLill authored Aug 16, 2023
0 parents commit c890291
Show file tree
Hide file tree
Showing 34 changed files with 6,875 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
page/* linguist-vendored
* text=auto
22 changes: 22 additions & 0 deletions .github/workflows/CommentPR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Comment Artifacts
on:
workflow_run:
workflows: [Export & Deploy Notebooks]
types: [completed]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
artifacts-url-comments:
name: add artifact links to pull request and related issues job
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: tonyhallett/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prefix: Here are the build results
suffix: Artifacts will only be retained for 90 days.
format: name
addTo: pull
56 changes: 56 additions & 0 deletions .github/workflows/ExportNotebooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Export & Deploy Notebooks
on:
pull_request:
push:
branches:
- main
workflow_dispatch:

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up notebook state cache
uses: actions/cache@v2
with:
path: pluto_state_cache
key: ${{ runner.os }}-pluto_state_cache-v2-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }}-${{ hashFiles('**/*.jl') }}
restore-keys: |
${{ runner.os }}-pluto_state_cache-v2-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }}
- name: Install Julia
uses: julia-actions/setup-julia@v1
with:
version: 1.7
- name: Run Pluto notebooks and generate website
# Save create package environment from notebook
# (write_nb_to_dir modifies changes the cell order
# if macros are involved hence we want to call it
# on a copy of the notebook)
shell: julia --color=yes --project=. {0}
run: |
dir0 = pwd()
dir1 = joinpath(dir0, "generate")
cd(dir1)
run(`cp generate.jl generate2.jl`)
import Pkg
Pkg.add(Pkg.PackageSpec(name="Pluto", version="0.18"))
import Pluto
Pluto.activate_notebook_environment(joinpath(dir1, "generate2.jl"))
Pkg.instantiate()
include(joinpath(dir1, "generate.jl"))
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: website
path: ./website/__site

- name: Deploy to gh-pages
uses: JamesIves/github-pages-deploy-action@releases/v3
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: ./website/__site
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

.DS_Store

pluto_state_cache

website/__site/
build/
website/config.md

generate/*.toml
36 changes: 36 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
julia:
stage: build
image: julia:1
script:
- cd generate
# Save create package environment from notebook
# (write_nb_to_dir modifies changes the cell order
# if macros are involved hence we want to call it
# on a copy of the notebook)
- cp generate.jl generate2.jl
- julia -e '
import Pkg;
Pkg.add("Pluto"); import Pluto;
Pluto.PkgUtils.write_nb_to_dir("./generate2.jl", ".")'
# generate website
- julia --project=. -e '
import Pkg;
Pkg.instantiate();
include("generate.jl")'
- cd ..
artifacts:
paths:
- website/__site
cache:
paths:
- pluto_state_cache

pages:
stage: deploy
script:
- mv ./website/__site public
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
8 changes: 8 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The material in this repository is licensed as follows:

- The **code** is under the [MIT license](https://opensource.org/licenses/MIT).

- The **text** is under the [CC BY-SA 4.0 license](https://creativecommons.org/licenses/by-sa/4.0).


Copyright Alan Edelman, David P. Sanders and Fons van der Plas, 2021
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# pluto-course-template

Template for a course website based on https://computationalthinking.mit.edu/Spring21/

#### see the [website this template generates](https://greimel.github.io/pluto-course-template)

This is a fork of https://github.com/mitmath/18S191/pull/120 (by @fonsp). Changes:

* repository reduced to a minimal example
* make it work with prepath (e.g. the `pluto-course-template` in `https://greimel.github.io/pluto-course-template`)
* combine with pure markdown pages (`using Franklin`)
* deploys to GitHub Pages (via GitHub Actions) and GitLab Pages (via GitLab CI)

## Instructions

Here is how to adjust the website to your needs.

### 1. Generate the repository

https://user-images.githubusercontent.com/6280307/153845695-bd8291c9-69e6-4f31-90e6-2e2914c26ab8.mov

### 2. Customize the website

The prepath should match the short-name of your repository (`my-new-course` in this example)

https://user-images.githubusercontent.com/6280307/153845320-2b0e68ba-8ca6-4810-b9f1-8a55d897fac9.mov

### 2. (alternative version) Customize from within Pluto

1. Clone the repo
2. Open Julia and Pluto
3. Open `newwebsite/generate.jl` from Pluto
4. Do the customizations (especially prepath!)

### 3. Enable GitHub Pages

https://user-images.githubusercontent.com/6280307/153846538-1b79db97-cdb4-43fa-92d1-f3504363bb00.mov

### 4. Wait for GitHub Actions to finish and check the result

https://user-images.githubusercontent.com/6280307/153845247-48d66bed-ac4d-4b35-8f1a-e8738f190201.mov
10 changes: 10 additions & 0 deletions generate/assets/julia-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions generate/book_model.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"title": "Preliminaries",
"contents": [
{
"name": "Julia Basics",
"notebook_path": "notebooks/basic_syntax.jl",
"video_id": "",
"preview_image_url": ""
},
{
"name": "GitHub & Open Source Software",
"notebook_path": "notebooks/week12/how_to_collaborate_on_software.jl",
"video_id": "7N9Vvc8amGM",
"preview_image_url": "https://user-images.githubusercontent.com/6933510/136199704-ba6d0586-34bf-490c-8fd0-6959ab42cd23.png"
}
]
},
{
"title": "Numerical Root Finding",
"contents": [
{
"name": "The Newton Method",
"notebook_path": "notebooks/week3/newton_method.jl",
"video_id": "",
"preview_image_url": ""
}
]
}
]
Loading

0 comments on commit c890291

Please sign in to comment.