Skip to content

Resolve MixedArguments bug in initialization macro. #1435

Resolve MixedArguments bug in initialization macro.

Resolve MixedArguments bug in initialization macro. #1435

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
types: [review_requested,reopened,synchronize]
push:
branches:
- 'main'
tags:
- v**
check_run:
types: [rerequested]
schedule:
- cron: '0 8 * * 1' # run the cron job one time per week on Monday 8:00 AM
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
permissions:
actions: write
contents: read
jobs:
paper:
name: Paper Preview
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: openjournals/openjournals-draft-action@master
with:
journal: joss
# This should be the path to the paper within your repo.
paper-path: paper/paper.md
- uses: actions/upload-artifact@v4
with:
name: paper
# This is the output path where Pandoc will write the compiled
# PDF. Note, this should be the same directory as the input
# paper.md
path: paper/paper.pdf
test:
name: Tests ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ contains(matrix.version, 'nightly') }}
strategy:
fail-fast: false
matrix:
version:
- '1.10'
- '1.11'
- '1.12'
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
include-all-prereleases: true
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
env:
USE_DEV: "false"
LOG_USING_RXINFER: "false"
JULIA_FASTCHOLESKY_THROW_ERROR_NON_SYMMETRIC: 1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v4
with:
files: lcov.info
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Archive test artifacts
uses: actions/upload-artifact@v4
with:
name: test-output-${{ matrix.version }}-${{ matrix.os }}-${{ matrix.arch }}
path: test/_output
test-examples:
name: Examples
runs-on: ubuntu-latest
steps:
- name: Checkout RxInfer
uses: actions/checkout@v4
with:
path: RxInfer.jl
- name: Checkout Examples
uses: actions/checkout@v4
with:
repository: ReactiveBayes/RxInferExamples.jl
path: RxInferExamples.jl
- uses: julia-actions/setup-julia@v2
- uses: julia-actions/cache@v1
- name: Build and test examples
env:
LOG_USING_RXINFER: "false"
JULIA_FASTCHOLESKY_THROW_ERROR_NON_SYMMETRIC: 1
run: |
julia -e 'using Pkg; Pkg.add("Weave"); Pkg.develop(path="RxInfer.jl"); Pkg.precompile()'
cd RxInferExamples.jl
make examples-dev RXINFER=../RxInfer.jl
docs:
name: Documentation
runs-on: ubuntu-latest
needs:
- test
- test-examples
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v2
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- run: make docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LOG_USING_RXINFER: "false"
JULIA_FASTCHOLESKY_THROW_ERROR_NON_SYMMETRIC: 1
format-check:
name: Code Format Check
runs-on: ubuntu-latest
# Don't run on PRs that come from forks as they won't have permission to create PRs
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
permissions:
contents: write # Needed to push commits
pull-requests: write # Needed to create PRs and write comments
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: julia-actions/setup-julia@v2
- uses: julia-actions/cache@v2
# Find existing format PR if any
- name: Find existing format PR
id: find_pr
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const prNumber = ${{ github.event.pull_request.number }};
const owner = context.repo.owner;
const repo = context.repo.repo;
// Look for open PRs with our auto-format branch pattern that targets this PR's branch
const prs = await github.rest.pulls.list({
owner,
repo,
state: 'open',
base: '${{ github.head_ref }}'
});
const formatPr = prs.data.find(pr => pr.head.ref.startsWith('auto-format-') &&
pr.title === "🤖 Auto-format Julia code");
if (formatPr) {
console.log(`Found existing format PR: #${formatPr.number}`);
return formatPr.number;
}
return '';
- name: Run formatter check
id: format_check
run: |
if ! make lint; then
echo "format_needs_fix=true" >> $GITHUB_OUTPUT
else
echo "format_needs_fix=false" >> $GITHUB_OUTPUT
fi
# Close any existing formatting PR if the check now passes
- name: Close existing format PR if check passes
if: steps.format_check.outputs.format_needs_fix == 'false' && steps.find_pr.outputs.result != ''
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const formatPrNumber = Number(${{ steps.find_pr.outputs.result }});
if (formatPrNumber === 0) {
return;
}
const owner = context.repo.owner;
const repo = context.repo.repo;
// Close the PR with a comment
await github.rest.issues.createComment({
owner,
repo,
issue_number: formatPrNumber,
body: `Closing this PR as the code formatting issues in the original PR have been resolved.`
});
await github.rest.pulls.update({
owner,
repo,
pull_number: formatPrNumber,
state: 'closed'
});
console.log(`Closed format PR #${formatPrNumber} as the original PR now passes formatting checks.`);
- name: Apply formatter if needed
if: steps.format_check.outputs.format_needs_fix == 'true'
run: |
make format
- name: Commit changes and create/update PR
if: steps.format_check.outputs.format_needs_fix == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "🤖 Auto-format Julia code"
title: "🤖 Auto-format Julia code"
body: |
This PR was automatically created to fix Julia code formatting issues.
The formatting was applied using JuliaFormatter according to the project's style guidelines.
Please review the changes and merge if appropriate.
branch: auto-format-${{ github.event.pull_request.number }}
base: ${{ github.head_ref }}
delete-branch: true
labels: |
automated pr
code style
id: create-pr
- name: Comment on original PR
if: steps.format_check.outputs.format_needs_fix == 'true' && steps.create-pr.outputs.pull-request-number && steps.find_pr.outputs.result == ''
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const prNumber = ${{ github.event.pull_request.number }};
const formatPrNumber = ${{ steps.create-pr.outputs.pull-request-number }};
const formatPrUrl = `https://github.com/${{ github.repository }}/pull/${formatPrNumber}`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: `## 🤖 Code Formatting
This PR has some code formatting issues. I've created [PR #${formatPrNumber}](${formatPrUrl}) with the necessary formatting changes.
You can merge that PR into this branch to fix the code style check.
Alternatively, you can run \`make format\` locally and push the changes yourself.`
});
- name: Comment on original PR for updated formatting PR
if: steps.format_check.outputs.format_needs_fix == 'true' && steps.create-pr.outputs.pull-request-number && steps.find_pr.outputs.result != ''
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const prNumber = ${{ github.event.pull_request.number }};
const formatPrNumber = ${{ steps.create-pr.outputs.pull-request-number }};
const formatPrUrl = `https://github.com/${{ github.repository }}/pull/${formatPrNumber}`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: `## 🤖 Code Formatting
Your PR still has some code formatting issues. I've updated [PR #${formatPrNumber}](${formatPrUrl}) with the necessary formatting changes.
You can merge that PR into this branch to fix the code style check.
Alternatively, you can run \`make format\` locally and push the changes yourself.`
});
# Fail the job if formatting was needed and applied
- name: Fail if formatting was needed
if: steps.format_check.outputs.format_needs_fix == 'true'
run: |
echo "::error::Code formatting issues detected. A PR with fixes has been created, but this check is failing to indicate that formatting needs to be fixed."
exit 1