From 3e675bc5c3c6eb4c37845833da36146500f4dd4a Mon Sep 17 00:00:00 2001 From: Mikhail Krichanov Date: Wed, 20 Dec 2023 13:53:23 +0300 Subject: [PATCH] CI: Constructed separate workflows for common, arm, x86 packages and CodeQL. Signed-off-by: Savva Mitrofanov --- .devcontainer/devcontainer.json | 26 +- .github/workflows/build_arm.yaml | 312 ++++++++++++ .github/workflows/build_common.yml | 622 +++++++++++++++++++++++ .github/workflows/build_nolto.yaml | 574 ++++++++++++++++++++++ .github/workflows/build_x86.yaml | 677 ++++++++++++++++++++++++++ .github/workflows/codeql-analysis.yml | 109 +++++ .pytool/CISettings.py | 2 + docker-compose.yaml | 13 + 8 files changed, 2319 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/build_arm.yaml create mode 100644 .github/workflows/build_common.yml create mode 100644 .github/workflows/build_nolto.yaml create mode 100644 .github/workflows/build_x86.yaml create mode 100644 .github/workflows/codeql-analysis.yml create mode 100755 docker-compose.yaml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 592bb8cf66..41b18091fe 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,16 +1,10 @@ -{ - "image": "ghcr.io/tianocore/containers/fedora-35-dev:latest", - "postCreateCommand": "git config --global --add safe.directory * && pip install --upgrade -r pip-requirements.txt", - "customizations": { - "vscode": { - "extensions": [ - "DavidAnson.vscode-markdownlint", - "ms-azuretools.vscode-docker", - "ms-vscode-remote.remote-containers", - "ms-vscode.cpptools", - "walonli.edk2-vscode", - "zachflower.uncrustify" - ] - } - } -} +{ + "name": "audk", + "build": { + "dockerfile": "../OpenCorePkg/Dockerfiles/oc-dev/Dockerfile", + "context": "../OpenCorePkg/Dockerfiles/oc-dev/", + "target": "oc-dev-edk2" + }, + "workspaceMount": "source=${localWorkspaceFolder},target=/com.docker.devenvironments.code,type=bind,consistency=cached", + "workspaceFolder": "/com.docker.devenvironments.code" +} diff --git a/.github/workflows/build_arm.yaml b/.github/workflows/build_arm.yaml new file mode 100644 index 0000000000..8a37db3d0a --- /dev/null +++ b/.github/workflows/build_arm.yaml @@ -0,0 +1,312 @@ +name: Build ARM Firmwares + +on: + push: + pull_request: + workflow_dispatch: + release: + types: [published] + +env: + PROJECT_TYPE: UEFI + FORCE_INSTALL: 1 + WERROR: 1 + QEMU_VERSION_TAG: qemu-ci-8.0.0-r2 + WINPE_VERSION_TAG: images-winpe-1.0 + +jobs: + build-linux-gcc5: + name: Linux GCC5 + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y lsb-release wget software-properties-common gnupg build-essential nasm uuid-dev libssl-dev iasl curl git zip gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu + + - name: CI Bootstrap + run: | + src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/ci-bootstrap.sh) && eval "$src" || exit 1 + touch UDK.ready + + - name: Prepare efibuild.sh + run: | + curl -o ./efibuild.sh https://raw.githubusercontent.com/acidanthera/ocbuild/master/efibuild.sh || exit 1 + chmod +x ./efibuild.sh + ln -s `pwd` UDK + + - name: Build BaseTools + run: ./efibuild.sh + env: + SELFPKG: MdePkg + SKIP_BUILD: 1 + + - name: Build ArmPkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: ArmPkg + SELFPKG_DIR: ArmPkg + TOOLCHAINS: GCC5 + ARCHS: ARM,AARCH64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + GCC5_ARM_PREFIX: arm-linux-gnueabi- + GCC5_AARCH64_PREFIX: aarch64-linux-gnu- + + - name: Build ArmPlatformPkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: ArmPlatformPkg + SELFPKG_DIR: ArmPlatformPkg + TOOLCHAINS: GCC5 + ARCHS: ARM,AARCH64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + GCC5_ARM_PREFIX: arm-linux-gnueabi- + GCC5_AARCH64_PREFIX: aarch64-linux-gnu- + + - name: Build ArmVirtQemu + if: always() + run: ./efibuild.sh + env: + SELFPKG: ArmVirtQemu + SELFPKG_DIR: ArmVirtPkg + TOOLCHAINS: GCC5 + ARCHS: ARM,AARCH64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + GCC5_ARM_PREFIX: arm-linux-gnueabi- + GCC5_AARCH64_PREFIX: aarch64-linux-gnu- + + - name: Prepare artifacts with firmwares + if: always() + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + mkdir -p ./firmware_artifacts/ArmVirtQemu/"$arch"/"$target"_"$TOOLCHAIN" + cp ./Build/ArmVirtQemu-"$arch"/"$target"_"$TOOLCHAIN"/FV/QEMU_EFI.fd ./firmware_artifacts/ArmVirtQemu/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd + done + done + env: + ARCHS: ARM,AARCH64 + TARGETS: RELEASE,DEBUG,NOOPT + TOOLCHAIN: GCC5 + + - name: Zip artifacts + run: zip GCC5_fw_arm_artifacts.zip ./firmware_artifacts/* -r + + - name: Upload to Artifacts + uses: actions/upload-artifact@v3 + with: + name: GCC5 Firmware ARM Artifacts + path: GCC5_fw_arm_artifacts.zip + + build-linux-clangdwarf: + name: Linux CLANGDWARF + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y lsb-release wget software-properties-common gnupg build-essential nasm uuid-dev libssl-dev iasl curl git zip + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + yes '' | sudo ./llvm.sh 15 + rm -f llvm.sh + echo "/usr/lib/llvm-15/bin" >> $GITHUB_PATH + + - name: CI Bootstrap + run: | + src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/ci-bootstrap.sh) && eval "$src" || exit 1 + touch UDK.ready + + - name: Prepare efibuild.sh + run: | + curl -o ./efibuild.sh https://raw.githubusercontent.com/acidanthera/ocbuild/master/efibuild.sh || exit 1 + chmod +x ./efibuild.sh + ln -s `pwd` UDK + + - name: Build BaseTools + run: ./efibuild.sh + env: + SELFPKG: MdePkg + SKIP_BUILD: 1 + + - name: Build ArmPkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: ArmPkg + SELFPKG_DIR: ArmPkg + TOOLCHAINS: CLANGDWARF + ARCHS: ARM,AARCH64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build ArmPlatformPkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: ArmPlatformPkg + SELFPKG_DIR: ArmPlatformPkg + TOOLCHAINS: CLANGDWARF + ARCHS: ARM,AARCH64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build ArmVirtQemu + if: always() + run: ./efibuild.sh + env: + SELFPKG: ArmVirtQemu + SELFPKG_DIR: ArmVirtPkg + TOOLCHAINS: CLANGDWARF + ARCHS: ARM,AARCH64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Prepare artifacts with firmwares + if: always() + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + mkdir -p ./firmware_artifacts/ArmVirtQemu/"$arch"/"$target"_"$TOOLCHAIN" + cp ./Build/ArmVirtQemu-"$arch"/"$target"_"$TOOLCHAIN"/FV/QEMU_EFI.fd ./firmware_artifacts/ArmVirtQemu/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd + done + done + env: + ARCHS: ARM,AARCH64 + TARGETS: RELEASE,DEBUG,NOOPT + TOOLCHAIN: CLANGDWARF + + - name: Zip artifacts + run: zip CLANGDWARF_fw_arm_artifacts.zip ./firmware_artifacts/* -r + + - name: Upload to Artifacts + uses: actions/upload-artifact@v3 + with: + name: CLANGDWARF Firmware ARM Artifacts + path: CLANGDWARF_fw_arm_artifacts.zip + + test-firmwares: + name: Test + runs-on: ubuntu-22.04 + needs: [build-linux-gcc5, build-linux-clangdwarf] + + strategy: + fail-fast: false + matrix: + package: [ + {name: "ArmVirtQemu", archs: "ARM,AARCH64", toolchain: "GCC5", targets: "RELEASE,DEBUG,NOOPT"}, + {name: "ArmVirtQemu", archs: "ARM,AARCH64", toolchain: "CLANGDWARF", targets: "RELEASE,DEBUG,NOOPT"}, + ] + steps: + - name: Checkout ocbuild repository + uses: actions/checkout@v3 + with: + repository: acidanthera/ocbuild + ref: master + path: ./ + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y python3 python3-pip libglib2.0-dev libfdt-dev libpixman-1-dev libepoxy-dev libcapstone-dev libsdl2-dev libnuma-dev libgtk-3-dev libvte-2.91-dev libbrlapi-dev libiscsi-dev libnfs-dev librbd-dev libxen-dev + python3 -m pip install -r requirements.txt + + - name: Downloading QEMU + uses: robinraju/release-downloader@v1.7 + with: + repository: "acidanthera/OcBinaryData" + tag: ${{ env.QEMU_VERSION_TAG }} + fileName: "qemu.tar.xz" + + - name: Installing QEMU and add to PATH + run: | + echo "${HOME}/qemu/bin" >> $GITHUB_PATH + tar -xJf ./qemu.tar.xz -C $HOME + + - name: Download a single artifact + uses: actions/download-artifact@v3 + with: + name: ${{ matrix.package.toolchain }} Firmware ARM Artifacts + + - name: Unzip artifacts + run: unzip "$TOOLCHAIN"_fw_arm_artifacts.zip + env: + TOOLCHAIN: ${{ matrix.package.toolchain }} + + - name: Downloading Windows PE AARCH64 iso + uses: robinraju/release-downloader@v1.7 + with: + repository: "acidanthera/OcBinaryData" + tag: ${{ env.WINPE_VERSION_TAG }} + fileName: "winpe_AARCH64.iso" + + - name: Run TestConsole + if: always() + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + echo Checking "$PACKAGE""$arch" "$target"_"$TOOLCHAIN" + python3 test_qemu_fw.py ./firmware_artifacts/"$PACKAGE"/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd --fw-arch "$arch" + done + done + env: + PACKAGE: ${{ matrix.package.name }} + ARCHS: ${{ matrix.package.archs }} + TARGETS: ${{ matrix.package.targets }} + TOOLCHAIN: ${{ matrix.package.toolchain }} + + - name: Run TestLinux + if: always() + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + echo Checking "$PACKAGE""$arch" "$target"_"$TOOLCHAIN" + python3 test_qemu_fw.py ./firmware_artifacts/"$PACKAGE"/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd --test-linux --fw-arch "$arch" + done + done + env: + PACKAGE: ${{ matrix.package.name }} + ARCHS: ${{ matrix.package.archs }} + TARGETS: ${{ matrix.package.targets }} + TOOLCHAIN: ${{ matrix.package.toolchain }} + + - name: Run Windows PE aarch64 + if: always() + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + echo Checking "$PACKAGE"AARCH64 "$target"_"$TOOLCHAIN" + python3 test_qemu_fw.py ./firmware_artifacts/"$PACKAGE"/AARCH64/"$target"_"$TOOLCHAIN"/FW.fd --fw-arch AARCH64 --test-winpe --test-winpe-path ./winpe_AARCH64.iso + done + env: + PACKAGE: ${{ matrix.package.name }} + TARGETS: ${{ matrix.package.targets }} + TOOLCHAIN: ${{ matrix.package.toolchain }} diff --git a/.github/workflows/build_common.yml b/.github/workflows/build_common.yml new file mode 100644 index 0000000000..ab18bc7af0 --- /dev/null +++ b/.github/workflows/build_common.yml @@ -0,0 +1,622 @@ +name: Build Common packages + +on: + push: + pull_request: + workflow_dispatch: + release: + types: [published] + +env: + PROJECT_TYPE: UEFI + FORCE_INSTALL: 1 + WERROR: 1 + +jobs: + build-macos: + name: macOS XCODE5 + runs-on: macos-latest + env: + JOB_TYPE: BUILD + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Add Linux Toolchain + run: brew tap FiloSottile/homebrew-musl-cross + + - name: Install Linux Toolchain + run: brew install musl-cross + env: + HOMEBREW_NO_INSTALL_CLEANUP: 1 + HOMEBREW_NO_AUTO_UPDATE: 1 + + - name: Install Dependencies + run: brew install openssl mingw-w64 + env: + HOMEBREW_NO_INSTALL_CLEANUP: 1 + HOMEBREW_NO_AUTO_UPDATE: 1 + + - name: CI Bootstrap + run: | + src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/ci-bootstrap.sh) && eval "$src" || exit 1 + touch UDK.ready + + - name: Prepare efibuild.sh + run: | + curl -o ./efibuild.sh https://raw.githubusercontent.com/acidanthera/ocbuild/master/efibuild.sh || exit 1 + chmod +x ./efibuild.sh + ln -s `pwd` UDK + + - name: Build BaseTools + run: ./efibuild.sh + env: + SELFPKG: MdePkg + SKIP_BUILD: 1 + + - name: Build Ext4Pkg + run: ./efibuild.sh + env: + SELFPKG: Ext4Pkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build FatPkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: FatPkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build IntelFsp2Pkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: IntelFsp2Pkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build IntelFsp2WrapperPkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: IntelFsp2WrapperPkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build MdeModulePkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: MdeModulePkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build MdePkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: MdePkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UefiCpuPkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: UefiCpuPkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UnitTestFrameworkPkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: UnitTestFrameworkPkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build NetworkPkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: NetworkPkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + build-windows: + name: Windows VS2019 + runs-on: windows-latest + env: + CC: gcc + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Dependencies + run: | + choco install make nasm zip iasl --no-progress + + - name: CI Bootstrap + run: | + src=$(curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/ci-bootstrap.sh) && eval "$src" || exit 1 + touch UDK.ready + + - name: Prepare efibuild.sh + run: | + curl -o ./efibuild.sh https://raw.githubusercontent.com/acidanthera/ocbuild/master/efibuild.sh || exit 1 + chmod +x ./efibuild.sh + cmd <<< "mklink /D .\\UDK .\\" > /dev/null + + - name: Build BaseTools + run: ./efibuild.sh + env: + SELFPKG: MdePkg + SKIP_BUILD: 1 + + - name: Build Ext4Pkg + run: ./efibuild.sh + env: + SELFPKG: Ext4Pkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build FatPkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: FatPkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build IntelFsp2Pkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: IntelFsp2Pkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build IntelFsp2WrapperPkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: IntelFsp2WrapperPkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build MdeModulePkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: MdeModulePkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build MdePkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: MdePkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UefiCpuPkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: UefiCpuPkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UnitTestFrameworkPkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: UnitTestFrameworkPkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build NetworkPkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: NetworkPkg + ARCHS: IA32,X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + build-linux-clangpdb: + name: Linux CLANGPDB + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Use Docker in rootless mode. + uses: ScribeMD/rootless-docker@0.2.2 + + - name: Build BaseTools + run: docker compose run build-package + env: + SELFPKG: MdePkg + SKIP_BUILD: 1 + + - name: Build Ext4Pkg + run: docker compose run build-package + env: + SELFPKG: Ext4Pkg + SELFPKG_DIR: Ext4Pkg + TOOLCHAINS: CLANGPDB + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build FatPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: FatPkg + SELFPKG_DIR: FatPkg + TOOLCHAINS: CLANGPDB + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build IntelFsp2Pkg + if: always() + run: docker compose run build-package + env: + SELFPKG: IntelFsp2Pkg + SELFPKG_DIR: IntelFsp2Pkg + TOOLCHAINS: CLANGPDB + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build IntelFsp2WrapperPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: IntelFsp2WrapperPkg + SELFPKG_DIR: IntelFsp2WrapperPkg + TOOLCHAINS: CLANGPDB + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build MdeModulePkg + if: always() + run: docker compose run build-package + env: + SELFPKG: MdeModulePkg + SELFPKG_DIR: MdeModulePkg + TOOLCHAINS: CLANGPDB + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build MdePkg + if: always() + run: docker compose run build-package + env: + SELFPKG: MdePkg + SELFPKG_DIR: MdePkg + TOOLCHAINS: CLANGPDB + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UefiCpuPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: UefiCpuPkg + SELFPKG_DIR: UefiCpuPkg + TOOLCHAINS: CLANGPDB + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UnitTestFrameworkPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: UnitTestFrameworkPkg + SELFPKG_DIR: UnitTestFrameworkPkg + TOOLCHAINS: CLANGPDB + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build NetworkPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: NetworkPkg + SELFPKG_DIR: NetworkPkg + TOOLCHAINS: CLANGPDB + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + build-linux-clangdwarf: + name: Linux CLANGDWARF + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Use Docker in rootless mode. + uses: ScribeMD/rootless-docker@0.2.2 + + - name: Build BaseTools + run: docker compose run build-package + env: + SELFPKG: MdePkg + SKIP_BUILD: 1 + + - name: Build Ext4Pkg + run: docker compose run build-package + env: + SELFPKG: Ext4Pkg + SELFPKG_DIR: Ext4Pkg + TOOLCHAINS: CLANGDWARF + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build FatPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: FatPkg + SELFPKG_DIR: FatPkg + TOOLCHAINS: CLANGDWARF + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build IntelFsp2Pkg + if: always() + run: docker compose run build-package + env: + SELFPKG: IntelFsp2Pkg + SELFPKG_DIR: IntelFsp2Pkg + TOOLCHAINS: CLANGDWARF + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build IntelFsp2WrapperPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: IntelFsp2WrapperPkg + SELFPKG_DIR: IntelFsp2WrapperPkg + TOOLCHAINS: CLANGDWARF + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build MdeModulePkg + if: always() + run: docker compose run build-package + env: + SELFPKG: MdeModulePkg + SELFPKG_DIR: MdeModulePkg + TOOLCHAINS: CLANGDWARF + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build MdePkg + if: always() + run: docker compose run build-package + env: + SELFPKG: MdePkg + SELFPKG_DIR: MdePkg + TOOLCHAINS: CLANGDWARF + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UefiCpuPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: UefiCpuPkg + SELFPKG_DIR: UefiCpuPkg + TOOLCHAINS: CLANGDWARF + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UnitTestFrameworkPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: UnitTestFrameworkPkg + SELFPKG_DIR: UnitTestFrameworkPkg + TOOLCHAINS: CLANGDWARF + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build NetworkPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: NetworkPkg + SELFPKG_DIR: NetworkPkg + TOOLCHAINS: CLANGDWARF + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + build-linux-gcc5: + name: Linux GCC5 + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Use Docker in rootless mode. + uses: ScribeMD/rootless-docker@0.2.2 + + - name: Build BaseTools + run: docker compose run build-package + env: + SELFPKG: MdePkg + SKIP_BUILD: 1 + + - name: Build Ext4Pkg + run: docker compose run build-package + env: + SELFPKG: Ext4Pkg + SELFPKG_DIR: Ext4Pkg + TOOLCHAINS: GCC5 + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build FatPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: FatPkg + SELFPKG_DIR: FatPkg + TOOLCHAINS: GCC5 + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build IntelFsp2Pkg + if: always() + run: docker compose run build-package + env: + SELFPKG: IntelFsp2Pkg + SELFPKG_DIR: IntelFsp2Pkg + TOOLCHAINS: GCC5 + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build IntelFsp2WrapperPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: IntelFsp2WrapperPkg + SELFPKG_DIR: IntelFsp2WrapperPkg + TOOLCHAINS: GCC5 + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build MdeModulePkg + if: always() + run: docker compose run build-package + env: + SELFPKG: MdeModulePkg + SELFPKG_DIR: MdeModulePkg + TOOLCHAINS: GCC5 + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build MdePkg + if: always() + run: docker compose run build-package + env: + SELFPKG: MdePkg + SELFPKG_DIR: MdePkg + TOOLCHAINS: GCC5 + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UefiCpuPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: UefiCpuPkg + SELFPKG_DIR: UefiCpuPkg + TOOLCHAINS: GCC5 + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UnitTestFrameworkPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: UnitTestFrameworkPkg + SELFPKG_DIR: UnitTestFrameworkPkg + TOOLCHAINS: GCC5 + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build NetworkPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: NetworkPkg + SELFPKG_DIR: NetworkPkg + TOOLCHAINS: GCC5 + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 diff --git a/.github/workflows/build_nolto.yaml b/.github/workflows/build_nolto.yaml new file mode 100644 index 0000000000..1c81703af3 --- /dev/null +++ b/.github/workflows/build_nolto.yaml @@ -0,0 +1,574 @@ +name: Build Firmwares using GCC without Link Time Optimization + +on: + push: + pull_request: + workflow_dispatch: + release: + types: [published] + +env: + PROJECT_TYPE: UEFI + FORCE_INSTALL: 1 + WERROR: 1 + QEMU_VERSION_TAG: qemu-ci-8.0.0-r2 + WINPE_VERSION_TAG: images-winpe-1.0 + +jobs: + build-linux-arm: + name: Linux GCC ARM + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y lsb-release wget software-properties-common gnupg build-essential nasm uuid-dev libssl-dev iasl curl git zip gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu + + - name: CI Bootstrap + run: | + src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/ci-bootstrap.sh) && eval "$src" || exit 1 + touch UDK.ready + + - name: Prepare efibuild.sh + run: | + curl -o ./efibuild.sh https://raw.githubusercontent.com/acidanthera/ocbuild/master/efibuild.sh || exit 1 + chmod +x ./efibuild.sh + ln -s `pwd` UDK + + - name: Build BaseTools + run: ./efibuild.sh + env: + SELFPKG: MdePkg + SKIP_BUILD: 1 + + - name: Build ArmPkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: ArmPkg + SELFPKG_DIR: ArmPkg + TOOLCHAINS: GCC + ARCHS: ARM,AARCH64 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + GCC_ARM_PREFIX: arm-linux-gnueabi- + GCC_AARCH64_PREFIX: aarch64-linux-gnu- + BUILD_ARGUMENTS: -D EDK2_GCC_NOLTO + + - name: Build ArmPlatformPkg + if: always() + run: ./efibuild.sh + env: + SELFPKG: ArmPlatformPkg + SELFPKG_DIR: ArmPlatformPkg + TOOLCHAINS: GCC + ARCHS: ARM,AARCH64 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + GCC_ARM_PREFIX: arm-linux-gnueabi- + GCC_AARCH64_PREFIX: aarch64-linux-gnu- + BUILD_ARGUMENTS: -D EDK2_GCC_NOLTO + + - name: Build ArmVirtQemu + if: always() + run: ./efibuild.sh + env: + SELFPKG: ArmVirtQemu + SELFPKG_DIR: ArmVirtPkg + TOOLCHAINS: GCC + ARCHS: ARM,AARCH64 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + GCC_ARM_PREFIX: arm-linux-gnueabi- + GCC_AARCH64_PREFIX: aarch64-linux-gnu- + BUILD_ARGUMENTS: -D EDK2_GCC_NOLTO + + - name: Prepare artifacts with firmwares + if: always() + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + mkdir -p ./firmware_artifacts/ArmVirtQemu/"$arch"/"$target"_"$TOOLCHAIN" + cp ./Build/ArmVirtQemu-"$arch"/"$target"_"$TOOLCHAIN"/FV/QEMU_EFI.fd ./firmware_artifacts/ArmVirtQemu/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd + done + done + env: + ARCHS: ARM,AARCH64 + TARGETS: RELEASE,DEBUG + TOOLCHAIN: GCC + + - name: Zip artifacts + run: zip GCC_no_lto_artifacts.zip ./firmware_artifacts/* -r + + - name: Upload to Artifacts + uses: actions/upload-artifact@v3 + with: + name: GCC Firmware NO_LTO Artifacts + path: GCC_no_lto_artifacts.zip + + build-linux-amd: + name: Linux GCC AMD + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Use Docker in rootless mode. + uses: ScribeMD/rootless-docker@0.2.2 + + - name: Build BaseTools + run: docker compose run build-package + env: + SELFPKG: MdePkg + SKIP_BUILD: 1 + + - name: Build OvmfPkgIa32 + if: always() + run: docker compose run build-package + env: + SELFPKG: OvmfPkgIa32 + SELFPKG_DIR: OvmfPkg + TOOLCHAINS: GCC + ARCHS: IA32 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D WINDOWS_10_IA32 -D EDK2_GCC_NOLTO + + - name: Build OvmfPkgX64 + if: always() + run: docker compose run build-package + env: + SELFPKG: OvmfPkgX64 + SELFPKG_DIR: OvmfPkg + TOOLCHAINS: GCC + ARCHS: X64 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D EDK2_GCC_NOLTO + + - name: Build OvmfPkgIa32X64 + if: always() + run: docker compose run build-package + env: + SELFPKG: OvmfPkgIa32X64 + SELFPKG_DIR: OvmfPkg + TOOLCHAINS: GCC + ARCHS: X64 + ARCHS_EXT: IA32 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D EDK2_GCC_NOLTO + + - name: Build UefiPayloadPkg with X64 PEI/DXE + if: always() + run: docker compose run build-package + env: + SELFPKG: UefiPayloadPkg + SELFPKG_DIR: UefiPayloadPkg + TOOLCHAINS: GCC + ARCHS: X64 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D EDK2_GCC_NOLTO + + - name: Build UefiPayloadPkg with Ia32 PEI and X64 DXE + if: always() + run: docker compose run build-package + env: + SELFPKG: UefiPayloadPkg + SELFPKG_DIR: UefiPayloadPkg + TOOLCHAINS: GCC + ARCHS: X64 + ARCHS_EXT: IA32 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D EDK2_GCC_NOLTO + + - name: Prepare artifacts with firmwares + if: always() + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + mkdir -p ./firmware_artifacts/Ovmf/"$arch"/"$target"_"$TOOLCHAIN" + cp ./Build/Ovmf"$arch"/"$target"_"$TOOLCHAIN"/FV/OVMF.fd ./firmware_artifacts/Ovmf/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd + done + done + env: + ARCHS: Ia32,X64,3264 + TARGETS: RELEASE,DEBUG + TOOLCHAIN: GCC + + - name: Zip artifacts + run: zip GCC_fw_artifacts.zip ./firmware_artifacts/* -r + + - name: Upload to Artifacts + uses: actions/upload-artifact@v3 + with: + name: GCC Firmware Artifacts + path: GCC_fw_artifacts.zip + + build-linux-common: + name: Linux GCC Common + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Use Docker in rootless mode. + uses: ScribeMD/rootless-docker@0.2.2 + + - name: Build BaseTools + run: docker compose run build-package + env: + SELFPKG: MdePkg + SKIP_BUILD: 1 + + - name: Build Ext4Pkg + run: docker compose run build-package + env: + SELFPKG: Ext4Pkg + SELFPKG_DIR: Ext4Pkg + TOOLCHAINS: GCC + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D EDK2_GCC_NOLTO + + - name: Build FatPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: FatPkg + SELFPKG_DIR: FatPkg + TOOLCHAINS: GCC + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D EDK2_GCC_NOLTO + + - name: Build IntelFsp2Pkg + if: always() + run: docker compose run build-package + env: + SELFPKG: IntelFsp2Pkg + SELFPKG_DIR: IntelFsp2Pkg + TOOLCHAINS: GCC + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D EDK2_GCC_NOLTO + + - name: Build IntelFsp2WrapperPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: IntelFsp2WrapperPkg + SELFPKG_DIR: IntelFsp2WrapperPkg + TOOLCHAINS: GCC + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D EDK2_GCC_NOLTO + + - name: Build MdeModulePkg + if: always() + run: docker compose run build-package + env: + SELFPKG: MdeModulePkg + SELFPKG_DIR: MdeModulePkg + TOOLCHAINS: GCC + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D EDK2_GCC_NOLTO + + - name: Build MdePkg + if: always() + run: docker compose run build-package + env: + SELFPKG: MdePkg + SELFPKG_DIR: MdePkg + TOOLCHAINS: GCC + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D EDK2_GCC_NOLTO + + - name: Build UefiCpuPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: UefiCpuPkg + SELFPKG_DIR: UefiCpuPkg + TOOLCHAINS: GCC + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D EDK2_GCC_NOLTO + + - name: Build UnitTestFrameworkPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: UnitTestFrameworkPkg + SELFPKG_DIR: UnitTestFrameworkPkg + TOOLCHAINS: GCC + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D EDK2_GCC_NOLTO + + - name: Build NetworkPkg + if: always() + run: docker compose run build-package + env: + SELFPKG: NetworkPkg + SELFPKG_DIR: NetworkPkg + TOOLCHAINS: GCC + ARCHS: IA32,X64 + TARGETS: RELEASE,DEBUG + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D EDK2_GCC_NOLTO + + test-arm: + name: Test ARM + runs-on: ubuntu-22.04 + needs: [build-linux-arm] + + strategy: + fail-fast: false + matrix: + package: [ + {name: "ArmVirtQemu", archs: "ARM,AARCH64", toolchain: "GCC", targets: "RELEASE,DEBUG"}, + ] + steps: + - name: Checkout ocbuild repository + uses: actions/checkout@v3 + with: + repository: acidanthera/ocbuild + ref: master + path: ./ + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y python3 python3-pip libglib2.0-dev libfdt-dev libpixman-1-dev libepoxy-dev libcapstone-dev libsdl2-dev libnuma-dev libgtk-3-dev libvte-2.91-dev libbrlapi-dev libiscsi-dev libnfs-dev librbd-dev libxen-dev + python3 -m pip install -r requirements.txt + + - name: Downloading QEMU + uses: robinraju/release-downloader@v1.7 + with: + repository: "acidanthera/OcBinaryData" + tag: ${{ env.QEMU_VERSION_TAG }} + fileName: "qemu.tar.xz" + + - name: Installing QEMU and add to PATH + run: | + echo "${HOME}/qemu/bin" >> $GITHUB_PATH + tar -xJf ./qemu.tar.xz -C $HOME + + - name: Download a single artifact + uses: actions/download-artifact@v3 + with: + name: ${{ matrix.package.toolchain }} Firmware NO_LTO Artifacts + + - name: Unzip artifacts + run: unzip "$TOOLCHAIN"_no_lto_artifacts.zip + env: + TOOLCHAIN: ${{ matrix.package.toolchain }} + + - name: Downloading Windows PE AARCH64 iso + uses: robinraju/release-downloader@v1.7 + with: + repository: "acidanthera/OcBinaryData" + tag: ${{ env.WINPE_VERSION_TAG }} + fileName: "winpe_AARCH64.iso" + + - name: Run TestConsole + if: always() + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + echo Checking "$PACKAGE""$arch" "$target"_"$TOOLCHAIN" + python3 test_qemu_fw.py ./firmware_artifacts/"$PACKAGE"/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd --fw-arch "$arch" + done + done + env: + PACKAGE: ${{ matrix.package.name }} + ARCHS: ${{ matrix.package.archs }} + TARGETS: ${{ matrix.package.targets }} + TOOLCHAIN: ${{ matrix.package.toolchain }} + + - name: Run TestLinux + if: always() + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + echo Checking "$PACKAGE""$arch" "$target"_"$TOOLCHAIN" + python3 test_qemu_fw.py ./firmware_artifacts/"$PACKAGE"/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd --test-linux --fw-arch "$arch" + done + done + env: + PACKAGE: ${{ matrix.package.name }} + ARCHS: ${{ matrix.package.archs }} + TARGETS: ${{ matrix.package.targets }} + TOOLCHAIN: ${{ matrix.package.toolchain }} + + - name: Run Windows PE aarch64 + if: always() + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + echo Checking "$PACKAGE"AARCH64 "$target"_"$TOOLCHAIN" + python3 test_qemu_fw.py ./firmware_artifacts/"$PACKAGE"/AARCH64/"$target"_"$TOOLCHAIN"/FW.fd --fw-arch AARCH64 --test-winpe --test-winpe-path ./winpe_AARCH64.iso + done + env: + PACKAGE: ${{ matrix.package.name }} + TARGETS: ${{ matrix.package.targets }} + TOOLCHAIN: ${{ matrix.package.toolchain }} + + test-amd: + name: Test AMD + runs-on: ubuntu-22.04 + needs: [build-linux-amd] + + strategy: + fail-fast: false + matrix: + package: [ + {name: "Ovmf", archs: "Ia32,X64,3264", toolchain: "GCC", targets: "RELEASE,DEBUG"}, + ] + steps: + - name: Checkout ocbuild repository + uses: actions/checkout@v3 + with: + repository: acidanthera/ocbuild + ref: master + path: ./ + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y python3 python3-pip libglib2.0-dev libfdt-dev libpixman-1-dev libepoxy-dev libcapstone-dev libsdl2-dev libnuma-dev libgtk-3-dev libvte-2.91-dev libbrlapi-dev libiscsi-dev libnfs-dev librbd-dev libxen-dev + python3 -m pip install -r requirements.txt + + - name: Downloading QEMU + uses: robinraju/release-downloader@v1.7 + with: + repository: "acidanthera/OcBinaryData" + tag: ${{ env.QEMU_VERSION_TAG }} + fileName: "qemu.tar.xz" + + - name: Installing QEMU and add to PATH + run: | + echo "${HOME}/qemu/bin" >> $GITHUB_PATH + tar -xJf ./qemu.tar.xz -C $HOME + + - name: Download a single artifact + uses: actions/download-artifact@v3 + with: + name: ${{ matrix.package.toolchain }} Firmware Artifacts + + - name: Unzip artifacts + run: unzip "$TOOLCHAIN"_fw_artifacts.zip + env: + TOOLCHAIN: ${{ matrix.package.toolchain }} + + - name: Downloading Windows PE X64 iso + uses: robinraju/release-downloader@v1.7 + with: + repository: "acidanthera/OcBinaryData" + tag: ${{ env.WINPE_VERSION_TAG }} + fileName: "winpe_X64.iso" + + - name: Downloading Windows PE IA32 iso + uses: robinraju/release-downloader@v1.7 + with: + repository: "acidanthera/OcBinaryData" + tag: ${{ env.WINPE_VERSION_TAG }} + fileName: "winpe_IA32.iso" + + - name: Run TestConsole + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + echo Checking "$PACKAGE""$arch" "$target"_"$TOOLCHAIN" + python3 test_qemu_fw.py ./firmware_artifacts/"$PACKAGE"/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd + done + done + env: + PACKAGE: ${{ matrix.package.name }} + ARCHS: ${{ matrix.package.archs }} + TARGETS: ${{ matrix.package.targets }} + TOOLCHAIN: ${{ matrix.package.toolchain }} + + - name: Run TestLinux + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + echo Checking "$PACKAGE""$arch" "$target"_"$TOOLCHAIN" + python3 test_qemu_fw.py ./firmware_artifacts/"$PACKAGE"/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd --test-linux + done + done + env: + PACKAGE: ${{ matrix.package.name }} + ARCHS: ${{ matrix.package.archs }} + TARGETS: ${{ matrix.package.targets }} + TOOLCHAIN: ${{ matrix.package.toolchain }} + + - name: Run Windows PE + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + if [ "$arch" = "Ia32" ]; then + WINPE_FILENAME=winpe_IA32.iso + elif [ "$arch" = "X64" ] || [ "$arch" = "3264" ]; then + WINPE_FILENAME=winpe_X64.iso + fi + echo Checking "$PACKAGE""$arch" "$target"_"$TOOLCHAIN" + python3 test_qemu_fw.py ./firmware_artifacts/"$PACKAGE"/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd --test-winpe --test-winpe-path "$WINPE_FILENAME" + done + done + env: + PACKAGE: ${{ matrix.package.name }} + ARCHS: ${{ matrix.package.archs }} + TARGETS: ${{ matrix.package.targets }} + TOOLCHAIN: ${{ matrix.package.toolchain }} diff --git a/.github/workflows/build_x86.yaml b/.github/workflows/build_x86.yaml new file mode 100644 index 0000000000..fbe4031ec2 --- /dev/null +++ b/.github/workflows/build_x86.yaml @@ -0,0 +1,677 @@ +name: Build X86 Firmwares + +on: + push: + pull_request: + workflow_dispatch: + release: + types: [published] + +env: + PROJECT_TYPE: UEFI + FORCE_INSTALL: 1 + WERROR: 1 + QEMU_VERSION_TAG: qemu-ci-8.0.0-r2 + WINPE_VERSION_TAG: images-winpe-1.0 + +jobs: + build-macos: + name: macOS XCODE5 + runs-on: macos-latest + env: + JOB_TYPE: BUILD + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Add Linux Toolchain + run: brew tap FiloSottile/homebrew-musl-cross + + - name: Install Linux Toolchain + run: brew install musl-cross + env: + HOMEBREW_NO_INSTALL_CLEANUP: 1 + HOMEBREW_NO_AUTO_UPDATE: 1 + + - name: Install Dependencies + run: brew install openssl mingw-w64 + env: + HOMEBREW_NO_INSTALL_CLEANUP: 1 + HOMEBREW_NO_AUTO_UPDATE: 1 + + - name: CI Bootstrap + run: | + src=$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/ci-bootstrap.sh) && eval "$src" || exit 1 + touch UDK.ready + + - name: Prepare efibuild.sh + run: | + curl -o ./efibuild.sh https://raw.githubusercontent.com/acidanthera/ocbuild/master/efibuild.sh || exit 1 + chmod +x ./efibuild.sh + ln -s `pwd` UDK + + - name: Build BaseTools + run: ./efibuild.sh + env: + SELFPKG: MdePkg + SKIP_BUILD: 1 + + - name: Build OvmfPkgIa32 + if: always() + run: ./efibuild.sh + env: + SELFPKG: OvmfPkgIa32 + SELFPKG_DIR: OvmfPkg + ARCHS: IA32 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D WINDOWS_10_IA32 + + - name: Build OvmfPkgX64 + if: always() + run: ./efibuild.sh + env: + SELFPKG: OvmfPkgX64 + SELFPKG_DIR: OvmfPkg + ARCHS: X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build OvmfPkgIa32X64 + if: always() + run: ./efibuild.sh + env: + SELFPKG: OvmfPkgIa32X64 + SELFPKG_DIR: OvmfPkg + ARCHS: X64 + ARCHS_EXT: IA32 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UefiPayloadPkg with X64 PEI/DXE + if: always() + run: ./efibuild.sh + env: + SELFPKG: UefiPayloadPkg + ARCHS: X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UefiPayloadPkg with Ia32 PEI and X64 DXE + if: always() + run: ./efibuild.sh + env: + SELFPKG: UefiPayloadPkg + ARCHS: X64 + ARCHS_EXT: IA32 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Prepare artifacts with firmwares + if: always() + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + mkdir -p ./firmware_artifacts/Ovmf/"$arch"/"$target"_"$TOOLCHAIN" + cp ./Build/Ovmf"$arch"/"$target"_"$TOOLCHAIN"/FV/OVMF.fd ./firmware_artifacts/Ovmf/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd + done + done + env: + ARCHS: Ia32,X64,3264 + TARGETS: RELEASE,DEBUG,NOOPT + TOOLCHAIN: XCODE5 + + - name: Zip artifacts + run: zip XCODE5_fw_artifacts.zip ./firmware_artifacts/* -r + + - name: Upload to Artifacts + uses: actions/upload-artifact@v3 + with: + name: XCODE5 Firmware Artifacts + path: XCODE5_fw_artifacts.zip + + build-windows: + name: Windows VS2019 + runs-on: windows-latest + env: + CC: gcc + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Dependencies + run: | + choco install make nasm zip iasl --no-progress + + - name: CI Bootstrap + run: | + src=$(curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/ci-bootstrap.sh) && eval "$src" || exit 1 + touch UDK.ready + + - name: Prepare efibuild.sh + run: | + curl -o ./efibuild.sh https://raw.githubusercontent.com/acidanthera/ocbuild/master/efibuild.sh || exit 1 + chmod +x ./efibuild.sh + cmd <<< "mklink /D .\\UDK .\\" > /dev/null + + - name: Build BaseTools + run: ./efibuild.sh + env: + SELFPKG: MdePkg + SKIP_BUILD: 1 + + - name: Build OvmfPkgIa32 + if: always() + run: ./efibuild.sh + env: + SELFPKG: OvmfPkgIa32 + SELFPKG_DIR: OvmfPkg + ARCHS: IA32 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D WINDOWS_10_IA32 + + - name: Build OvmfPkgX64 + if: always() + run: ./efibuild.sh + env: + SELFPKG: OvmfPkgX64 + SELFPKG_DIR: OvmfPkg + ARCHS: X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build OvmfPkgIa32X64 + if: always() + run: ./efibuild.sh + env: + SELFPKG: OvmfPkgIa32X64 + SELFPKG_DIR: OvmfPkg + ARCHS: X64 + ARCHS_EXT: IA32 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UefiPayloadPkg with X64 PEI/DXE + if: always() + run: ./efibuild.sh + env: + SELFPKG: UefiPayloadPkg + ARCHS: X64 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UefiPayloadPkg with Ia32 PEI and X64 DXE + if: always() + run: ./efibuild.sh + env: + SELFPKG: UefiPayloadPkg + ARCHS: X64 + ARCHS_EXT: IA32 + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Prepare artifacts with firmwares + if: always() + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + mkdir -p ./firmware_artifacts/Ovmf/"$arch"/"$target"_"$TOOLCHAIN" + cp ./Build/Ovmf"$arch"/"$target"_"$TOOLCHAIN"/FV/OVMF.fd ./firmware_artifacts/Ovmf/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd + done + done + env: + ARCHS: Ia32,X64,3264 + TARGETS: RELEASE,DEBUG,NOOPT + TOOLCHAIN: VS2019 + + - name: Zip artifacts + run: zip VS2019_fw_artifacts.zip ./firmware_artifacts/* -r + + - name: Upload to Artifacts + uses: actions/upload-artifact@v3 + with: + name: VS2019 Firmware Artifacts + path: VS2019_fw_artifacts.zip + + build-linux-clangpdb: + name: Linux CLANGPDB + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Use Docker in rootless mode. + uses: ScribeMD/rootless-docker@0.2.2 + + - name: Build BaseTools + run: docker compose run build-package + env: + SELFPKG: MdePkg + SKIP_BUILD: 1 + + - name: Build OvmfPkgIa32 + if: always() + run: docker compose run build-package + env: + SELFPKG: OvmfPkgIa32 + SELFPKG_DIR: OvmfPkg + TOOLCHAINS: CLANGPDB + ARCHS: IA32 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D WINDOWS_10_IA32 + + - name: Build OvmfPkgX64 + if: always() + run: docker compose run build-package + env: + SELFPKG: OvmfPkgX64 + SELFPKG_DIR: OvmfPkg + TOOLCHAINS: CLANGPDB + ARCHS: X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build OvmfPkgIa32X64 + if: always() + run: docker compose run build-package + env: + SELFPKG: OvmfPkgIa32X64 + SELFPKG_DIR: OvmfPkg + TOOLCHAINS: CLANGPDB + ARCHS: X64 + ARCHS_EXT: IA32 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UefiPayloadPkg with X64 PEI/DXE + if: always() + run: docker compose run build-package + env: + SELFPKG: UefiPayloadPkg + SELFPKG_DIR: UefiPayloadPkg + TOOLCHAINS: CLANGPDB + ARCHS: X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UefiPayloadPkg with Ia32 PEI and X64 DXE + if: always() + run: docker compose run build-package + env: + SELFPKG: UefiPayloadPkg + SELFPKG_DIR: UefiPayloadPkg + TOOLCHAINS: CLANGPDB + ARCHS: X64 + ARCHS_EXT: IA32 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Prepare artifacts with firmwares + if: always() + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + mkdir -p ./firmware_artifacts/Ovmf/"$arch"/"$target"_"$TOOLCHAIN" + cp ./Build/Ovmf"$arch"/"$target"_"$TOOLCHAIN"/FV/OVMF.fd ./firmware_artifacts/Ovmf/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd + done + done + env: + ARCHS: Ia32,X64,3264 + TARGETS: RELEASE,DEBUG,NOOPT + TOOLCHAIN: CLANGPDB + + - name: Zip artifacts + run: zip CLANGPDB_fw_artifacts.zip ./firmware_artifacts/* -r + + - name: Upload to Artifacts + uses: actions/upload-artifact@v3 + with: + name: CLANGPDB Firmware Artifacts + path: CLANGPDB_fw_artifacts.zip + + build-linux-clangdwarf: + name: Linux CLANGDWARF + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Use Docker in rootless mode. + uses: ScribeMD/rootless-docker@0.2.2 + + - name: Build BaseTools + run: docker compose run build-package + env: + SELFPKG: MdePkg + SKIP_BUILD: 1 + + - name: Build OvmfPkgIa32 + if: always() + run: docker compose run build-package + env: + SELFPKG: OvmfPkgIa32 + SELFPKG_DIR: OvmfPkg + TOOLCHAINS: CLANGDWARF + ARCHS: IA32 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D WINDOWS_10_IA32 + + - name: Build OvmfPkgX64 + if: always() + run: docker compose run build-package + env: + SELFPKG: OvmfPkgX64 + SELFPKG_DIR: OvmfPkg + TOOLCHAINS: CLANGDWARF + ARCHS: X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build OvmfPkgIa32X64 + if: always() + run: docker compose run build-package + env: + SELFPKG: OvmfPkgIa32X64 + SELFPKG_DIR: OvmfPkg + TOOLCHAINS: CLANGDWARF + ARCHS: X64 + ARCHS_EXT: IA32 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UefiPayloadPkg with X64 PEI/DXE + if: always() + run: docker compose run build-package + env: + SELFPKG: UefiPayloadPkg + SELFPKG_DIR: UefiPayloadPkg + TOOLCHAINS: CLANGDWARF + ARCHS: X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UefiPayloadPkg with Ia32 PEI and X64 DXE + if: always() + run: docker compose run build-package + env: + SELFPKG: UefiPayloadPkg + SELFPKG_DIR: UefiPayloadPkg + TOOLCHAINS: CLANGDWARF + ARCHS: X64 + ARCHS_EXT: IA32 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Prepare artifacts with firmwares + if: always() + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + mkdir -p ./firmware_artifacts/Ovmf/"$arch"/"$target"_"$TOOLCHAIN" + cp ./Build/Ovmf"$arch"/"$target"_"$TOOLCHAIN"/FV/OVMF.fd ./firmware_artifacts/Ovmf/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd + done + done + env: + ARCHS: Ia32,X64,3264 + TARGETS: RELEASE,DEBUG,NOOPT + TOOLCHAIN: CLANGDWARF + + - name: Zip artifacts + run: zip CLANGDWARF_fw_artifacts.zip ./firmware_artifacts/* -r + + - name: Upload to Artifacts + uses: actions/upload-artifact@v3 + with: + name: CLANGDWARF Firmware Artifacts + path: CLANGDWARF_fw_artifacts.zip + + build-linux-gcc5: + name: Linux GCC5 + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Use Docker in rootless mode. + uses: ScribeMD/rootless-docker@0.2.2 + + - name: Build BaseTools + run: docker compose run build-package + env: + SELFPKG: MdePkg + SKIP_BUILD: 1 + + - name: Build OvmfPkgIa32 + if: always() + run: docker compose run build-package + env: + SELFPKG: OvmfPkgIa32 + SELFPKG_DIR: OvmfPkg + TOOLCHAINS: GCC5 + ARCHS: IA32 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + BUILD_ARGUMENTS: -D WINDOWS_10_IA32 + + - name: Build OvmfPkgX64 + if: always() + run: docker compose run build-package + env: + SELFPKG: OvmfPkgX64 + SELFPKG_DIR: OvmfPkg + TOOLCHAINS: GCC5 + ARCHS: X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build OvmfPkgIa32X64 + if: always() + run: docker compose run build-package + env: + SELFPKG: OvmfPkgIa32X64 + SELFPKG_DIR: OvmfPkg + TOOLCHAINS: GCC5 + ARCHS: X64 + ARCHS_EXT: IA32 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UefiPayloadPkg with X64 PEI/DXE + if: always() + run: docker compose run build-package + env: + SELFPKG: UefiPayloadPkg + SELFPKG_DIR: UefiPayloadPkg + TOOLCHAINS: GCC5 + ARCHS: X64 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Build UefiPayloadPkg with Ia32 PEI and X64 DXE + if: always() + run: docker compose run build-package + env: + SELFPKG: UefiPayloadPkg + SELFPKG_DIR: UefiPayloadPkg + TOOLCHAINS: GCC5 + ARCHS: X64 + ARCHS_EXT: IA32 + TARGETS: RELEASE,DEBUG,NOOPT + SKIP_TESTS: 1 + SKIP_PACKAGE: 1 + + - name: Prepare artifacts with firmwares + if: always() + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + mkdir -p ./firmware_artifacts/Ovmf/"$arch"/"$target"_"$TOOLCHAIN" + cp ./Build/Ovmf"$arch"/"$target"_"$TOOLCHAIN"/FV/OVMF.fd ./firmware_artifacts/Ovmf/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd + done + done + env: + ARCHS: Ia32,X64,3264 + TARGETS: RELEASE,DEBUG,NOOPT + TOOLCHAIN: GCC5 + + - name: Zip artifacts + run: zip GCC5_fw_artifacts.zip ./firmware_artifacts/* -r + + - name: Upload to Artifacts + uses: actions/upload-artifact@v3 + with: + name: GCC5 Firmware Artifacts + path: GCC5_fw_artifacts.zip + + test-firmwares: + name: Test + runs-on: ubuntu-22.04 + needs: [build-macos, build-windows, build-linux-clangpdb, build-linux-clangdwarf, build-linux-gcc5] + + strategy: + fail-fast: false + matrix: + package: [ + {name: "Ovmf", archs: "Ia32,X64,3264", toolchain: "XCODE5", targets: "RELEASE,DEBUG,NOOPT"}, + {name: "Ovmf", archs: "Ia32,X64,3264", toolchain: "VS2019", targets: "RELEASE,DEBUG,NOOPT"}, + {name: "Ovmf", archs: "Ia32,X64,3264", toolchain: "CLANGPDB", targets: "RELEASE,DEBUG,NOOPT"}, + {name: "Ovmf", archs: "Ia32,X64,3264", toolchain: "CLANGDWARF", targets: "RELEASE,DEBUG,NOOPT"}, + {name: "Ovmf", archs: "Ia32,X64,3264", toolchain: "GCC5", targets: "RELEASE,DEBUG,NOOPT"}, + ] + steps: + - name: Checkout ocbuild repository + uses: actions/checkout@v3 + with: + repository: acidanthera/ocbuild + ref: master + path: ./ + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y python3 python3-pip libglib2.0-dev libfdt-dev libpixman-1-dev libepoxy-dev libcapstone-dev libsdl2-dev libnuma-dev libgtk-3-dev libvte-2.91-dev libbrlapi-dev libiscsi-dev libnfs-dev librbd-dev libxen-dev + python3 -m pip install -r requirements.txt + + - name: Downloading QEMU + uses: robinraju/release-downloader@v1.7 + with: + repository: "acidanthera/OcBinaryData" + tag: ${{ env.QEMU_VERSION_TAG }} + fileName: "qemu.tar.xz" + + - name: Installing QEMU and add to PATH + run: | + echo "${HOME}/qemu/bin" >> $GITHUB_PATH + tar -xJf ./qemu.tar.xz -C $HOME + + - name: Download a single artifact + uses: actions/download-artifact@v3 + with: + name: ${{ matrix.package.toolchain }} Firmware Artifacts + + - name: Unzip artifacts + run: unzip "$TOOLCHAIN"_fw_artifacts.zip + env: + TOOLCHAIN: ${{ matrix.package.toolchain }} + + - name: Downloading Windows PE X64 iso + uses: robinraju/release-downloader@v1.7 + with: + repository: "acidanthera/OcBinaryData" + tag: ${{ env.WINPE_VERSION_TAG }} + fileName: "winpe_X64.iso" + + - name: Downloading Windows PE IA32 iso + uses: robinraju/release-downloader@v1.7 + with: + repository: "acidanthera/OcBinaryData" + tag: ${{ env.WINPE_VERSION_TAG }} + fileName: "winpe_IA32.iso" + + - name: Run TestConsole + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + echo Checking "$PACKAGE""$arch" "$target"_"$TOOLCHAIN" + python3 test_qemu_fw.py ./firmware_artifacts/"$PACKAGE"/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd + done + done + env: + PACKAGE: ${{ matrix.package.name }} + ARCHS: ${{ matrix.package.archs }} + TARGETS: ${{ matrix.package.targets }} + TOOLCHAIN: ${{ matrix.package.toolchain }} + + - name: Run TestLinux + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + echo Checking "$PACKAGE""$arch" "$target"_"$TOOLCHAIN" + python3 test_qemu_fw.py ./firmware_artifacts/"$PACKAGE"/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd --test-linux + done + done + env: + PACKAGE: ${{ matrix.package.name }} + ARCHS: ${{ matrix.package.archs }} + TARGETS: ${{ matrix.package.targets }} + TOOLCHAIN: ${{ matrix.package.toolchain }} + + - name: Run Windows PE + run: | + IFS=', ' read -r -a TARGETS <<< "$TARGETS" + IFS=', ' read -r -a ARCHS <<< "$ARCHS" + for target in "${TARGETS[@]}"; do + for arch in "${ARCHS[@]}"; do + if [ "$arch" = "Ia32" ]; then + WINPE_FILENAME=winpe_IA32.iso + elif [ "$arch" = "X64" ] || [ "$arch" = "3264" ]; then + WINPE_FILENAME=winpe_X64.iso + fi + echo Checking "$PACKAGE""$arch" "$target"_"$TOOLCHAIN" + python3 test_qemu_fw.py ./firmware_artifacts/"$PACKAGE"/"$arch"/"$target"_"$TOOLCHAIN"/FW.fd --test-winpe --test-winpe-path "$WINPE_FILENAME" + done + done + env: + PACKAGE: ${{ matrix.package.name }} + ARCHS: ${{ matrix.package.archs }} + TARGETS: ${{ matrix.package.targets }} + TOOLCHAIN: ${{ matrix.package.toolchain }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000000..cfaf869127 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,109 @@ +# @file +# GitHub Workflow for CodeQL Analysis +# +# Copyright (c) Microsoft Corporation. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +name: "CodeQL" + +on: + push: + branches: + - master + pull_request: + branches: + - master + paths-ignore: + - '**/*.bat' + - '**/*.md' + - '**/*.py' + - '**/*.rst' + - '**/*.sh' + - '**/*.txt' + + schedule: + # https://crontab.guru/#20_23_*_*_4 + - cron: '20 23 * * 4' + +env: + PROJECT_TYPE: UEFI + FORCE_INSTALL: 1 + WERROR: 1 + +jobs: + analyze: + name: Analyze + runs-on: windows-latest + env: + CC: gcc + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + package: [ + {name: "Ext4Pkg", selfpkg_dir: "Ext4Pkg", archs: "(IA32 X64)", archs_ext: ""}, + {name: "FatPkg", selfpkg_dir: "FatPkg", archs: "(IA32 X64)", archs_ext: ""}, + {name: "IntelFsp2Pkg", selfpkg_dir: "IntelFsp2Pkg", archs: "(IA32 X64)", archs_ext: ""}, + {name: "IntelFsp2WrapperPkg", selfpkg_dir: "IntelFsp2WrapperPkg", archs: "(IA32 X64)", archs_ext: ""}, + {name: "MdeModulePkg", selfpkg_dir: "MdeModulePkg", archs: "(IA32 X64)", archs_ext: ""}, + {name: "MdePkg", selfpkg_dir: "MdePkg", archs: "(IA32 X64)", archs_ext: ""}, + {name: "UefiCpuPkg", selfpkg_dir: "UefiCpuPkg", archs: "(IA32 X64)", archs_ext: ""}, + {name: "UnitTestFrameworkPkg", selfpkg_dir: "UnitTestFrameworkPkg", archs: "(IA32 X64)", archs_ext: ""}, + {name: "OvmfPkgIa32", selfpkg_dir: "OvmfPkg", archs: "(IA32)", archs_ext: ""}, + {name: "OvmfPkgX64", selfpkg_dir: "OvmfPkg", archs: "(X64)", archs_ext: ""}, + {name: "OvmfPkgIa32X64", selfpkg_dir: "OvmfPkg", archs: "(X64)", archs_ext: "IA32"}, + {name: "UefiPayloadPkg", selfpkg_dir: "UefiPayloadPkg", archs: "(X64)", archs_ext: ""}, + {name: "UefiPayloadPkg", selfpkg_dir: "UefiPayloadPkg", archs: "(X64)", archs_ext: "IA32"}, + {name: "NetworkPkg", selfpkg_dir: "NetworkPkg", archs: "(IA32 X64)", archs_ext: ""}, + ] + defaults: + run: + shell: bash + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Dependencies + run: | + choco install make nasm zip iasl --no-progress + + - name: CI Bootstrap + run: | + src=$(curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/ci-bootstrap.sh) && eval "$src" || exit 1 + touch UDK.ready + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: 'cpp' + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://codeql.github.com/docs/codeql-overview/supported-languages-and-frameworks/ + config-file: ./.github/codeql/codeql-config.yml + # Note: Add new queries to codeql-config.yml file as they are enabled. + + - name: Prepare efibuild.sh + run: | + curl -o ./efibuild.sh https://raw.githubusercontent.com/acidanthera/ocbuild/master/efibuild.sh || exit 1 + chmod +x ./efibuild.sh + cmd <<< "mklink /D .\\UDK .\\" > /dev/null + + - name: Build package + run: export ARCHS=${{ matrix.package.archs }}; . ./efibuild.sh + env: + TARGETS: DEBUG + TOOLCHAINS: VS2019 + SELFPKG: ${{ matrix.package.name }} + SELFPKG_DIR: ${{ matrix.package.selfpkg_dir }} + ARCHS_EXT: ${{ matrix.package.archs_ext }} + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.pytool/CISettings.py b/.pytool/CISettings.py index ec3beb0dcf..c6138e696e 100644 --- a/.pytool/CISettings.py +++ b/.pytool/CISettings.py @@ -237,6 +237,8 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManag "MdePkg/Library/MipiSysTLib/mipisyst", False)) rs.append(RequiredSubmodule( "CryptoPkg/Library/MbedTlsLib/mbedtls", False)) + rs.append(RequiredSubmodule( + "OpenCorePkg", False)) return rs def GetName(self): diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100755 index 0000000000..1d2b6adde7 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,13 @@ +name: audk +services: + build-package: + extends: + service: dev-edk2 + file: OpenCorePkg/docker-compose.yaml + environment: + - SELFPKG + - SELFPKG_DIR + entrypoint: + - /bin/bash + - -c + - "{ . ~/.edk2_rc.sh && eval \"$(/usr/bin/curl -Lfs https://raw.githubusercontent.com/acidanthera/ocbuild/master/ci-bootstrap.sh)\" && curl -o ./efibuild.sh \"https://raw.githubusercontent.com/acidanthera/ocbuild/master/efibuild.sh\" && rm -f UDK && ln -s `pwd` UDK && touch UDK.ready && . ./efibuild.sh; } || exit 1"