Repository navigation
167 lines (147 loc) · 6.07 KB
/
Copy path_test.yml
File metadata and controls
167 lines (147 loc) · 6.07 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
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
name: Run Bazel Tests
on:
workflow_call:
jobs:
docs_bzl:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
suite: ["cached", "runtime"]
python-version: ["3.12", "3.14"]
include:
- suite: cached
marker: bazel_cached
- suite: runtime
marker: bazel_slow
steps:
- name: 🛡️ Harden Runner
if: github.repository_owner == 'eclipse-score'
uses: step-security/harden-runner@v2.22.2
with:
egress-policy: audit
- name: Install Graphviz
uses: eclipse-score/apt-install@main
with:
packages: graphviz
cache: false
- name: Checkout repository (Handle all events)
uses: actions/checkout@v7
with:
ref: ${{ github.head_ref || github.event.pull_request.head.ref || github.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
- name: Setup Bazel with shared caching
uses: eclipse-score/cicd-actions/setup-bazel-cache@cache
with:
# Each matrix entry needs its own disk cache because the jobs run in
# parallel and GitHub Actions cannot merge concurrent cache writers.
disk-cache-key: ${{ github.job }}-${{ matrix.python-version }}-${{ matrix.suite }}
- name: Setup venv
run: >-
bazel run --lockfile_mode=error
--@rules_python//python/config_settings:python_version=${{ matrix.python-version }}
//:ide_support
- name: Prepare test report directory
run: mkdir -p tests-report
- name: Run docs.bzl tests
run: >-
.venv_docs/bin/python -m pytest -vv
-m "${{ matrix.marker }}"
src/tests/docs_bzl
--junitxml=tests-report/docs_bzl_${{ matrix.python-version }}_${{ matrix.suite }}.xml
- name: Upload docs.bzl test report
# No need to upload something that doesn't exist.
# This would be skipped anyway if the step before isn't running
if: ${{ !cancelled() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: tests-report-docs-bzl-${{ matrix.python-version }}-${{ matrix.suite }}
path: tests-report
bazel_tests:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
python-version: ["3.12", "3.14"]
steps:
- name: 🛡️ Harden Runner
if: github.repository_owner == 'eclipse-score'
uses: step-security/harden-runner@v2.22.2
with:
egress-policy: audit
- name: Install Graphviz
uses: eclipse-score/apt-install@main
with:
packages: graphviz
cache: false
- name: Checkout repository (Handle all events)
uses: actions/checkout@v7
with:
ref: ${{ github.head_ref || github.event.pull_request.head.ref || github.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
- name: Setup Bazel with shared caching
uses: eclipse-score/cicd-actions/setup-bazel-cache@cache
with:
disk-cache-key: ${{ github.job }}-${{ matrix.python-version }}
- name: Run bazel test targets
run: >-
bazel test --lockfile_mode=error
--@rules_python//python/config_settings:python_version=${{ matrix.python-version }}
//... --build_tests_only
- name: Build all targets
# Skip tests, since some are non buildable negative tests.
run: >-
bazel build --lockfile_mode=error
--@rules_python//python/config_settings:python_version=${{ matrix.python-version }}
//... -- -//src/tests/...
- name: Prepare bundled test report
if: ${{ !cancelled() }}
# Follow Symlinks via '-L' to copy correctly.
run: mkdir -p tests-report && rsync -amL --include='*/' --include='test.xml' --include='test.log' --exclude='*' bazel-testlogs/ tests-report/
- name: Upload Bazel test report
# No need to upload something that doesn't exist.
# This would be skipped anyway if the step before isn't running.
if: ${{ !cancelled() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: tests-report-bazel-${{ matrix.python-version }}
path: tests-report
merge_test_reports:
if: ${{ !cancelled() }}
needs: [docs_bzl, bazel_tests]
runs-on: ubuntu-24.04
steps:
# Both Python versions produce Bazel reports at the same paths. Download
# one version for documentation so concurrent artifact extraction cannot
# corrupt overlapping files or duplicate test cases in the documentation.
# Both versions remain available as separate artifacts for inspection.
- name: Download Bazel test reports for documentation
uses: actions/download-artifact@v8
with:
name: tests-report-bazel-3.12
path: tests-report
# The docs.bzl report filenames include their Python version and suite,
# so these artifacts can be merged without overlapping paths.
- name: Download docs.bzl test reports
uses: actions/download-artifact@v8
with:
pattern: tests-report-docs-bzl-*
path: tests-report
merge-multiple: true
- name: Upload merged test report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: tests-report
path: tests-report