Improve HMC sampler setup for faster convergence #190
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This action checks that the minor versions of Turing.jl specified in the | |
# Project.toml, _quarto.yml, and Manifest.toml files are consistent. | |
# | |
# For pushes to master or PRs to master, it additionally also checks that the | |
# version specified in Manifest.toml matches the latest release on GitHub. | |
# | |
# If any discrepancies are observed, it will open a PR to fix them. | |
name: Check Turing.jl version consistency | |
on: | |
push: | |
branches: | |
- master | |
- backport-* | |
pull_request: | |
branches: | |
- master | |
- backport-* | |
workflow_dispatch: | |
jobs: | |
check-version: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
env: | |
# Determine whether the target branch is master (i.e. this is a push to | |
# master or a PR to master). | |
TARGET_IS_MASTER: ${{ (github.event_name == 'push' && github.ref_name == 'master') || (github.event_name == 'pull_request' && github.base_ref == 'master') }} | |
IS_PR_FROM_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }} | |
# 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: Log GitHub context variables | |
run: | | |
echo github.event_name: ${{ github.event_name }} | |
echo github.ref_name: ${{ github.ref_name }} | |
echo github.base_ref: ${{ github.base_ref }} | |
echo TARGET_IS_MASTER: ${{ env.TARGET_IS_MASTER }} | |
echo IS_PR_FROM_FORK: ${{ env.IS_PR_FROM_FORK }} | |
- name: Check version consistency | |
id: version_check | |
run: julia --color=yes .github/workflows/version_check.jl | |
- name: Create a PR with suggested changes | |
id: create_pr | |
if: always() && steps.version_check.outcome == 'failure' && env.TARGET_IS_MASTER && (! env.IS_PR_FROM_FORK) | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
base: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }} | |
branch: update-turing-version/${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }} | |
commit-message: "Update Turing.jl version to match latest release" | |
body: "This PR is automatically generated by the `version_check.yml` GitHub Action." | |
title: "Update Turing.jl version to match latest release" | |
- name: Comment on PR about suggested changes (if PR was made) | |
if: always() && github.event_name == 'pull_request' && steps.create_pr.outputs.pull-request-operation == 'created' | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: | | |
Hello! The versions of Turing.jl in your `Project.toml`, `_quarto.yml`, and/or `Manifest.toml` did not match the latest release version found on GitHub (https://github.com/TuringLang/Turing.jl/releases/latest). | |
I've made a PR to update these files to match the latest release: ${{ steps.create_pr.outputs.pull-request-url }} | |
Please review the changes and merge the PR if they look good. |