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

introduce setup script #15

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@ jobs:
```

By default, the action will evaluate `using Package` where `Package` is the name of the julia repo that the action runs on.
A custom script can be provided by passing `test_script`. Note that both runs should be given the same script
A custom script can be provided by passing `test_script`. If it is necessary to setup alter the environment the code is run in, you can pass a `setup_script` with the necessary Pkg operations. Note that both runs should be given the same script

i.e.
```yaml
- uses: julia-actions/julia-invalidations@v1
id: invs_pr
with:
test_script: 'using Package; Package.foo(1)'
setup_script: 'using Pkg; Pkg.develop(["Foo", "Bar"])'
```
11 changes: 9 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,21 @@ runs:
TESTSCRIPT=${{ inputs.test_script }}
fi
echo "testscript=$TESTSCRIPT" >> $GITHUB_OUTPUT
if [[ '${{ inputs.setup_script }}' == '' ]]; then
SETUPSCRIPT="using Pkg;Pkg.develop(\"${PACKAGENAME}\")"
else
SETUPSCRIPT=${{ inputs.setup_script }}
fi
echo "setupscript=$SETUPSCRIPT" >> $GITHUB_OUTPUT
shell: bash

- name: Install SnoopCompile tools
run: julia --project -e 'using Pkg; Pkg.add(["SnoopCompileCore", "SnoopCompile", "PrettyTables"])'
run: julia 'using Pkg; Pkg.add(["SnoopCompileCore", "SnoopCompile", "PrettyTables"])'
shell: bash
- name: Load package on branch
id: invs
run: |
${{ steps.info.outputs.setupscript }}
using SnoopCompileCore
invalidations = @snoopr begin ${{ steps.info.outputs.testscript }} end

Expand All @@ -61,4 +68,4 @@ runs:
println(io, "total=$(inv_total)")
println(io, "deps=$(inv_deps)")
end
shell: julia --color=yes --project=. {0}
shell: julia --color=yes {0}