diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 2311a504..00000000 --- a/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -.git/ -.cache/ -.github/workflows diff --git a/.github/dependabot.yml b/.github/dependabot.yml index df3f89d6..0be69bfc 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,3 +7,10 @@ updates: interval: daily labels: - automerge + - package-ecosystem: pip + directory: "/" + open-pull-requests-limit: 1 + schedule: + interval: daily + labels: + - automerge diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78a18c4d..2a5834ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,8 @@ concurrency: cancel-in-progress: true env: - NPROC: '2' # Number of Julia processes to run the notebooks + NPROC: '3' # Number of Julia processes to run the notebooks + PY_VER: '3.12' CACHE_NUM: '1' JULIA_NUM_THREADS: 'auto' JULIA_CONDAPKG_BACKEND: 'Null' @@ -24,12 +25,20 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Setup micromamba - uses: mamba-org/setup-micromamba@v1 + - name: Setup Python + uses: actions/setup-python@v5 + id: cp with: - environment-file: environment.yml - cache-environment: true - post-cleanup: all + 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: Install python packages + if: ${{ steps.cache-pip.outputs.cache-hit != 'true' }} + run: pip install -r requirements.txt - name: Read Julia version uses: SebRollen/toml-action@v1.0.2 id: read_toml @@ -41,9 +50,9 @@ jobs: 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: Restore Julia packages + - name: Cache Julia packages uses: actions/cache/restore@v3 - id: cache + id: cache-julia with: path: | ~/.julia @@ -52,26 +61,24 @@ jobs: restore-keys: | ${{ runner.os }}-julia-${{ env.CACHE_NUM }}- - name: Install Julia packages - shell: micromamba-shell {0} + 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.gc(collect_delay=Day(1))' + 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.outputs.cache-hit != 'true' }} + if: ${{ steps.cache-julia.outputs.cache-hit != 'true' }} with: path: | ~/.julia !~/.julia/registries - key: ${{ steps.cache.outputs.cache-primary-key }} + key: ${{ steps.cache-julia.outputs.cache-primary-key }} - name: Run program - shell: micromamba-shell {0} env: JULIA_PROJECT: '@.' GKSwstype: '100' run: julia --color=yes -p ${{ env.NPROC }} literate.jl - name: Build website - shell: micromamba-shell {0} run: jupyter-book build docs/ - name: Upload pages artifact if: ${{ github.ref == 'refs/heads/main' }} diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index 28f13c49..3b5df3b9 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -14,6 +14,7 @@ on: env: DIR: 'docs' + PY_VER: '3.12' jobs: linkcheck: @@ -21,6 +22,20 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + 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: Install python packages + if: ${{ steps.cache-pip.outputs.cache-hit != 'true' }} + run: pip install -r requirements.txt - name: Setup Julia uses: julia-actions/setup-julia@v1 - name: Convert literate notebooks to markdown files @@ -33,28 +48,10 @@ jobs: for (root, dirs, files) in walkdir(pwd()) for file in files if endswith(file, ".jl") - Literate.markdown(joinpath(root, file); mdstrings=true, flavor = Literate.CommonMarkFlavor()) + nb = joinpath(root, file) + Literate.notebook(nb, dirname(nb); mdstrings=true, execute=false) end end end - - name: Restore lychee cache - id: restore-cache - uses: actions/cache/restore@v3 - with: - path: .lycheecache - key: cache-lychee-${{ github.sha }} - restore-keys: cache-lychee- - - name: Lychee Checker - uses: lycheeverse/lychee-action@v1.8.0 - id: lychee - with: - fail: true - args: '--accept 200,204,429 --verbose --no-progress --cache --max-cache-age 1d ${{ env.DIR }}' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Save lychee cache - uses: actions/cache/save@v3 - if: always() - with: - path: .lycheecache - key: ${{ steps.restore-cache.outputs.cache-primary-key }} + - name: Check links + run: jupyter-book build ${DIR} --builder linkcheck diff --git a/.github/workflows/update-manifest.yml b/.github/workflows/update-manifest.yml index 45e51a62..05297b4a 100644 --- a/.github/workflows/update-manifest.yml +++ b/.github/workflows/update-manifest.yml @@ -28,6 +28,8 @@ jobs: uses: actions/checkout@v4 - name: Setup Julia uses: julia-actions/setup-julia@v1 + with: + version: '1' - name: Update Julia dependencies env: JULIA_PKG_PRECOMPILE_AUTO: '0' diff --git a/environment.yml b/environment.yml deleted file mode 100644 index 3c257969..00000000 --- a/environment.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: ci - -dependencies: - - python>=3.11 - # Jupyter Book - - jupyter-book - - docutils>=0.17.1,<0.18|>=0.20 - # PythonPlot - # - matplotlib - # - libstdcxx-ng<13.0 diff --git a/literate.jl b/literate.jl index 2b229c93..c179226c 100644 --- a/literate.jl +++ b/literate.jl @@ -6,7 +6,7 @@ using PrettyTables end basedir = "docs" -config = Dict("mdstrings" => true, "execute" => true, "flavor" => Literate.CommonMarkFlavor()) +config = Dict("mdstrings" => true, "execute" => true) nbs = String[] @@ -21,9 +21,7 @@ end # Execute the notebooks in worker processes ts = pmap(nbs; on_error=ex->NaN) do nb - cd(dirname(nb)) do - @elapsed Literate.markdown(basename(nb); config) - end + @elapsed Literate.notebook(nb, dirname(nb); config) end pretty_table([nbs ts], header=["Notebook", "Elapsed (s)"]) @@ -34,12 +32,10 @@ for (nb, t) in zip(nbs, ts) println("Debugging notebook: ", nb) try withenv("JULIA_DEBUG" => "Literate") do - cd(dirname(nb)) do - Literate.markdown(basename(nb); config) - end + Literate.notebook(nb, dirname(nb); config) end catch e - println("An error occured: ", e) + println(e) end end end diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..fdb67383 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +# matplotlib==3.8.2 +jupyter-book==0.15.1 +docutils!=0.18.*,!=0.19.*