Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add formatting check action and apply an initial format #984

Merged
merged 6 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
style = "blue"
annotate_untyped_fields_with_any = false
short_to_long_function_def = false
trailing_comma = "nothing"
always_use_return = false
import_to_using = false
align_struct_field = true
align_conditional = true
align_assignment = true
align_pair_arrow = true
12 changes: 6 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
sudo apt-get install mpich libhdf5-mpich-dev
echo "JULIA_HDF5_PATH=/usr/lib/x86_64-linux-gnu/hdf5/mpich/" >> $GITHUB_ENV
echo "JULIA_MPI_BINARY=system" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.version }}
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
- version: '1.3'
os: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.version }}
Expand All @@ -78,7 +78,7 @@ jobs:
env:
JULIA_DEBUG: Main
- uses: julia-actions/julia-processcoverage@latest
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v3
with:
file: lcov.info

Expand All @@ -99,14 +99,14 @@ jobs:
- {user: JuliaIO, repo: MAT.jl}
- {user: JuliaIO, repo: JLD.jl}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/julia-buildpkg@latest
- name: Clone ${{ matrix.package.repo }}
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: ${{ matrix.package.user }}/${{ matrix.package.repo }}
path: downstream
Expand All @@ -131,7 +131,7 @@ jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-docdeploy@latest
env:
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/Format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: format

on:
push:
branches:
- 'master'
- 'release-'
tags: '*'
pull_request:

jobs:
check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: ['1']
julia-arch: [x64]
os: [ubuntu-latest]
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}

- uses: actions/checkout@v3
- name: Install JuliaFormatter and format
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
julia -e 'using JuliaFormatter; format(["src", "test", "deps", "filters", "gen"], verbose=true)'
- name: Format check
run: |
julia -e '
out = Cmd(`git diff --name-only`) |> read |> String
if out == ""
exit(0)
else
@error "Some files have not been formatted !!!"
write(stdout, out)
exit(1)
end'
9 changes: 4 additions & 5 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ using Libdl

const depsfile = joinpath(@__DIR__, "deps.jl")

libpath = get(ENV, "JULIA_HDF5_PATH",
get(ENV, "JULIA_HDF5_LIBRARY_PATH", nothing)) # legacy env variable for compatibility
libpath = get(ENV, "JULIA_HDF5_PATH", get(ENV, "JULIA_HDF5_LIBRARY_PATH", nothing)) # legacy env variable for compatibility

# We avoid calling Libdl.find_library to avoid possible segfault when calling
# dlclose (#929).
# The only difference with Libdl.find_library is that we allow custom dlopen
# flags via the `flags` argument.
function find_library_alt(libnames, extrapaths=String[]; flags = RTLD_LAZY)
function find_library_alt(libnames, extrapaths=String[]; flags=RTLD_LAZY)
for lib in libnames
for path in extrapaths
l = joinpath(path, lib)
Expand Down Expand Up @@ -44,8 +43,8 @@ else
libpaths = [libpath, joinpath(libpath, "lib"), joinpath(libpath, "lib64")]
flags = RTLD_LAZY | RTLD_NODELETE # RTLD_NODELETE may be needed to avoid segfault (#929)

libhdf5 = find_library_alt(["libhdf5"], libpaths; flags = flags)
libhdf5_hl = find_library_alt(["libhdf5_hl"], libpaths; flags = flags)
libhdf5 = find_library_alt(["libhdf5"], libpaths; flags=flags)
libhdf5_hl = find_library_alt(["libhdf5_hl"], libpaths; flags=flags)

isempty(libhdf5) && error("libhdf5 could not be found")
isempty(libhdf5_hl) && error("libhdf5_hl could not be found")
Expand Down
Loading