Skip to content

fix(github): Correct branch builds in workflow #127

fix(github): Correct branch builds in workflow

fix(github): Correct branch builds in workflow #127

Workflow file for this run

# 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-20.04
permissions:
contents: write
steps:
- name: Install packages
run: |
# Add mono's PPA
# - https://github.com/tianocore/edk2-pytool-extensions/blob/master/docs/usability/using_extdep.md#a-note-on-nuget-on-linux
sudo apt install -y gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
# Install required packages
sudo apt install -y build-essential uuid-dev git gcc python3 virtualenv gcc-aarch64-linux-gnu device-tree-compiler mono-devel
# Make sure everything is up-to-date
sudo apt upgrade
- 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
- 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 }}