Skip to content

Commit a174100

Browse files
Merge branch 'main' into dpa/using
2 parents 8eed2b6 + 26d4923 commit a174100

File tree

4 files changed

+88
-9
lines changed

4 files changed

+88
-9
lines changed

.github/dependabot.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"
7+
open-pull-requests-limit: 100
8+
labels:
9+
- "dependencies"
10+
- "github-actions"

.github/workflows/Invalidations.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Example
2+
3+
on:
4+
pull_request:
5+
6+
# defaults:
7+
# run:
8+
# working-directory: ./ci/
9+
10+
concurrency:
11+
# Skip intermediate builds: always.
12+
# Cancel intermediate builds: always.
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
example:
18+
# Only run on PRs to the default branch.
19+
# In the PR trigger above branches can be specified only explicitly whereas this check should work for master, main, or any other default branch
20+
# if: github.base_ref == github.event.repository.default_branch
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: julia-actions/setup-julia@v2
24+
with:
25+
version: '1'
26+
- uses: actions/checkout@v3
27+
- run: |
28+
import Pkg
29+
p = Pkg.PackageSpec(name = "Example", version = "0.5", uuid = "7876af07-990d-54b4-ab0e-23690620f79a")
30+
Pkg.add(p)
31+
shell: julia {0}
32+
# - uses: julia-actions/julia-invalidations@v1
33+
- uses: ./
34+
id: invs_pro
35+
with:
36+
test_script: 'import Example'
37+
package_name: 'Example'
38+
39+
# - uses: julia-actions/julia-invalidations@v1
40+
- uses: ./
41+
id: invs_default
42+
with:
43+
test_script: 'import Example'
44+
package_name: 'Example'
45+
46+
- name: Report invalidation counts
47+
run: |
48+
echo "Invalidations on default branch: ${{ steps.invs_default.outputs.total }} (${{ steps.invs_default.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY
49+
echo "This branch: ${{ steps.invs_pr.outputs.total }} (${{ steps.invs_pr.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY
50+
- name: Check if the PR does increase number of invalidations
51+
if: steps.invs_pr.outputs.total > steps.invs_default.outputs.total
52+
run: exit 1

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# julia-invalidations
2-
Uses [`SnoopCompile.@snoopr`](https://timholy.github.io/SnoopCompile.jl/stable/snoopr/)
3-
to evaluate number of invalidations caused by `using Package` or a provided script
2+
Uses [`SnoopCompile.@snoopr`](https://timholy.github.io/SnoopCompile.jl/v2/snoopr/)
3+
to evaluate number of invalidations caused by `using Package` or a provided script.
4+
5+
Currently this action uses SnoopCompile v2.
6+
In a future release, we will upgrade to SnoopCompile v3.
47

58

69
## Usage

action.yml

+21-7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ inputs:
66
description: 'Script to test for invalidations. Defaults to `import Package`'
77
required: false
88
default: ''
9+
package_name:
10+
description: 'Name of the package. By default, tries to auto-detect from the repo name.'
11+
required: false
12+
default: ''
13+
type: string
14+
max_invalidations:
15+
description: 'Maximum number of invalidations to report. Defaults to `0` (no limit)'
16+
required: false
17+
default: '0'
18+
type: number
919

1020
outputs:
1121
total:
@@ -22,12 +32,16 @@ runs:
2232
id: info
2333
run: |
2434
REPONAME="${{ github.event.repository.name }}"
25-
PACKAGENAME=${REPONAME%.jl}
35+
if [[ '${{ inputs.package_name }}' == '' ]]; then
36+
PACKAGENAME=${REPONAME%.jl}
37+
else
38+
PACKAGENAME="${{ inputs.package_name }}"
39+
fi
2640
echo "packagename=$PACKAGENAME" >> $GITHUB_OUTPUT
2741
if [[ '${{ inputs.test_script }}' == '' ]]; then
2842
TESTSCRIPT="import ${PACKAGENAME}"
2943
else
30-
TESTSCRIPT=${{ inputs.test_script }}
44+
TESTSCRIPT="${{ inputs.test_script }}"
3145
fi
3246
echo "testscript=$TESTSCRIPT" >> $GITHUB_OUTPUT
3347
shell: bash
@@ -36,12 +50,12 @@ runs:
3650
run: |
3751
import Pkg;
3852
pkgs = [
39-
Pkg.PackageSpec(name = "SnoopCompile", version = "2"),
40-
Pkg.PackageSpec(name = "SnoopCompileCore"),
41-
Pkg.PackageSpec(name = "PrettyTables"),
53+
Pkg.PackageSpec(name = "SnoopCompile", version = "2", uuid = "aa65fe97-06da-5843-b5b1-d5d13cad87d2"),
54+
Pkg.PackageSpec(name = "SnoopCompileCore", uuid = "e2b509da-e806-4183-be48-004708413034"),
55+
Pkg.PackageSpec(name = "PrettyTables", uuid = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"),
4256
]
4357
Pkg.add(pkgs)
44-
shell: julia --project
58+
shell: julia --project {0}
4559
- name: Load package on branch
4660
id: invs
4761
run: |
@@ -60,7 +74,7 @@ runs:
6074
SnoopCompile.report_invalidations(;
6175
invalidations,
6276
process_filename = x -> last(split(x, ".julia/packages/")),
63-
n_rows = 0, # no-limit (show all invalidations)
77+
n_rows = ${{ inputs.max_invalidations }},
6478
)
6579
6680
# Set outputs

0 commit comments

Comments
 (0)