Skip to content

Add regression tests for docstring issues #15

Add regression tests for docstring issues

Add regression tests for docstring issues #15

Workflow file for this run

name: Integration
env:
FORMATTER_OPTS: "--ignore-config --v2-stable-multiline-strings=true --conditional-to-if=false --pipe-to-function-call=false"
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
integration:
name: ${{ matrix.style }}-${{ matrix.version }}
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
style:
- default
- blue
version:
- '1'
- 'pre'
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # 7.0.0
with:
path: formatter
- uses: julia-actions/setup-julia@fa02766e078afaaf09b14210362cee14137e6a32 # 3.0.2
with:
version: ${{ matrix.version }}
- uses: julia-actions/cache@a45e8fa8be21c18a06b7177052533149e61e9b38 # 3.1.0
- name: Cache target repos
id: cache-repos
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # 6.1.0
with:
path: target
key: repos-${{ github.run_id }}
restore-keys: |
repos-
- name: Clone target repos
env:
GH_TOKEN: ${{ github.token }}
run: |
for org in JuliaLang JuliaPlots MakieOrg SciML JuliaDiff JuliaStats TuringLang EnzymeAD jump-dev trixi-framework oscar-system; do
for name in $(gh repo list "$org" --limit 1000 --json name,isFork,pushedAt --jq '.[] | select(((.name | endswith(".jl")) or .name == "julia") and (.isFork | not) and (.pushedAt >= "2024-01-01")) | .name'); do
dest="target/$org/$name"
[[ -d "$dest" ]] && continue
echo "Cloning $org/$name ..."
git clone --depth 1 --quiet "https://github.com/$org/$name" "$dest"
done
done
- name: Remove unparseable files
shell: julia --color=yes --project=formatter {0}
run: |
using Pkg
Pkg.instantiate()
using JuliaSyntax: parseall, GreenNode
for (root, _, files) in walkdir("target")
for f in files
endswith(f, ".jl") || continue
path = joinpath(root, f)
try
parseall(GreenNode, read(path, String); ignore_warnings=true)
catch
println("Removing unparseable file: $path")
rm(path)
end
end
end
- name: Count Julia files and lines
run: |
files=$(find target -name '*.jl' -type f | wc -l)
lines=$(find target -name '*.jl' -type f -print0 | xargs -0 cat | wc -l)
echo "Formatting $files files, $lines lines of Julia"
- name: Format (pass 1)
working-directory: target
run: |
julia --project=../formatter -m JuliaFormatter --inplace --style=${{ matrix.style }} ${{ env.FORMATTER_OPTS }} .
- name: Check idempotence (pass 2)
working-directory: target
run: |
julia --project=../formatter -m JuliaFormatter --check --diff --style=${{ matrix.style }} ${{ env.FORMATTER_OPTS }} .