Skip to content

Commit

Permalink
github: Add workflow for building QEMU (#203)
Browse files Browse the repository at this point in the history
Summary:
We need a way to build QEMU releases for CircleCI, so I'm porting the workflow I had from https://github.com/facebook/openbmc-qemu.

Pull Request resolved: #203

Test Plan: Verified running the workflow in my fork: https://fburl.com/50vff1f6

Reviewed By: williamspatrick

Pulled By: peterdelevoryas

fbshipit-source-id: f27875768e0b33c80c9b8ce41ccec838483b0241
  • Loading branch information
peterdelevoryas authored and facebook-github-bot committed Oct 12, 2022
1 parent 34ebc9c commit d45d59c
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/actions/build_qemu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM ubuntu:20.04
RUN ln -snf /usr/share/zoneinfo/US/Pacific /etc/localtime && echo "US/Pacific" > /etc/timezone
RUN apt update
RUN apt install -y \
git make gcc ninja-build pkg-config libglib2.0-dev libpixman-1-dev python3.8-venv \
chrpath cpio diffstat g++ gawk liblz4-tool wget zstd locales
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
5 changes: 5 additions & 0 deletions .github/actions/build_qemu/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: 'Build QEMU'
description: 'Build QEMU, using bitbake to fetch the source code'
runs:
using: 'docker'
image: 'Dockerfile'
23 changes: 23 additions & 0 deletions .github/actions/build_qemu/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e

git config --global --add safe.directory "$PWD"
git config --global user.name "openbmc"
git config --global user.email "[email protected]"
./sync_yocto.sh
. ./openbmc-init-build-env greatlakes build
touch conf/sanity.conf
devtool modify qemu-system-native
cd workspace/sources/qemu-system-native
./configure \
--target-list=aarch64-softmmu \
--with-git-submodules=ignore \
--without-default-features \
--disable-debug-info \
--disable-install-blobs \
--enable-strip \
--enable-tpm \
--enable-slirp=internal
ninja -C build
./build/qemu-system-aarch64 -h
57 changes: 57 additions & 0 deletions .github/workflows/qemu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag'
required: True
name: Create QEMU release
jobs:
build_qemu_executable:
name: Build QEMU
runs-on: ubuntu-20.04
steps:
- name: Checkout OpenBMC
uses: actions/checkout@v3
- name: Build QEMU
uses: ./.github/actions/build_qemu
- name: Save qemu-system-aarch64 build artifact
uses: actions/upload-artifact@v3
with:
name: qemu-system-aarch64
path: ./build/workspace/sources/qemu-system-native/build/qemu-system-aarch64
create_release:
name: Create release
needs: [build_qemu_executable]
runs-on: ubuntu-20.04
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.tag }}
release_name: ${{ github.event.inputs.tag }}
draft: false
prerelease: false
upload_qemu_executable:
name: Upload QEMU binary to release assets
needs: [build_qemu_executable, create_release]
runs-on: ubuntu-20.04
steps:
- name: Download QEMU binary
id: download
uses: actions/download-artifact@v3
with:
name: qemu-system-aarch64
- name: Add qemu-system-aarch64 release artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ steps.download.outputs.download-path }}/qemu-system-aarch64
asset_name: qemu-system-aarch64
asset_content_type: application/octet-stream

0 comments on commit d45d59c

Please sign in to comment.