-
Notifications
You must be signed in to change notification settings - Fork 11
140 lines (112 loc) · 4.96 KB
/
Copy pathjulia-version-consistency.yml
File metadata and controls
140 lines (112 loc) · 4.96 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
# Copyright 2025 The PECOS Developers
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
name: Julia version consistency
permissions:
contents: read
on:
push:
branches: [ "main", "master", "development", "dev" ]
pull_request:
branches: [ "main", "master", "development", "dev" ]
workflow_dispatch:
jobs:
check-julia-versions:
runs-on: ubuntu-latest
steps:
- name: Harden the runner (egress audit)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Check Julia version consistency
run: |
echo "Checking Julia version consistency across files..."
# Define the files to check
declare -A version_files=(
["PECOS.jl Project.toml"]="julia/PECOS.jl/Project.toml"
["pecos-julia-ffi Cargo.toml"]="julia/pecos-julia-ffi/Cargo.toml"
["build_tarballs.jl"]="julia/PECOS.jl/deps/build_tarballs.jl"
)
# Extract versions
echo "=== Extracting versions ==="
# PECOS.jl version
pecos_version=$(grep -E '^version = ".*"' julia/PECOS.jl/Project.toml | sed 's/version = "\(.*\)"/\1/')
echo "PECOS.jl version: $pecos_version"
# pecos-julia-ffi version
ffi_version=$(grep -E '^version = ".*"' julia/pecos-julia-ffi/Cargo.toml | sed 's/version = "\(.*\)"/\1/')
echo "pecos-julia-ffi version: $ffi_version"
# build_tarballs.jl version
bt_version=$(grep -E '^version = v".*"' julia/PECOS.jl/deps/build_tarballs.jl | sed 's/version = v"\([^"]*\)".*/\1/')
echo "build_tarballs.jl version: $bt_version"
# Check if all versions match
echo ""
echo "=== Version consistency check ==="
errors=0
if [ "$pecos_version" != "$ffi_version" ]; then
echo "ERROR: Version mismatch between PECOS.jl ($pecos_version) and pecos-julia-ffi ($ffi_version)"
errors=$((errors + 1))
fi
if [ "$pecos_version" != "$bt_version" ]; then
echo "ERROR: Version mismatch between PECOS.jl ($pecos_version) and build_tarballs.jl ($bt_version)"
errors=$((errors + 1))
fi
# Check Julia compat versions
echo ""
echo "=== Julia compatibility check ==="
julia_compat=$(grep -E 'julia = ".*"' julia/PECOS.jl/Project.toml | sed 's/julia = "\(.*\)"/\1/')
echo "PECOS.jl Julia compat: $julia_compat"
bt_julia_compat=$(grep -E 'julia_compat' julia/PECOS.jl/deps/build_tarballs.jl | grep -oE '"[0-9.]+"' | tr -d '"')
echo "build_tarballs.jl Julia compat: $bt_julia_compat"
if [ "$julia_compat" != "$bt_julia_compat" ]; then
echo "WARNING: Julia compatibility mismatch between PECOS.jl ($julia_compat) and build_tarballs.jl ($bt_julia_compat)"
fi
# Check library name consistency
echo ""
echo "=== Library name check ==="
lib_name_cargo=$(grep -E 'name = ".*"' julia/pecos-julia-ffi/Cargo.toml | head -1 | sed 's/name = "\(.*\)"/\1/')
echo "Cargo library name: $lib_name_cargo"
if [[ "$lib_name_cargo" != "pecos-julia-ffi" ]]; then
echo "ERROR: Unexpected library name in Cargo.toml: $lib_name_cargo"
errors=$((errors + 1))
fi
# Final result
echo ""
echo "=== Summary ==="
if [ $errors -eq 0 ]; then
echo "All version checks passed!"
else
echo "Found $errors version inconsistencies!"
exit 1
fi
- name: Check for version tags
run: |
echo "=== Checking for version tags ==="
# Get current version
version=$(grep -E '^version = ".*"' julia/PECOS.jl/Project.toml | sed 's/version = "\(.*\)"/\1/')
# Check if we're on a tag
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
tag_name="${GITHUB_REF#refs/tags/}"
echo "Current tag: $tag_name"
# Check if it's a Julia release tag
if [[ "$tag_name" == jl-* ]]; then
tag_version="${tag_name#jl-}"
if [ "$tag_version" != "$version" ]; then
echo "ERROR: Tag version ($tag_version) doesn't match package version ($version)"
exit 1
else
echo "Tag version matches package version"
fi
fi
else
echo "Not on a tag, skipping tag version check"
fi