Skip to content

wip: ci Vars

wip: ci Vars #72

Workflow file for this run

name: 'build'
on: [push, pull_request]
jobs:
Vars:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.Vars.outputs.VERSION }}
PROJECT_NAME: ${{ steps.Vars.outputs.PROJECT_NAME }}
REPOSITORY_URL: ${{ steps.Vars.outputs.REPOSITORY_URL }}
steps:
- id: Vars
run: |
echo "ref_type: ${{ github.ref_type }}"
echo "ref: ${{ github.ref }}"
echo "sha: ${{ github.sha }}"
echo ""
if [[ "${{ github.ref_type }}" == "tag" ]]; then
VERSION=${{ github.ref }}
VERSION=${VERSION#"refs/tags/"}
VERSION=${VERSION//"-"/"_"} # replace dashes with underscores in the version
else
VERSION=${{ github.sha }}
VERSION=g${VERSION:0:8}
fi
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
echo $VERSION
OWNER=${{ github.repository_owner }}
FULLNAME=${{ github.repository }}
PROJECT_NAME=${FULLNAME#"$OWNER/"}
echo "PROJECT_NAME=$PROJECT_NAME" >> "$GITHUB_OUTPUT"
echo $PROJECT_NAME
REPOSITORY_URL=${{ github.server_url }}/${{ github.repository }}
echo "REPOSITORY_URL=$REPOSITORY_URL" >> "$GITHUB_OUTPUT"
echo $REPOSITORY_URL
Build:
needs: [ Vars ]
strategy:
fail-fast: false
matrix:
platform: [x86_64-linux-gnu, aarch64-linux-gnu]
target: [xtensa-softmmu, riscv32-softmmu]
include:
#- platform: macos-x86_64
# runs_on: macos-12
# extra_configure_args: "--disable-cocoa --disable-coreaudio --python=python3.11"
# shell: bash -e {0}
# - platform: macos-arm64
# runs_on: macos-latest-xlarge
# extra_configure_args: "--disable-cocoa --disable-coreaudio"
# shell: bash -e {0}
- platform: x86_64-linux-gnu
runs_on: ubuntu-20.04
run_prerequisites: "sudo ./.github/workflows/scripts/prerequisites-linux-amd64.sh"
run_configure: "./.github/workflows/scripts/configure-linux-amd64.sh"
# Building with -Werror only on Linux as that breaks some features detection
# in meson on macOS.
#extra_configure_args: "--extra-cflags=-Werror --disable-gtk"
shell: bash -e {0}
- platform: aarch64-linux-gnu
runs_on: ubuntu-20.04
# Used the minimal docker-hub's image instead of the heavy GitHub's one for correct croossbuild prerequisites
container: ubuntu:20.04
run_prerequisites: "./.github/workflows/scripts/prerequisites-cross-linux-arm64.sh"
run_configure: "./.github/workflows/scripts/configure-cross-linux-arm64.sh"
#extra_configure_args: "--disable-gtk --cross-prefix=aarch64-linux-gnu-"
shell: bash -e {0}
# - platform: win-x86_64
# runs_on: windows-2022
# extra_configure_args: ""
# shell: msys2 {0}
runs-on: ${{ matrix.runs_on }}
container: ${{ matrix.container }}
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- uses: actions/checkout@v4
- name: Install prerequisites (${{ matrix.target }} @ ${{ matrix.platform }})
run: |
echo "DBG0"
echo ${{ matrix.container }}
echo ${{ matrix.runs_on }}
${{ matrix.run_prerequisites }}
- name: Configure (${{ matrix.target }} @ ${{ matrix.platform }})
env:
VERSION: ${{ needs.Vars.outputs.VERSION }}
TARGET: ${{ matrix.target }}
run: |
echo "DBG0"
echo ${{ matrix.container }}
echo ${{ matrix.runs_on }}
${{ matrix.run_configure }}
- name: Build (${{ matrix.target }} @ ${{ matrix.platform }})
run: |
ninja -C build
- name: Package (${{ matrix.target }} @ ${{ matrix.platform }})
env:
VERSION: ${{ needs.Vars.outputs.VERSION }}
PROJECT_NAME: ${{ needs.Vars.outputs.PROJECT_NAME }}
PLATFORM: ${{ matrix.platform }}
TARGET: ${{ matrix.target }}
run: |
find $PWD/install/qemu -maxdepth 1 -mindepth 1 -not -name 'esp*.bin' -exec rm -rf {} \;
export DIST_DIR=${PWD}/dist
mkdir -p ${DIST_DIR}
cd install/
export ARCHIVE_NAME=${PROJECT_NAME}-${TARGET}-${VERSION}-${PLATFORM}.tar.gz
tar -czvf ${DIST_DIR}/${ARCHIVE_NAME} qemu
echo "${ARCHIVE_NAME}" > ${DIST_DIR}/file_${PLATFORM}_${TARGET}
- name: Archive production artifacts (${{ matrix.target }} @ ${{ matrix.platform }})
uses: actions/upload-artifact@v3
with:
name: dist-dummy-qemu
path: |
dist
# - name: Package distribution archive
# run: |
# ninja -C build install
# find install/qemu/share/qemu -maxdepth 1 -mindepth 1 -not -name 'esp*.bin' -exec rm -rf {} \;
# mkdir -p dist
# export DIST_DIR=${PWD}/dist
# export ARCHIVE_NAME=qemu-${{ github.ref_name }}-${{ matrix.platform }}.tar.bz2
# cd install
# tar cjvf ${DIST_DIR}/${ARCHIVE_NAME} qemu
# cd ${DIST_DIR}
# shasum -a 256 *.tar.bz2 > ${ARCHIVE_NAME}.sha256