Skip to content

Commit e21cb5c

Browse files
authored
Merge 4815f38 into c001dab
2 parents c001dab + 4815f38 commit e21cb5c

File tree

4 files changed

+62
-14
lines changed

4 files changed

+62
-14
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: CI
22
env:
33
JULIA_NUM_THREADS: 2
4+
concurrency:
5+
# group by workflow and ref; the last slightly strange component ensures that for pull
6+
# requests, we limit to 1 concurrent job, but for the master branch we don't
7+
group: ${{ github.workflow }}-${{ github.ref }}-${{ (github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main') || github.run_number }}
8+
# Cancel intermediate builds, but only if it is a pull request build.
9+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
410
on:
511
pull_request:
612
branches:
@@ -32,16 +38,7 @@ jobs:
3238
with:
3339
version: ${{ matrix.version }}
3440
arch: ${{ matrix.arch }}
35-
- uses: actions/cache@v4
36-
env:
37-
cache-name: cache-artifacts
38-
with:
39-
path: ~/.julia/artifacts
40-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
41-
restore-keys: |
42-
${{ runner.os }}-test-${{ env.cache-name }}-
43-
${{ runner.os }}-test-
44-
${{ runner.os }}-
41+
- uses: julia-actions/cache@v2
4542
- uses: julia-actions/julia-buildpkg@v1
4643
- uses: julia-actions/julia-runtest@v1
4744
- uses: julia-actions/julia-processcoverage@v1

.github/workflows/prprecommit.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: PR Pre-Commit Bot
2+
env:
3+
JULIA_NUM_THREADS: 2
4+
concurrency:
5+
# group by workflow and ref; the last slightly strange component ensures that for pull
6+
# requests, we limit to 1 concurrent job, but for the master branch we don't
7+
group: ${{ github.workflow }}-${{ github.ref }}-${{ (github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main') || github.run_number }}
8+
# Cancel intermediate builds, but only if it is a pull request build.
9+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
10+
on:
11+
pull_request:
12+
branches: ["master", "main"]
13+
jobs:
14+
pre-commit:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
with:
20+
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
21+
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
22+
- name: Setup Julia
23+
uses: julia-actions/setup-julia@v2
24+
with:
25+
version: '1'
26+
- uses: julia-actions/cache@v2
27+
- name: Setup JuliaFormatter
28+
run: |
29+
julia -e '
30+
using Pkg
31+
Pkg.add(name="JuliaFormatter", version="1.0.62")'
32+
- name: Setup Python
33+
uses: actions/setup-python@v3
34+
- name: Run pre-commit
35+
uses: pre-commit/[email protected]
36+
continue-on-error: true
37+
- name: Commit files
38+
run: |
39+
git config --local user.email "[email protected]"
40+
git config --local user.name "PR Pre-Commit Bot"
41+
git diff-index --quiet HEAD || git commit -m "add bot commits" -a
42+
- name: Push changes
43+
uses: ad-m/[email protected]
44+
with:
45+
github_token: ${{ secrets.GITHUB_TOKEN }}
46+
branch: ${{ github.head_ref }}

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
repos:
2+
- repo: "https://github.com/domluna/JuliaFormatter.jl"
3+
rev: "v1.0.62"
4+
hooks:
5+
- id: "julia-formatter"

src/core.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ julia> is_ordered(first(edges(g)))
2323
false
2424
```
2525
"""
26-
is_ordered(e::AbstractEdge) = src(e) <= dst(e)
26+
is_ordered(e::AbstractEdge ) = src(e) <= dst(e)
2727

2828
"""
2929
add_vertices!(g, n)
@@ -48,7 +48,7 @@ add_vertices!(g::AbstractGraph, n::Integer) = sum([add_vertex!(g) for i in 1:n])
4848
indegree(g[, v])
4949
5050
Return a vector containing the indegrees of every vertex of the graph `g`, where
51-
the indegree of a vertex is defined as the number of edges which end at that
51+
the indegree of a vertex is defined as the number of edges which end at that
5252
vertex. If `v` is specified and is a single vertex, only return the indegree of
5353
`v`. If `v` is specified and is a vector of vertices, only return the indegrees
5454
of the vertices in `v`.
@@ -85,7 +85,7 @@ indegree(g::AbstractGraph, vs=vertices(g)) = [indegree(g, x) for x in vs]
8585
outdegree(g[, v])
8686
8787
Return a vector containing the outdegrees of every vertex of the graph `g`, where
88-
the outdegree of a vertex is defined as the number of edges which start at that
88+
the outdegree of a vertex is defined as the number of edges which start at that
8989
vertex. If `v` is specified and is a single vertex, only return the outdegree of
9090
`v`. If `v` is specified and is a vector of vertices, only return the outdegrees
9191
of the vertices in `v`.
@@ -124,7 +124,7 @@ outdegree(g::AbstractGraph, vs=vertices(g)) = [outdegree(g, x) for x in vs]
124124
Return a vector containing the degrees of every vertex of the graph `g`, where
125125
the degree of a vertex is defined as the number of edges which start or end at
126126
that vertex. For directed graphs, the degree of a vertex is equal to the sum of
127-
its indegree and outdegree. If `v` is specified and is a single vertex, only
127+
its indegree and outdegree. If `v` is specified and is a single vertex, only
128128
return the degree of `v`. If `v` is specified and is a vector of vertices, only
129129
return the degrees of the vertices in `v`.
130130

0 commit comments

Comments
 (0)