-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (136 loc) · 5.42 KB
/
Copy pathrun-suites.yml
File metadata and controls
156 lines (136 loc) · 5.42 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
name: Run Suites
on:
push:
branches: ["main", "compat/**"]
paths:
- "examples/**"
- "templates/**"
pull_request:
paths:
- "examples/**"
- "templates/**"
workflow_dispatch:
inputs:
suite:
description: "Single suite to test, with parent folder (e.g. examples/cryptolibrary)"
required: false
default: ""
jobs:
# ── Stage 1: detect which suites changed ──────────────────────────────────
detect-changes:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Detect changed suites
id: set-matrix
run: |
# Manual trigger with explicit suite override
if [[ -n "${{ github.event.inputs.suite }}" ]]; then
echo "matrix=[\"${{ github.event.inputs.suite }}\"]" >> "$GITHUB_OUTPUT"
exit 0
fi
# Detect changed folders under examples/ and templates/
CHANGED=$(git diff --name-only HEAD~1 HEAD \
| grep -E '^(examples|templates)/' \
| cut -d/ -f1-2 \
| sort -u \
| jq -R . | jq -sc .)
# Fall back to all examples + templates if nothing detected (e.g. first commit)
if [[ "${CHANGED}" == "[]" || -z "${CHANGED}" ]]; then
CHANGED=$(ls -d examples/*/ templates/*/ 2>/dev/null | sed 's|/$||' | jq -R . | jq -sc .)
fi
echo "Before blacklist filtering: ${CHANGED}"
# Apply blacklist (.github/test-blacklist.txt)
BLACKLIST=$(grep -v '^\s*#' .github/test-blacklist.txt | grep -v '^\s*$' || true)
echo "Blacklist: ${BLACKLIST}"
if [[ -n "${BLACKLIST}" ]]; then
CHANGED=$(echo "${CHANGED}" | jq -c --arg bl "${BLACKLIST}" '
($bl | split("\n") | map(select(length > 0))) as $blacklist |
map(select(. as $s | $blacklist | index($s) | not))
')
echo "After blacklist filtering: ${CHANGED}"
fi
echo "matrix=${CHANGED}" >> "$GITHUB_OUTPUT"
echo "Suites to test: ${CHANGED}"
# ── Stage 2: test matrix (os × suite) ─────────────────────────────────────
test:
needs: detect-changes
if: ${{ needs.detect-changes.outputs.matrix != '[]' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
# We have 2 OS and want to run max 1 job per OS (make use of pre-build RCC environments!)
max-parallel: 2
matrix:
suite: ${{ fromJson(needs.detect-changes.outputs.matrix) }}
os: [ubuntu-latest, windows-latest]
# os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: Read RMKS environment from .env
id: suite-env
shell: bash
run: |
ENV_FILE="${{ matrix.suite }}/.env"
SPACE=$(grep '^RMKS_ENVIRONMENT=' "${ENV_FILE}" | cut -d= -f2 | tr -d '[:space:]')
if [[ -z "${SPACE}" ]]; then
echo "ERROR: RMKS_ENVIRONMENT is missing in ${ENV_FILE}" >&2
exit 1
fi
echo "space=${SPACE}" >> "$GITHUB_OUTPUT"
# Sanitize matrix.suite (e.g. examples/cryptolibrary → examples-cryptolibrary)
echo "safe_name=$(echo '${{ matrix.suite }}' | tr '/' '-')" >> "$GITHUB_OUTPUT"
- name: Download RCC
shell: bash
run: |
BASE="https://github.com/elabit/robotmk/releases/download/v4.0.0"
if [[ "${{ runner.os }}" == "Windows" ]]; then
curl -fsSL -o rcc.exe "${BASE}/rcc_windows64.exe"
echo "RCC_BIN=./rcc.exe" >> "$GITHUB_ENV"
else
curl -fsSL -o rcc "${BASE}/rcc_linux64"
chmod +x rcc
echo "RCC_BIN=./rcc" >> "$GITHUB_ENV"
fi
${RCC_BIN:-./rcc} --version
- name: Cache RCC holotree environment
uses: actions/cache@v4
with:
path: ~/.robocorp/holotree
key: rcc-holotree-${{ steps.suite-env.outputs.space }}-${{ runner.os }}
- name: Build RCC holotree environment
shell: bash
run: |
$RCC_BIN holotree vars \
--space ${{ steps.suite-env.outputs.space }} \
--robot ${{ matrix.suite }}/robot.yaml
- name: Load .env if present
shell: bash
run: |
ENV_FILE="${{ matrix.suite }}/.env"
if [[ -f "${ENV_FILE}" ]]; then
echo "Loading variables from ${ENV_FILE}"
grep -v '^\s*#' "${ENV_FILE}" | grep -v '^\s*$' >> "$GITHUB_ENV"
fi
echo "Environment variables set for this suite:"
grep -v '^\s*#' "${ENV_FILE}" | grep -v '^\s*$' || echo "No .env file or no variables found."
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Run Robot Framework suite
shell: bash
run: |
$RCC_BIN task script \
--space ${{ steps.suite-env.outputs.space }} \
--robot ${{ matrix.suite }}/robot.yaml \
-- robot .
- name: Upload RF output artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: rf-output-${{ steps.suite-env.outputs.safe_name }}-${{ matrix.os }}
path: ${{ matrix.suite }}/log.html
if-no-files-found: ignore