-
Notifications
You must be signed in to change notification settings - Fork 3.8k
163 lines (149 loc) · 5.57 KB
/
Copy pathinstall-ci.yml
File metadata and controls
163 lines (149 loc) · 5.57 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
# Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
name: Installation Tests
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main
- develop
- release/**
workflow_dispatch:
inputs:
base_image:
description: 'Docker base image for the test container'
required: false
default: 'ubuntu:24.04'
type: string
test_filter:
description: 'pytest -k filter expression (e.g. "uv" or "bugs")'
default: ''
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
pull-requests: read
jobs:
changes:
name: Detect Changes
runs-on: ubuntu-latest
outputs:
run_install_tests: ${{ steps.detect.outputs.run_install_tests }}
steps:
- id: detect
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
EVENT_NAME: ${{ github.event_name }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail
# Installation tests run only when paths in the patterns table change.
# Otherwise the test job skips via `if:` and reports green to branch
# protection, which is why we don't use a workflow-level `paths:`
# filter (a not-triggered required check would block the PR forever).
patterns=(
$'^apps/\tStandalone apps'
$'^tools/\tBuild tooling'
$'^source/\tLibrary source code'
$'^\\.github/actions/run-package-tests/\tTest action'
$'^\\.github/actions/install-ci-(collect|run)/\tInstall-ci composite actions'
$'^\\.github/workflows/install-ci\\.yml$\tThis workflow file'
$'^VERSION$\tVersion file'
$'(^|/)pyproject\\.toml$\tPython project metadata'
$'(^|/)environment\\.ya?ml$\tConda environment file'
)
render_table() {
local files="$1" entry regex desc count sample shown
echo "| Pattern | What it covers | Matched files |"
echo "|---|---|---|"
for entry in "${patterns[@]}"; do
IFS=$'\t' read -r regex desc <<< "$entry"
# escape | so it doesn't end the markdown table cell mid-regex
shown="${regex//|/\\|}"
count=$(grep -cE "$regex" <<< "$files" || true)
if [ "$count" -gt 0 ]; then
sample=$(grep -m 3 -E "$regex" <<< "$files" | paste -sd ', ' -)
[ "$count" -gt 3 ] && sample="$sample (and $((count - 3)) more)"
echo "| \`$shown\` | $desc | $sample |"
else
echo "| \`$shown\` | $desc | - |"
fi
done
}
any_match() {
local files="$1" entry regex
for entry in "${patterns[@]}"; do
IFS=$'\t' read -r regex _ <<< "$entry"
if grep -qE "$regex" <<< "$files"; then
return 0
fi
done
return 1
}
decide() {
local decision="$1" reason="$2" files="${3:-}"
echo "Decision: run_install_tests=$decision ($reason)"
echo "run_install_tests=$decision" >> "$GITHUB_OUTPUT"
{
if [ -n "$files" ]; then
render_table "$files"
fi
} >> "$GITHUB_STEP_SUMMARY"
}
if [ "$EVENT_NAME" != "pull_request" ]; then
decide true "non-PR event ($EVENT_NAME)"
exit 0
fi
if ! changed_files="$(gh api --paginate "repos/$REPO/pulls/$PR_NUMBER/files" --jq '.[].filename')"; then
# Fail-safe: a transient API error must not block merge. Default to running.
echo "::warning::Could not list changed files; defaulting to running tests"
decide true "fail-safe (could not list changed files)"
exit 0
fi
printf '%s\n' "$changed_files"
if any_match "$changed_files"; then
decide true "relevant paths changed" "$changed_files"
else
decide false "no relevant paths changed" "$changed_files"
fi
install-tests-x86:
name: Installation Tests (x86)
needs: [changes]
if: needs.changes.outputs.run_install_tests == 'true'
runs-on: [self-hosted, gpu]
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Show Collected Tests
uses: ./.github/actions/install-ci-collect
with:
test-filter: ${{ inputs.test_filter }}
- name: Run Tests
uses: ./.github/actions/install-ci-run
with:
base-image: ${{ inputs.base_image || 'ubuntu:24.04' }}
test-filter: ${{ inputs.test_filter }}
install-tests-arm:
name: Installation Tests (ARM)
needs: [changes]
if: needs.changes.outputs.run_install_tests == 'true'
runs-on: [self-hosted, aarch64]
timeout-minutes: 90
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Show Collected Tests
uses: ./.github/actions/install-ci-collect
with:
test-filter: ${{ inputs.test_filter }}
- name: Run Tests
uses: ./.github/actions/install-ci-run
with:
base-image: ${{ inputs.base_image || 'ubuntu:24.04' }}
test-filter: ${{ inputs.test_filter }}