From 71a7a60dc49f604a28396aad586caf7572e9a4fe Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Wed, 11 Sep 2024 17:16:19 +0100 Subject: [PATCH] Call `Pkg.resolve()` before hashing Manifest (#519) * Update Manifest * Call resolve() in preview/publish workflows Closes #518 * Add GHA workflow to resolve Manifest file * Prefix cache path with `./` cf. https://github.com/actions/cache/issues/1361 --- .github/workflows/preview.yml | 7 ++-- .github/workflows/publish.yml | 7 ++-- .github/workflows/resolve_manifest.yml | 48 ++++++++++++++++++++++++++ Manifest.toml | 4 +-- 4 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/resolve_manifest.yml diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 31e1e543c..82016622f 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -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 @@ -33,7 +34,7 @@ jobs: uses: actions/cache/restore@v4 with: path: | - _freeze/ + ./_freeze/ key: ${{ runner.os }}-${{ hashFiles('**/Manifest.toml') }} - name: Render Quarto site @@ -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 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7a3790bf4..d42c6e60f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/resolve_manifest.yml b/.github/workflows/resolve_manifest.yml new file mode 100644 index 000000000..261363509 --- /dev/null +++ b/.github/workflows/resolve_manifest.yml @@ -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" diff --git a/Manifest.toml b/Manifest.toml index 3b5e8c298..8771f4b34 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -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" @@ -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"]