Repository navigation
95 lines (95 loc) · 4.27 KB
/
Copy pathmodule_tests.yml
File metadata and controls
95 lines (95 loc) · 4.27 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
# *******************************************************************************
# Copyright (c) 2026 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
# *******************************************************************************
# Runs every target_sw module's own unit tests against the dependency versions ref_int resolves
# (known_good.json pins + Bazel MVS for everything else), with ref_int's unified bazelrc config.
# See scripts/module_tests.py. Called by test_and_docs.yml, which feeds the reports into the docs.
name: Module Tests
on:
workflow_call:
secrets:
UBUNTU_SNAPSHOT_MIRROR_URL:
description: Optional StableBuild mirror tag used before snapshot.ubuntu.com (see the Bazel downloader step).
required: false
workflow_dispatch:
permissions:
contents: read
jobs:
modules:
name: List modules
runs-on: ubuntu-24.04
outputs:
modules: ${{ steps.modules.outputs.modules }}
steps:
- name: Checkout repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
ref: ${{ github.head_ref || github.event.pull_request.head.ref || github.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
allow-unsafe-pr-checkout: true
- name: List modules
id: modules
run: echo "modules=$(jq -c '.modules.target_sw | keys' known_good.json)" >> "$GITHUB_OUTPUT"
test:
name: Test ${{ matrix.module }}
needs: modules
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
module: ${{ fromJSON(needs.modules.outputs.modules) }}
steps:
- name: Clean disk space
uses: eclipse-score/more-disk-space@v1.1
with:
level: 4
- name: Checkout repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
ref: ${{ github.head_ref || github.event.pull_request.head.ref || github.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
allow-unsafe-pr-checkout: true
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@0.19.1
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}-${{ matrix.module }}
repository-cache: true
cache-save: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
- name: Configure optional Ubuntu snapshot mirror for Bazel downloader
env:
UBUNTU_SNAPSHOT_MIRROR_URL: ${{ secrets.UBUNTU_SNAPSHOT_MIRROR_URL }}
run: |
# snapshot.ubuntu.com is unreliable. If a mirror is configured, try it first and keep the
# public URL as fallback. ~/.bazelrc applies to every module workspace, unlike user.bazelrc.
if [[ -z "${UBUNTU_SNAPSHOT_MIRROR_URL}" ]]; then
echo "No Ubuntu snapshot mirror configured; using snapshot.ubuntu.com."
exit 0
fi
mirror="${UBUNTU_SNAPSHOT_MIRROR_URL}.debmirror.stablebuild.com/2026-04-01T10:40:01Z"
cfg="${RUNNER_TEMP}/ubuntu.downloader_config"
{
echo "rewrite snapshot.ubuntu.com/ubuntu/[^/]*/(.*) ${mirror}/archive.ubuntu.com/ubuntu/\$1"
echo "rewrite snapshot.ubuntu.com/ubuntu/[^/]*/(.*) ${mirror}/ports.ubuntu.com/\$1"
echo "rewrite snapshot.ubuntu.com/ubuntu/(.*) snapshot.ubuntu.com/ubuntu/\$1"
} > "${cfg}"
echo "common --downloader_config=${cfg}" >> "${HOME}/.bazelrc"
- name: Run module tests
run: python3 scripts/module_tests.py run ${{ matrix.module }}
- name: Upload test reports and coverage
if: always()
uses: actions/upload-artifact@604373da6381bf24206979c74d06a550515601b9 # v4.4.1
with:
name: module-tests-${{ matrix.module }}
# The reports/ root keeps the <module>/ folder, so a merged download has one per module.
path: _module_tests/reports/
if-no-files-found: warn