Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 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
52 changes: 52 additions & 0 deletions .github/workflows/Invalidations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Example

on:
pull_request:

# defaults:
# run:
# working-directory: ./ci/

concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: always.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
example:
# Only run on PRs to the default branch.
# In the PR trigger above branches can be specified only explicitly whereas this check should work for master, main, or any other default branch
# if: github.base_ref == github.event.repository.default_branch
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: actions/checkout@v3
- run: |
import Pkg
p = Pkg.PackageSpec(name = "Example", version = "0.5", uuid = "7876af07-990d-54b4-ab0e-23690620f79a")
Pkg.add(p)
shell: julia {0}
# - uses: julia-actions/julia-invalidations@v1
- uses: ./
id: invs_pro
with:
test_script: 'import Example'
package_name: 'Example'

# - uses: julia-actions/julia-invalidations@v1
- uses: ./
id: invs_default
with:
test_script: 'import Example'
package_name: 'Example'

- name: Report invalidation counts
run: |
echo "Invalidations on default branch: ${{ steps.invs_default.outputs.total }} (${{ steps.invs_default.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY
echo "This branch: ${{ steps.invs_pr.outputs.total }} (${{ steps.invs_pr.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY
- name: Check if the PR does increase number of invalidations
if: steps.invs_pr.outputs.total > steps.invs_default.outputs.total
run: exit 1
10 changes: 9 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ inputs:
description: 'Script to test for invalidations. Defaults to `using Package`'
required: false
default: ''
package_name:
description: 'Name of the package. By default, tries to auto-detect from the repo name.'
required: false
default: ''

outputs:
total:
Expand All @@ -22,7 +26,11 @@ runs:
id: info
run: |
REPONAME="${{ github.event.repository.name }}"
PACKAGENAME=${REPONAME%.jl}
if [[ '${{ inputs.package_name }}' == '' ]]; then
PACKAGENAME=${REPONAME%.jl}
else
PACKAGENAME="${{ inputs.package_name }}"
fi
echo "packagename=$PACKAGENAME" >> $GITHUB_OUTPUT
if [[ '${{ inputs.test_script }}' == '' ]]; then
TESTSCRIPT="using ${PACKAGENAME}"
Expand Down