-
-
Notifications
You must be signed in to change notification settings - Fork 429
125 lines (122 loc) · 4.72 KB
/
build-windows.yml
File metadata and controls
125 lines (122 loc) · 4.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Build for Windows
on:
workflow_call:
inputs:
pkg_version:
description: Build version
required: true
type: string
jobs:
build:
name: Build for Windows (${{ matrix.arch }}, ${{ matrix.configuration }})
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x86_64, arm64]
configuration: [debug, release]
container:
image: ghcr.io/xemu-project/xemu-win64-toolchain${{ matrix.arch == 'x86_64' && '-gcc:sha-18018f1' || ':sha-0d06ce8' }}
defaults:
run:
shell: bash
env:
CCACHE_DIR: /tmp/xemu-ccache
CCACHE_MAXSIZE: 512M
LTO_CACHE_DIR: /tmp/xemu-lto-ccache
CROSSPREFIX: ${{ matrix.arch == 'arm64' && 'aarch64' || 'x86_64' }}-w64-mingw32.static-
CROSSAR: ${{ matrix.arch == 'arm64' && 'aarch64' || 'x86_64' }}-w64-mingw32.static-${{ matrix.arch == 'arm64' && 'ar' || 'gcc-ar' }}
steps:
- name: Download source package
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v4
with:
name: src
- name: Install zstd
if: ${{ matrix.arch == 'arm64' }}
run: apt-get install zstd
- name: Extract source package
run: tar -xf xemu-${{ inputs.pkg_version }}.tar.zst --strip-components=2
- name: Initialize compiler cache
id: cache
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v4
with:
path: |
${{ env.CCACHE_DIR }}
${{ env.LTO_CACHE_DIR }}
key: cache-wincross-${{ runner.os }}-${{ matrix.arch }}-${{ matrix.configuration }}-${{ github.sha }}
restore-keys: cache-wincross-${{ runner.os }}-${{ matrix.arch }}-${{ matrix.configuration }}-
- name: Setup ccache
run: |
mkdir -p ${CCACHE_DIR}
ccache -z
- name: Setup build options
run: |
if [[ "${{ matrix.configuration }}" == "debug" ]]; then
opts=(
--debug
)
elif [[ "${{ matrix.arch }}" == "x86_64" ]]; then
opts=(
--extra-cflags="-flto-incremental=${LTO_CACHE_DIR} -flto-partition=cache"
-Db_lto=true
)
mkdir -p ${LTO_CACHE_DIR}
elif [[ "${{ matrix.arch }}" == "arm64" ]]; then
# FIXME: llvm-mingw ThinLTO has an issue with `qemu_build_not_reached_always`
# being intentionaly undefined (to ensure 'unreachable' paths are
# optimized out). Regular LTO doesn't pass cv2pdb. Resolve linking
# failure and have llvm toolchain generate PDB directly.
opts=()
fi
echo "XEMU_BUILD_OPTIONS=${opts[*]}" >> "$GITHUB_ENV"
- name: Compile
run: ./build.sh -p win64-cross ${XEMU_BUILD_OPTIONS}
- name: Report ccache stats
run: ccache -s
- name: Upload build artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v4
with:
name: xemu-windows-${{ matrix.arch }}-${{ matrix.configuration }}
path: dist
# Generate a symbols package for Windows. Use cv2pdb to generate PDBs from
# DWARF and update + strip the executable. Re-package the original release
# and create symbols package.
generate_pdb:
name: Generate PDB for Windows (${{ matrix.arch }}, ${{ matrix.configuration }})
runs-on: windows-latest
needs: build
strategy:
matrix:
arch: [x86_64, arm64]
configuration: [debug, release]
steps:
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v4
with:
name: xemu-windows-${{ matrix.arch }}-${{ matrix.configuration }}
path: dist
- name: Generate PDB
run: |
Invoke-WebRequest -Uri "https://github.com/rainers/cv2pdb/releases/download/v0.52/cv2pdb-0.52.zip" -OutFile "cv2pdb.zip"
7z x -ocv2pdb -y cv2pdb.zip
cd dist
../cv2pdb/cv2pdb64.exe xemu.exe
- name: Determine package version
id: package_id
shell: bash
env:
VERSION: ${{ inputs.pkg_version }}${{ matrix.configuration == 'debug' && '-dbg' || '' }}
run: |
echo "pkg_filename=xemu-${VERSION}-windows-${{ matrix.arch }}.zip" >> $GITHUB_OUTPUT
echo "pdb_filename=xemu-${VERSION}-windows-${{ matrix.arch }}-pdb.zip" >> $GITHUB_OUTPUT
- name: Package
run: |
mkdir dist-pdb
cd dist
7z a -tzip ../dist-pdb/${{ steps.package_id.outputs.pkg_filename}} * "-xr!*.pdb"
7z a -tzip ../dist-pdb/${{ steps.package_id.outputs.pdb_filename}} "-ir!*.pdb"
- name: Upload build artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v4
with:
name: xemu-windows-${{ matrix.arch }}-${{ matrix.configuration }}-pdb
path: dist-pdb
compression-level: 0