Skip to content

Commit

Permalink
self-hosted
Browse files Browse the repository at this point in the history
  • Loading branch information
sosiristseng committed Dec 16, 2023
1 parent 61bb8b4 commit 488352d
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 51 deletions.
48 changes: 13 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:
cancel-in-progress: true

env:
NPROC: '2' # Number of Julia processes to run the notebooks
NPROC: '4' # Number of Julia processes to run the notebooks
PY_VER: '3.12'
CACHE_NUM: '1'
JULIA_NUM_THREADS: 'auto'
Expand All @@ -21,7 +21,7 @@ env:

jobs:
CI:
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -30,14 +30,14 @@ jobs:
id: cp
with:
python-version: ${{ env.PY_VER }}
- name: Cache pip
uses: actions/cache@v3
id: cache-pip
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-pip-${{ steps.cp.outputs.python-version }}-${{ hashFiles('requirements.txt') }}
# - name: Cache pip
# uses: actions/cache@v3
# id: cache-pip
# with:
# path: ${{ env.pythonLocation }}
# key: ${{ runner.os }}-pip-${{ steps.cp.outputs.python-version }}-${{ hashFiles('requirements.txt') }}
- name: Install python packages
if: ${{ steps.cache-pip.outputs.cache-hit != 'true' }}
# if: ${{ steps.cache-pip.outputs.cache-hit != 'true' }}
run: pip install -r requirements.txt
- name: Read Julia version
uses: SebRollen/[email protected]
Expand All @@ -46,37 +46,15 @@ jobs:
file: 'Manifest.toml'
field: 'julia_version'
- name: Install Julia using jill.sh
run: |
wget -O /tmp/jill.sh https://raw.githubusercontent.com/abelsiqueira/jill/main/jill.sh
bash /tmp/jill.sh --version ${{ steps.read_toml.outputs.value }} -y
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Cache Julia packages
uses: actions/cache/restore@v3
id: cache-julia
uses: julia-actions/setup-julia@v1
with:
path: |
~/.julia
!~/.julia/registries
key: ${{ runner.os }}-julia-${{ env.CACHE_NUM }}-${{ hashFiles('src/**','Project.toml', 'Manifest.toml')}}
# restore-keys: |
# ${{ runner.os }}-julia-${{ env.CACHE_NUM }}-
version: ${{ steps.read_toml.outputs.value }}
show-versioninfo: 'true'
- name: Install Julia packages
if: ${{ steps.cache-julia.outputs.cache-hit != 'true' }}
run: |
julia --color=yes -e 'using Pkg; Pkg.add(["PrettyTables", "Literate"])'
julia --project=@. --color=yes -e 'using Pkg, Dates; Pkg.instantiate(); Pkg.resolve(); Pkg.precompile(); Pkg.gc(collect_delay=Day(0))'
- name: Save Julia packages
uses: actions/cache/save@v3
if: ${{ steps.cache-julia.outputs.cache-hit != 'true' }}
with:
path: |
~/.julia
!~/.julia/registries
key: ${{ steps.cache-julia.outputs.cache-primary-key }}
julia --project=@. --color=yes -e 'using Pkg; Pkg.instantiate(); Pkg.resolve(); Pkg.precompile()'
- name: Run program
env:
JULIA_PROJECT: '@.'
GKSwstype: '100'
run: julia --color=yes -p ${{ env.NPROC }} literate.jl
- name: Build website
run: jupyter-book build docs/
Expand Down
43 changes: 30 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints
_build/

# Environments
.env
Expand All @@ -16,6 +10,24 @@ ENV/
env.bak/
venv.bak/

# mkdocs documentation
/site
/public

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# Local VSCode settings
.vscode/

# Julia DEPOT
.julia/

# Files generated by invoking Julia with --code-coverage
*.jl.cov
*.jl.*.cov
Expand All @@ -34,12 +46,17 @@ deps/src/
# Build artifacts for creating documentation generated by the Documenter package
docs/build/
docs/site/
figures/

# VSCode thing
.vscode/
# File generated by Pkg, the package manager, based on a corresponding Project.toml
# It records a fixed state of all packages used by the project. As such, it should not be
# committed for packages, but should be committed for applications that require a static
# environment.
# Manifest.toml

LocalPreferences.toml

# PythonCall
.CondaPkg

# Generated files
*.mp4
*.csv
*.png
*.ipynb
8 changes: 5 additions & 3 deletions literate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ using Distributed
using PrettyTables

@everywhere begin
using Literate
ENV["GKSwstype"] = 100
using Literate, Pkg
Pkg.activate(Base.current_project())
end

s
basedir = "docs"
config = Dict("mdstrings" => true, "execute" => true)

Expand All @@ -19,7 +21,7 @@ for (root, dirs, files) in walkdir(basedir)
end
end

# Execute the notebooks in worker processes
# Execute the notebooks in worker process(es)
ts = pmap(nbs; on_error=ex->NaN) do nb
@elapsed Literate.notebook(nb, dirname(nb); config)
end
Expand Down

0 comments on commit 488352d

Please sign in to comment.