This repository has been archived by the owner on May 31, 2024. It is now read-only.
forked from espressif/qemu
-
Notifications
You must be signed in to change notification settings - Fork 0
175 lines (157 loc) · 5.34 KB
/
build.yml
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: Build
on:
push:
release:
types: [published]
jobs:
build:
name: Build QEMU
strategy:
# The matrix will run all possible combinations in parallel.
matrix:
# ubuntu-20.04 so that we don't depend on a recent glibc.
container: [
{ os: ubuntu-20.04, shell: bash },
{ os: macos-latest, shell: bash },
{ os: windows-latest, shell: 'msys2 {0}' }
]
runs-on: ${{ matrix.container.os }}
defaults:
run:
shell: ${{ matrix.container.shell }}
steps:
- uses: actions/checkout@v3
- name: Ccache cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-ccache-${{ github.sha }}
restore-keys: ${{ runner.os }}-ccache-
# Fetch the dependencies. Different for each platform.
- name: Install dependencies - Linux
if: runner.os == 'Linux'
run: |
sudo apt-get update -q
sudo apt-get install -q ninja-build libgcrypt20 libgcrypt20-dev ccache libslirp0 libslirp-dev
ninja --version
- name: Install dependencies - macOS
if: runner.os == 'macOS'
run: |
brew install ninja ccache
ninja --version
- name: Install dependencies - Windows
if: runner.os == 'Windows'
uses : msys2/setup-msys2@v2
with:
update: true
install: |
base-devel
mingw-w64-x86_64-toolchain
git
python
ninja
mingw-w64-x86_64-glib2
mingw-w64-x86_64-pixman
python-setuptools
mingw-w64-x86_64-libslirp
mingw-w64-x86_64-libgcrypt
mingw-w64-x86_64-ccache
- name: Set workspace path
working-directory: ${{ github.workspace }}
run: |
echo "WORKSPACE=$(pwd)" >> $GITHUB_ENV
- name: Ccache zero stats
env:
CCACHE_DIR: ${{ env.WORKSPACE }}/.ccache
CCACHE_BASEDIR: ${{ env.WORKSPACE }}
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: '6'
CCACHE_MAXSIZE: 400M
run: |
ccache -z
- name: Configure
env:
CC: ccache gcc
CXX: ccache g++
CCACHE_DIR: ${{ env.WORKSPACE }}/.ccache
CCACHE_BASEDIR: ${{ env.WORKSPACE }}
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: '6'
CCACHE_MAXSIZE: 400M
run: |
./configure \
--prefix=/ \
--target-list=xtensa-softmmu \
--disable-capstone \
--disable-vnc \
--enable-gcrypt \
--disable-curl \
--disable-qga-vss
- name: Build
env:
CCACHE_DIR: ${{ env.WORKSPACE }}/.ccache
CCACHE_BASEDIR: ${{ env.WORKSPACE }}
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: '6'
CCACHE_MAXSIZE: 400M
run: |
make -j$(nproc)
- name: Ccache stats
env:
CCACHE_DIR: ${{ env.WORKSPACE }}/.ccache
CCACHE_BASEDIR: ${{ env.WORKSPACE }}
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: '6'
CCACHE_MAXSIZE: 400M
run: |
ccache -s
- name: Install
run: |
mkdir -p qemu-${{ runner.os }}-tmp
make -C build install DESTDIR=$(pwd)/qemu-${{ runner.os }}-tmp
- name: Move archive files - Windows
# The installation prefixes the actual path with the path of the msys2
# directory.
# For simplicity find the path of the executable and use its dirname, then
# replace the original installation directory with the new one.
if: runner.os == 'Windows'
shell: bash
run: |
INSTALL_DIR=${{ env.WORKSPACE }}/qemu-${{ runner.os }}-tmp
mv $INSTALL_DIR $INSTALL_DIR.tmp
qemu_path=$(dirname $(find $INSTALL_DIR.tmp -name qemu-system-xtensa.exe))
mv $qemu_path $INSTALL_DIR
- name: Create archive - Linux/macOS
if: runner.os != 'Windows'
shell: bash
run: |
find qemu-${{ runner.os }}-tmp
mkdir qemu-${{ runner.os }}
cp qemu-${{ runner.os }}-tmp/bin/qemu-system-xtensa qemu-${{ runner.os }}
cp qemu-${{ runner.os }}-tmp/share/qemu/esp32* qemu-${{ runner.os }}
tar -czf qemu-${{ runner.os }}.tar.gz qemu-${{ runner.os }}
- name: Create archive - Windows
if: runner.os == 'Windows'
shell: bash
run: |
find qemu-${{ runner.os }}-tmp
mkdir qemu-${{ runner.os }}
cp qemu-${{ runner.os }}-tmp/qemu-system-xtensa.exe qemu-${{ runner.os }}
cp qemu-${{ runner.os }}-tmp/share/esp32* qemu-${{ runner.os }}
tar -czf qemu-${{ runner.os }}.tar.gz qemu-${{ runner.os }}
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: qemu-${{ runner.os }}
path: |
qemu-${{ runner.os }}.tar.gz
- name: Upload release artifacts
if: |
github.event_name == 'release' &&
github.repository_owner == 'toitlang'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: qemu-${{ runner.os }}.tar.gz
tag: ${{ github.ref }}
overwrite: true