forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (122 loc) · 4.85 KB
/
Copy pathpush_artifacts.yml
File metadata and controls
142 lines (122 loc) · 4.85 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
# SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors
# SPDX-License-Identifier: Apache-2.0
name: Generate artifacts on PUSH
# Generate multiple artifacts in one place:
#
# - Generates a JSON database mapping every Zephyr board/target to its
# devicetree compatible strings. The artifact produced here can be
# downloaded by downstream workflows for hardware-coverage analysis,
# board-search tooling, or CI queries.
on:
push:
branches:
- main
- v*-branch
- collab-*
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
generate:
name: Generate Artifacts
if: |
github.repository_owner == 'zephyrproject-rtos'
runs-on:
group: zephyr-runner-v2-linux-x64-4xlarge
container:
image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.29.2.20260422
options: '--entrypoint /bin/bash'
timeout-minutes: 360
env:
CATALOG_ARTIFACT_NAME: dts-hardware-catalog
steps:
- name: Print cloud service information
run: |
echo "ZEPHYR_RUNNER_CLOUD_PROVIDER = ${ZEPHYR_RUNNER_CLOUD_PROVIDER}"
echo "ZEPHYR_RUNNER_CLOUD_NODE = ${ZEPHYR_RUNNER_CLOUD_NODE}"
echo "ZEPHYR_RUNNER_CLOUD_POD = ${ZEPHYR_RUNNER_CLOUD_POD}"
- name: Apply container owner mismatch workaround
run: |
# FIXME: The owner UID of the GITHUB_WORKSPACE directory may not
# match the container user UID because of the way GitHub
# Actions runner is implemented. Remove this workaround when
# GitHub comes up with a fundamental fix for this problem.
git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Clone cached Zephyr repository
continue-on-error: true
run: |
git clone --shared /repo-cache/zephyrproject/zephyr .
git remote set-url origin ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.sha }}
fetch-depth: 0
persist-credentials: false
- name: Environment Setup
uses: ./.github/actions/zephyr-ci-env
- name: Install Python packages
run: |
pip install -r scripts/requirements-actions.txt --require-hashes
west packages pip --install
- name: Generate DTS hardware catalog
run: |
export ZEPHYR_BASE=${PWD}
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
python3 scripts/ci/gen_catalogs.py \
--dts-db dts_catalog.json \
--kconfig-db kconfig.json \
--compile-db compile.json \
-v
- name: Annotate catalog with commit metadata
run: |
python3 - <<'EOF'
import json, os, sys
path = "dts_catalog.json"
with open(path) as f:
db = json.load(f)
db["git_sha"] = os.environ.get("GITHUB_SHA", "unknown")
db["git_ref"] = os.environ.get("GITHUB_REF_NAME", "unknown")
db["repository"] = os.environ.get("GITHUB_REPOSITORY", "unknown")
with open(path, "w") as f:
json.dump(db, f, indent=2)
n_boards = len(db["boards"])
n_compat = len(db["compatibles"])
print(f"Catalog: {n_boards} boards, {n_compat} compatibles")
print(f"SHA: {db['git_sha']} ref: {db['git_ref']}")
EOF
- name: Set artifact name
id: set-artifact-name
run: |
short_sha=$(printf '%.8s' "${GITHUB_SHA}")
name="${CATALOG_ARTIFACT_NAME}-${short_sha}"
echo "name=${name}" >> $GITHUB_OUTPUT
echo "Artifact name: ${name}"
- name: Upload DTS catalog artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ steps.set-artifact-name.outputs.name }}
path: |
dts_catalog.json
kconfig.json
compile.json
retention-days: 90
if-no-files-found: error
# The following steps save and upload the list of Python packages installed in the container.
# This is useful for debugging and reproducing the environment used in this workflow.
- name: Save the list of Python packages
shell: bash
run: |
FREEZE_FILE="frozen-requirements.txt"
timestamp="$(date)"
version="$(git describe --abbrev=12 --always)"
echo -e "# Generated at $timestamp ($version)\n" > $FREEZE_FILE
pip freeze | tee -a $FREEZE_FILE
- name: Upload the list of Python packages
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Frozen PIP package set
path: |
frozen-requirements.txt