|
| 1 | +# This is largely copied from: |
| 2 | +# https://github.com/SciML/ModelingToolkit.jl/blob/master/.github/workflows/Downstream.yml |
| 3 | +# License: MIT |
| 4 | + |
| 5 | +name: Downstream |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - master |
| 11 | + - release-* |
| 12 | + tags: ["*"] |
| 13 | + pull_request: |
| 14 | + |
| 15 | +concurrency: |
| 16 | + # Skip intermediate builds: all builds except for builds on the `master` or `release-*` branches |
| 17 | + # Cancel intermediate builds: only pull request builds |
| 18 | + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref != 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release-') || github.run_number }} |
| 19 | + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: read |
| 23 | + |
| 24 | +jobs: |
| 25 | + downstream: |
| 26 | + runs-on: ${{ matrix.os }} |
| 27 | + strategy: |
| 28 | + fail-fast: false |
| 29 | + matrix: |
| 30 | + julia-version: |
| 31 | + - 'lts' |
| 32 | + - '1' |
| 33 | + os: |
| 34 | + - ubuntu-latest |
| 35 | + package: |
| 36 | + - {user: JuliaRegistries, repo: Registrator.jl} |
| 37 | + - {user: JuliaRegistries, repo: RegistryCI.jl, subdir: RegistryCI} |
| 38 | + - {user: GunnarFarneback, repo: LocalRegistry.jl} |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v6 |
| 41 | + with: |
| 42 | + persist-credentials: false |
| 43 | + - uses: julia-actions/setup-julia@v2 |
| 44 | + with: |
| 45 | + version: ${{ matrix.julia-version }} |
| 46 | + - name: Clone Downstream |
| 47 | + uses: actions/checkout@v6 |
| 48 | + with: |
| 49 | + repository: ${{ matrix.package.user }}/${{ matrix.package.repo }} |
| 50 | + path: downstream |
| 51 | + - name: Load this and run the downstream tests |
| 52 | + shell: julia --color=yes {0} |
| 53 | + env: |
| 54 | + GITHUB_TOKEN: ${{ (matrix.package.repo == 'Registrator.jl') && secrets.GITHUB_TOKEN || '' }} |
| 55 | + PACKAGE_SUBDIR: ${{ matrix.package.subdir }} |
| 56 | + JULIA_PKG_UNPACK_REGISTRY: ${{ matrix.package.repo == 'RegistryCI.jl' }} # RegistryCI needs an unpacked registry |
| 57 | + run: | |
| 58 | + import Pkg |
| 59 | + using Pkg: PackageSpec |
| 60 | + const subdir = strip(ENV["PACKAGE_SUBDIR"]) |
| 61 | + @info "" subdir |
| 62 | + Pkg.activate("downstream/$subdir") |
| 63 | + @info "" Base.active_project() |
| 64 | + try |
| 65 | + # force it to use this PR's version of the package |
| 66 | + Pkg.develop(PackageSpec(path=".")) # resolver may fail with main deps |
| 67 | + Pkg.update() |
| 68 | + Pkg.test() # resolver may fail with test time deps |
| 69 | + catch err |
| 70 | + err isa Pkg.Resolve.ResolverError || rethrow() |
| 71 | + # If we can't resolve that means this is incompatible by SemVer and this is fine |
| 72 | + # It means we marked this as a breaking change, so we don't need to worry about |
| 73 | + # Mistakenly introducing a breaking change, as we have intentionally made one |
| 74 | + @info "Not compatible with this release. No problem." exception=err |
| 75 | + exit(0) # Exit immediately, as a success |
| 76 | + end |
0 commit comments