|
| 1 | +name: "Reusable IntegrationTest Workflow" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + julia-version: |
| 7 | + description: "Julia version" |
| 8 | + default: "1" |
| 9 | + required: false |
| 10 | + type: string |
| 11 | + repo: |
| 12 | + description: "Repository name, including the group/user, such as ITensor/ITensors.jl" |
| 13 | + required: true |
| 14 | + type: string |
| 15 | + local-registry-urls: |
| 16 | + description: 'Registries besides General to use. Specified by providing the url (https/ssh) to the Github |
| 17 | + repositories as a newline (\n) seperated list. Defaults to including the ITensorRegistry |
| 18 | + (https://github.com/ITensor/ITensorRegistry.git).' |
| 19 | + default: "" |
| 20 | + required: false |
| 21 | + type: string |
| 22 | + |
| 23 | +jobs: |
| 24 | + test: |
| 25 | + name: ${{ inputs.repo }} |
| 26 | + runs-on: ${{ matrix.os }} |
| 27 | + strategy: |
| 28 | + fail-fast: false |
| 29 | + matrix: |
| 30 | + os: [ubuntu-latest] |
| 31 | + |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v4 |
| 34 | + - uses: julia-actions/setup-julia@v2 |
| 35 | + with: |
| 36 | + version: ${{ inputs.julia-version }} |
| 37 | + arch: x64 |
| 38 | + localregistry: https://github.com/ITensor/ITensorRegistry.git |
| 39 | + - uses: julia-actions/julia-buildpkg@latest |
| 40 | + - name: Clone Downstream |
| 41 | + uses: actions/checkout@v4 |
| 42 | + with: |
| 43 | + repository: ${{ inputs.repo }} |
| 44 | + path: downstream |
| 45 | + - name: Load this and run the downstream tests |
| 46 | + shell: julia --color=yes --project=downstream {0} |
| 47 | + run: | |
| 48 | + using Pkg |
| 49 | + # If provided add local registries |
| 50 | + if !isempty("${{ inputs.local-registry-urls }}") |
| 51 | + registry_urls = split("${{ inputs.local-registry-urls }}", "\n") .|> string |
| 52 | + for registry_url in registry_urls |
| 53 | + isempty(registry_url) && continue |
| 54 | + Pkg.Registry.add(Pkg.RegistrySpec(; url=registry_url)) |
| 55 | + end |
| 56 | + end |
| 57 | + try |
| 58 | + # force it to use this PR's version of the package |
| 59 | + Pkg.develop(PackageSpec(path=".")) # resolver may fail with main deps |
| 60 | + Pkg.update() |
| 61 | + Pkg.test(coverage=true) # resolver may fail with test time deps |
| 62 | + catch err |
| 63 | + err isa Pkg.Resolve.ResolverError || rethrow() |
| 64 | + # If we can't resolve that means this is incompatible by SemVer and this is fine |
| 65 | + # It means we marked this as a breaking change, so we don't need to worry about |
| 66 | + # Mistakenly introducing a breaking change, as we have intentionally made one |
| 67 | + @info "Not compatible with this release. No problem." exception=err |
| 68 | + exit(0) # Exit immediately, as a success |
| 69 | + end |
0 commit comments