-
Notifications
You must be signed in to change notification settings - Fork 3
138 lines (131 loc) · 5.4 KB
/
Copy pathIntegration.yml
File metadata and controls
138 lines (131 loc) · 5.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Integration
on:
push:
branches:
- main
tags: "*"
pull_request:
workflow_dispatch:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
test:
name: ${{ matrix.package.name }} - Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
permissions:
# needed to allow julia-actions/cache to proactively delete old caches that it has created
actions: write
contents: read
strategy:
fail-fast: false
matrix:
version:
- "1"
os:
- ubuntu-latest
package:
- { name: XPalm, user: PalmStudio, repo: XPalm.jl, branch: main, default: main }
- { name: PlantBiophysics, user: VEZY, repo: PlantBiophysics.jl, branch: master, default: master }
- { name: PlantGeom, user: VEZY, repo: PlantGeom.jl, branch: main, default: main }
steps:
- uses: actions/checkout@v7
- uses: julia-actions/setup-julia@v3
with:
version: ${{ matrix.version }}
- name: Cache Julia packages
uses: julia-actions/cache@v3
- name: Test the integration source configuration
shell: julia --color=yes {0}
run: include(joinpath(pwd(), ".github", "scripts", "test_configure_local_sources.jl"))
- uses: julia-actions/julia-buildpkg@v1
- name: Clone Downstream
uses: actions/checkout@v7
with:
repository: ${{ matrix.package.user }}/${{ matrix.package.repo }}
ref: ${{ matrix.package.branch }}
path: downstream
- name: Clone PlantGeom for XPalm
if: ${{ matrix.package.name == 'XPalm' }}
uses: actions/checkout@v7
with:
repository: VEZY/PlantGeom.jl
ref: main
path: sources/PlantGeom
- name: Configure local integration sources
env:
DOWNSTREAM_PACKAGE: ${{ matrix.package.name }}
shell: julia --color=yes {0}
run: |
include(joinpath(pwd(), ".github", "scripts", "configure_local_sources.jl"))
project_files = (
joinpath(pwd(), "downstream", "Project.toml"),
joinpath(pwd(), "downstream", "test", "Project.toml"),
)
source_roots = String[pwd()]
if ENV["DOWNSTREAM_PACKAGE"] == "XPalm"
push!(source_roots, joinpath(pwd(), "sources", "PlantGeom"))
end
summaries = IntegrationSourceConfig.configure_local_sources!(project_files, source_roots)
@info "Configured local integration sources" package=ENV["DOWNSTREAM_PACKAGE"] summaries
- name: Verify the PlantGeom test source
if: ${{ matrix.package.name == 'PlantGeom' }}
shell: julia --color=yes --project=downstream/test {0}
run: |
using Pkg
Pkg.resolve()
pse = get(
Pkg.dependencies(),
Base.UUID("9a576370-710b-4269-adf9-4f603a9c6423"),
nothing,
)
pse === nothing && error("PlantSimEngine was not resolved in the PlantGeom test environment")
pse.is_tracking_path || error("PlantSimEngine is not tracking a local path")
realpath(pse.source) == realpath(pwd()) || error(
"PlantSimEngine resolved to $(pse.source), expected $(realpath(pwd()))",
)
@info "Verified local PlantSimEngine test source" path=pse.source
- name: Run the downstream tests
env:
DOWNSTREAM_PACKAGE: ${{ matrix.package.name }}
shell: julia --threads 4 --color=yes --project=downstream --depwarn=yes {0}
run: |
using Pkg
Pkg.resolve()
function assert_path_dependency(name, uuid, expected_path)
package = get(Pkg.dependencies(), Base.UUID(uuid), nothing)
package === nothing && error("$(name) was not resolved")
package.is_tracking_path || error("$(name) is not tracking a local path")
realpath(package.source) == realpath(expected_path) || error(
"$(name) resolved to $(package.source), expected $(realpath(expected_path))",
)
@info "Verified local integration source" name path=package.source
end
if ENV["DOWNSTREAM_PACKAGE"] != "PlantGeom"
assert_path_dependency(
"PlantSimEngine",
"9a576370-710b-4269-adf9-4f603a9c6423",
pwd(),
)
end
if ENV["DOWNSTREAM_PACKAGE"] == "XPalm"
assert_path_dependency(
"PlantGeom",
"5edaa67e-25db-4eb9-bf81-05d793b2238d",
joinpath(pwd(), "sources", "PlantGeom"),
)
end
Pkg.status()
Pkg.test()
- name: Only succeed if the checks pass on the dependencies' main/master branches
if: ${{ matrix.package.branch != matrix.package.default }}
run: |
echo "This action requires the downstream dependencies' branches to be set to their main/master to succeed. Please switch them back and ensure tests pass before merging"
exit 1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v7
with:
files: lcov.info