-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (96 loc) · 3.4 KB
/
ci.yml
File metadata and controls
106 lines (96 loc) · 3.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
name: CI
on:
workflow_call:
inputs:
versions:
description: "Julia versions to test (JSON array)"
required: false
type: string
default: '["1.10","1.12"]'
runs_on:
description: "GitHub runner labels (e.g., 'ubuntu-latest' or JSON array for self-hosted like '[\"self-hosted\", \"Linux\", \"gpu\"]')"
required: false
type: string
default: '["ubuntu-latest","macos-latest","windows-latest"]'
archs:
description: "Julia architectures to test (JSON array, e.g., '[\"x64\"]' or '[\"x64\", \"aarch64\"]')"
required: false
type: string
default: '["x64"]'
runner_type:
description: "Runner type: 'github' for GitHub-hosted runners or 'self-hosted' for self-hosted runners"
required: false
type: string
default: 'github'
use_ct_registry:
description: "Whether the local ct-registry is added or not"
required: false
default: false
type: boolean
secrets:
SSH_KEY:
required: false
jobs:
test:
strategy:
matrix:
version: ${{ fromJSON(inputs.versions) }}
runs_on: ${{ fromJSON(inputs.runs_on) }}
arch: ${{ fromJSON(inputs.archs) }}
runs-on: ${{ matrix.runs_on }}
steps:
# ---------------------------
# Checkout Repository
# ---------------------------
- name: Checkout repository
uses: actions/checkout@v6
# ---------------------------
# Setup Julia Environment
# ---------------------------
- name: Setup Julia
uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
# ---------------------------
# Add ct-registry
# ---------------------------
- name: Add ct-registry
if: inputs.use_ct_registry && runner.os != 'Windows'
uses: julia-actions/add-julia-registry@v2
with:
key: ${{ secrets.SSH_KEY }}
registry: control-toolbox/ct-registry
# ---------------------------
# Julia caching (conditional based on runner type)
# ---------------------------
- name: Cache Julia packages (GitHub-hosted runners)
if: inputs.runner_type == 'github'
uses: julia-actions/cache@v2
- name: Cache Julia artifacts (self-hosted runners)
if: inputs.runner_type == 'self-hosted'
uses: actions/cache@v5
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- name: Cache Julia compiled code (self-hosted runners)
if: inputs.runner_type == 'self-hosted'
uses: actions/cache@v5
with:
path: ~/.julia/compiled
key: ${{ runner.os }}-julia-compiled-${{ matrix.version }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-julia-compiled-${{ matrix.version }}-
# ---------------------------
# Build and test
# ---------------------------
- name: Build Julia package
uses: julia-actions/julia-buildpkg@v1
- name: Run tests
uses: julia-actions/julia-runtest@latest