-
Notifications
You must be signed in to change notification settings - Fork 15
214 lines (210 loc) · 7.36 KB
/
tests.yml
File metadata and controls
214 lines (210 loc) · 7.36 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: Testing
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
concurrency:
# Skip intermediate builds: always.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true # always cancle old runs on new push
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
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:
- 'lts'
- '1'
- 'pre'
os:
- ubuntu-latest
# - macos-latest
# - windows-latest
arch:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- name: Load Julia packages from cache
id: julia-cache
uses: julia-actions/cache@v2
- uses: hexaeder/julia-buildpkg@main
- uses: julia-actions/julia-runtest@v1
with:
coverage: false
- name: Save Julia depot cache on cancel or failure
id: julia-cache-save
if: cancelled() || failure()
uses: actions/cache/save@v4
with:
path: |
${{ steps.julia-cache.outputs.cache-paths }}
key: ${{ steps.julia-cache.outputs.cache-key }}
test-coverage:
name: Test Coverage
runs-on: ubuntu-latest
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
actions: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: 1
arch: x64
- name: Load Julia packages from cache
id: julia-cache
uses: julia-actions/cache@v2
- uses: hexaeder/julia-buildpkg@main
- uses: julia-actions/julia-runtest@v1
env:
JULIA_COVERAGE: true
with:
coverage: true
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v4
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
- name: Save Julia depot cache on cancel or failure
id: julia-cache-save
if: cancelled() || failure()
uses: actions/cache/save@v4
with:
path: |
${{ steps.julia-cache.outputs.cache-paths }}
key: ${{ steps.julia-cache.outputs.cache-key }}
Inspector-tests:
name: NetworkDynamicsInspector.jl Tests
runs-on: ubuntu-latest
env:
DISPLAY: ":99"
LIBGL_ALWAYS_SOFTWARE: "1"
MESA_GL_VERSION_OVERRIDE: "4.5"
MESA_GLSL_VERSION_OVERRIDE: "450"
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created
actions: write
contents: read
steps:
- name: Install Dependencies
run: |
sudo apt update
sudo apt install -y xvfb mesa-utils mesa-vulkan-drivers dbus
- name: Start Virtual Display
run: |
Xvfb :99 -screen 0 1920x1080x24 &
eval $(dbus-launch)
export DBUS_SESSION_BUS_ADDRESS
export DBUS_SESSION_BUS_PID
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: 1
- name: Load Julia packages from cache
id: julia-cache
uses: julia-actions/cache@v2
- uses: hexaeder/julia-buildpkg@main
with:
project: NetworkDynamicsInspector
- name: Run headless test
uses: GabrielBB/xvfb-action@v1
with:
run: |
julia --project=NetworkDynamicsInspector --color=yes -e "using Pkg; Pkg.test(coverage=false)"
# - uses: julia-actions/julia-processcoverage@v1
# - uses: codecov/codecov-action@v4
# with:
# files: lcov.info
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: false
- name: Save Julia depot cache on cancel or failure
id: julia-cache-save
if: cancelled() || failure()
uses: actions/cache/save@v4
with:
path: |
${{ steps.julia-cache.outputs.cache-paths }}
key: ${{ steps.julia-cache.outputs.cache-key }}
PowerDynamics-test:
name: PowerDynamics.jl test - Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
permissions:
actions: write # needed to allow julia-actions/cache to proactively delete old caches that it has created
contents: write
pull-requests: read
strategy:
fail-fast: false
matrix:
version:
- '1'
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- name: Load Julia packages from cache
id: julia-cache
uses: julia-actions/cache@v2
- uses: hexaeder/julia-buildpkg@main
- name: Extract PowerDynamics branch from PR
id: extract-branch
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
PR_DATA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}")
PR_TITLE=$(echo "$PR_DATA" | jq -r '.title')
PR_BODY=$(echo "$PR_DATA" | jq -r '.body')
# Combine title and body for searching
PR_TEXT="$PR_TITLE $PR_BODY"
# Look for [powerdynamics:branch-name] pattern (case insensitive)
BRANCH_MATCH=$(echo "$PR_TEXT" | grep -i -o "\[powerdynamics:[^]]*\]" | head -n1)
if [[ -n "$BRANCH_MATCH" ]]; then
BRANCH_NAME=$(echo "$BRANCH_MATCH" | sed 's/\[[Pp][Oo][Ww][Ee][Rr][Dd][Yy][Nn][Aa][Mm][Ii][Cc][Ss]:\([^]]*\)\]/\1/i')
echo "Found PowerDynamics branch specification: $BRANCH_NAME"
echo "powerdynamics_branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
else
echo "No PowerDynamics branch specified, using main"
echo "powerdynamics_branch=main" >> $GITHUB_OUTPUT
fi
else
echo "Not a pull request, using main branch"
echo "powerdynamics_branch=main" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v4
with:
repository: JuliaEnergy/PowerDynamics.jl
ref: ${{ steps.extract-branch.outputs.powerdynamics_branch }}
path: PowerDynamics
- name: Run PowerDynamics tests
shell: julia --project=PowerDynamics/test --color=yes {0}
run: |
using Pkg
pkg"dev ." # dev NetworkDynamics
pkg"instantiate"
pkg"build"
Pkg.test("PowerDynamics"; coverage=false)
- name: Save Julia depot cache on cancel or failure
id: julia-cache-save
if: cancelled() || failure()
uses: actions/cache/save@v4
with:
path: |
${{ steps.julia-cache.outputs.cache-paths }}
key: ${{ steps.julia-cache.outputs.cache-key }}