-
Notifications
You must be signed in to change notification settings - Fork 36
134 lines (131 loc) · 5.81 KB
/
build.yml
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
# Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
# Workflow to build and stage releases
name: Build and release
on:
pull_request: {}
push:
branches:
- 'main'
- 'r*updates'
tags:
- 'r*'
env:
EDKREPO_URL: https://github.com/tianocore/edk2-edkrepo/releases/download/edkrepo-v2.1.2/edkrepo-2.1.2.tar.gz
EDKREPO_NVIDIA_MANIFEST_REPO: https://github.com/NVIDIA/edk2-edkrepo-manifest.git
jobs:
# Build a draft release. After it is posted, the draft release can be edited
# manually and published.
Build-Draft-Release:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Install packages
run: |
# Install required packages
sudo apt-get update
sudo apt-get install build-essential uuid-dev git gcc-12 g++-12 python3 \
virtualenv g++-12-aarch64-linux-gnu gcc-12-aarch64-linux-gnu \
device-tree-compiler mono-devel lcov
# Make sure everything is up-to-date
sudo apt upgrade
- name: Set alternatives
run: |
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-12 100 \
--slave /usr/bin/g++ g++ /usr/bin/g++-12 \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-12 \
--slave /usr/bin/gcc-nm gcc-nm /usr/bin/gcc-nm-12 \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-12 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-12
sudo update-alternatives \
--install /usr/bin/cpp cpp /usr/bin/cpp-12 100
sudo update-alternatives \
--install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-12 100 \
--slave /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ /usr/bin/aarch64-linux-gnu-g++-12 \
--slave /usr/bin/aarch64-linux-gnu-gcc-ar aarch64-linux-gnu-gcc-ar /usr/bin/aarch64-linux-gnu-gcc-ar-12 \
--slave /usr/bin/aarch64-linux-gnu-gcc-nm aarch64-linux-gnu-gcc-nm /usr/bin/aarch64-linux-gnu-gcc-nm-12 \
--slave /usr/bin/aarch64-linux-gnu-gcc-ranlib aarch64-linux-gnu-gcc-ranlib /usr/bin/aarch64-linux-gnu-gcc-ranlib-12 \
--slave /usr/bin/aarch64-linux-gnu-gcov aarch64-linux-gnu-gcov /usr/bin/aarch64-linux-gnu-gcov-12
sudo update-alternatives \
--install /usr/bin/aarch64-linux-gnu-cpp aarch64-linux-gnu-cpp /usr/bin/aarch64-linux-gnu-cpp-12 100
- name: Install edkrepo
run: |
mkdir ${{ github.workspace }}/edkrepo
cd ${{ github.workspace }}/edkrepo
wget -O- ${EDKREPO_URL} | tar zxvf -
sudo ./install.py --no-prompt --user $(id -nu)
# The installer leaves a root-owned file in .edkrepo
sudo chown -R $(id -nu). ${HOME}/.edkrepo
- name: Configure edkrepo
run: |
edkrepo manifest-repos add nvidia ${EDKREPO_NVIDIA_MANIFEST_REPO} main nvidia
edkrepo manifest
- name: Create workspace
run: |
set -x
cd ${{ github.workspace }}
# Derive the edkrepo combo. We'll assume it matches the branch name.
EDKREPO_COMBO=${{ github.ref_name }}
if [[ ${{ github.event_name }} = pull_request ]]; then
EDKREPO_COMBO=${{ github.base_ref }}
fi
# Start with the edkrepo combo that matches this branch
edkrepo clone -v workspace NVIDIA-Platforms ${EDKREPO_COMBO}
cd workspace
# Checkout the ref that triggered this build
git -C edk2-nvidia fetch --verbose "${{ github.server_url }}/${{ github.repository }}" "${{ github.ref }}"
git -C edk2-nvidia checkout FETCH_HEAD
# Summarize the workspace, for debug purposes.
git -C edk2 describe --always --dirty
git -C edk2-platforms describe --always --dirty
git -C edk2-nvidia describe --always --dirty
- name: Test
run: |
cd ${{ github.workspace }}/workspace
edk2-nvidia/Platform/NVIDIA/HostBasedTests/test.sh
- name: Build
run: |
cd ${{ github.workspace }}/workspace
edk2-nvidia/Platform/NVIDIA/Jetson/build.sh
edk2-nvidia/Platform/NVIDIA/StandaloneMmOptee/build.sh
edk2-nvidia/Platform/NVIDIA/StandaloneMm/build.sh
edk2-nvidia/Platform/NVIDIA/Server/build.sh
- name: Package
id: package
run: |
mkdir package
# Extract details about the build (BUILDID, sha, etc.)
grep -m 1 BUILDID_STRING= workspace/Build/BUILDLOG_Jetson.txt | sed -e 's/.*BUILDID_STRING=\([^ ]*\)/\1/' > package/buildid
BUILDID=$(cat package/buildid)
echo "version=${BUILDID}"
echo "version=${BUILDID}" >> $GITHUB_OUTPUT
echo ${{ github.ref_name }} > package/ref_name
echo ${{ github.sha }} > package/sha
# Copy the images
ls -l workspace/images
cp -R workspace/images package/images
# Copy the build logs
mkdir package/Build
cp workspace/Build/*.txt package/Build
# Move it to a directory with a useful name.
mkdir upload
mv package upload/edk2-nvidia-${BUILDID}
# Tar it up as a release
cd upload
tar -czvf ../edk2-nvidia-${BUILDID}.tar.gz edk2-nvidia-${BUILDID}
- name: Upload
uses: actions/upload-artifact@v3
with:
name: package
path: upload
- name: Release
if: github.event_name != 'pull_request'
uses: release-drafter/release-drafter@v5
env:
VERSION: ${{ steps.package.outputs.version }}
REF_NAME: ${{ github.ref_name }}
SHA: ${{ github.sha }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}