Skip to content

Commit

Permalink
Call Pkg.resolve() before hashing Manifest (#519)
Browse files Browse the repository at this point in the history
* Update Manifest

* Call resolve() in preview/publish workflows

Closes #518

* Add GHA workflow to resolve Manifest file

* Prefix cache path with `./`

cf. actions/cache#1361
  • Loading branch information
penelopeysm authored Sep 11, 2024
1 parent 3143ffb commit 71a7a60
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 8 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ jobs:
with:
version: '1.10'

# Note: needs resolve() to fix #518
- name: Instantiate Julia environment
run: julia --project=. -e 'using Pkg; Pkg.instantiate()'
run: julia --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.resolve()'

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
Expand All @@ -33,7 +34,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: |
_freeze/
./_freeze/
key: ${{ runner.os }}-${{ hashFiles('**/Manifest.toml') }}

- name: Render Quarto site
Expand All @@ -44,7 +45,7 @@ jobs:
uses: actions/cache/save@v4
with:
path: |
_freeze/
./_freeze/
key: ${{ runner.os }}-${{ hashFiles('**/Manifest.toml') }}

- name: Deploy to GitHub Pages
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ jobs:
with:
version: '1.10'

# Note: needs resolve() to fix #518
- name: Instantiate Julia environment
run: julia --project=. -e 'using Pkg; Pkg.instantiate()'
run: julia --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.resolve()'

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
Expand All @@ -34,7 +35,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: |
_freeze/
./_freeze/
key: ${{ runner.os }}-${{ hashFiles('**/Manifest.toml') }}

- name: Extract version from _quarto.yml
Expand Down Expand Up @@ -75,7 +76,7 @@ jobs:
uses: actions/cache/save@v4
with:
path: |
_freeze/
./_freeze/
key: ${{ runner.os }}-${{ hashFiles('**/Manifest.toml') }}

- name: Fetch search_original.json from main site
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/resolve_manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This action runs Pkg.instantiate() and Pkg.resolve() every time the master
# branch is pushed to. If this leads to a change in the Manifest.toml file, it
# will open a PR to update the Manifest.toml file. This ensures that the
# contents of the Manifest in the repository are consistent with the contents
# of the Manifest used by the CI system (i.e. during the actual docs
# generation).
#
# See https://github.com/TuringLang/docs/issues/518 for motivation.

name: Resolve Manifest
on:
push:
branches:
- master
workflow_dispatch:

jobs:
check-version:
runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

env:
# Disable precompilation as it takes a long time and is not needed for this workflow
JULIA_PKG_PRECOMPILE_AUTO: 0

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Julia
uses: julia-actions/setup-julia@v2

- name: Instantiate and resolve
run: |
julia -e 'using Pkg; Pkg.instantiate(); Pkg.resolve()'
- name: Open PR
id: create_pr
uses: peter-evans/create-pull-request@v6
with:
branch: resolve-manifest
add-paths: Manifest.toml
commit-message: "Update Manifest.toml"
body: "This PR is automatically generated by the `resolve_manifest.yml` GitHub Action."
title: "Update Manifest.toml to match CI environment"
4 changes: 2 additions & 2 deletions Manifest.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is machine-generated - editing it directly is not advised

julia_version = "1.10.4"
julia_version = "1.10.5"
manifest_format = "2.0"
project_hash = "e0661388214f9e03749b3fccc86939dfd3853246"

Expand Down Expand Up @@ -3328,7 +3328,7 @@ version = "0.15.2+0"
[[deps.libblastrampoline_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
version = "5.8.0+1"
version = "5.11.0+0"

[[deps.libdecor_jll]]
deps = ["Artifacts", "Dbus_jll", "JLLWrappers", "Libdl", "Libglvnd_jll", "Pango_jll", "Wayland_jll", "xkbcommon_jll"]
Expand Down

0 comments on commit 71a7a60

Please sign in to comment.