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 pre-commit code checks #145

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all 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
57 changes: 57 additions & 0 deletions .github/workflows/codechecks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Code checks

on:
pull_request:
push:
branches: ["main"]

jobs:

pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

explicit-imports:
runs-on: ubuntu-latest
name: "ExplicitImports.jl"
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- name: Install dependencies
shell: julia {0}
run: |
# Add ExplicitImports.jl and packages that Thunderbolt has extensions for
using Pkg
Pkg.add([
PackageSpec(name = "ExplicitImports", version = "1.6"),
# PackageSpec(name = "Metis"),
# PackageSpec(name = "BlockArrays"),
])
- name: ExplicitImports.jl code checks
shell: julia --project {0}
run: |
using Thunderbolt, ExplicitImports
# Check Thundebolt
allow_unanalyzable = (,) # baremodules
check_no_implicit_imports(Thunderbolt; allow_unanalyzable)
check_no_stale_explicit_imports(Thunderbolt; allow_unanalyzable)
check_all_qualified_accesses_via_owners(Thunderbolt)
check_no_self_qualified_accesses(Thunderbolt)
# Check extension modules
# for ext in (:ThunderboltBlockArrays, :ThunderboltMetis)
# extmod = Base.get_extension(Thunderbolt, ext)
# if extmod !== nothing
# check_no_implicit_imports(extmod)
# check_no_stale_explicit_imports(extmod)
# check_all_qualified_accesses_via_owners(extmod)
# check_no_self_qualified_accesses(extmod)
# else
# @warn "$(ext) extensions not available."
# end
# end
Loading