fix(github): On combos that don't support it, skip Server build #143
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: Copyright (c) 2022-2024 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' | |
- 'stable*' | |
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 | |
[ -d edk2-redfish-client ] && 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 }} |