forked from picolibc/picolibc
-
Notifications
You must be signed in to change notification settings - Fork 0
231 lines (201 loc) · 9.79 KB
/
linux.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
name: Linux
on:
push:
branches:
- main
pull_request:
branches:
- main
# When a PR is updated, cancel the jobs from the previous version. Merges
# do not define head_ref, so use run_id to never cancel those jobs.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
# CCache is disabled for the Linux jobs for now.
CCACHE_SIZE: "0M"
CCACHE_CMD: true
DOCKERFILE: picolibc/.github/Dockerfile
IMAGE_FILE: dockerimg-linux.tar.zst
IMAGE: picolibc-linux
PACKAGES_FILE: picolibc/.github/linux-packages.txt
EXTRA_FILE: picolibc/.github/linux-files.txt
jobs:
cache-maker:
runs-on: ubuntu-latest
steps:
- name: Clone picolibc
uses: actions/checkout@v4
with:
path: picolibc
- name: Cache the Docker Image
id: cache
uses: actions/cache@v4
with:
path: ${{ env.IMAGE_FILE }}
key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.DOCKERFILE, env.PACKAGES_FILE, env.EXTRA_FILE ) }}
lookup-only: true
- name: Set up Docker Buildx
if: steps.cache.outputs.cache-hit != 'true'
uses: docker/setup-buildx-action@v3
- name: Build picolibc container
if: steps.cache.outputs.cache-hit != 'true'
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
file: .github/Dockerfile
tags: ${{ env.IMAGE }}:latest
outputs: type=docker,force-compression=true,compression=zstd,compression-level=22,dest=${{ env.IMAGE_FILE }}
cmake-linux:
needs: cache-maker
runs-on: ubuntu-latest
strategy:
matrix:
cmake_flags: [
"",
# optional configurations
"-D__IO_FLOAT=y -D_IO_FLOAT_EXACT=n -D_WANT_IO_LONG_LONG=y -D_MB_CAPABLE=y -D_WANT_IO_POS_ARGS=y -D__HAVE_LOCALE_INFO__=y -D__HAVE_LOCALE_INFO_EXTENDED__=y -D_WANT_MINIMAL_IO_LONG_LONG=y -D_PRINTF_PERCENT_N=y",
]
test: [
"./.github/do-cmake-linux -DCMAKE_BUILD_TYPE=RelWithDebInfo",
"./.github/do-cmake-linux -DCMAKE_BUILD_TYPE=MinSizeRel",
]
steps:
- name: Clone picolibc
uses: actions/checkout@v4
with:
path: picolibc
- name: Restore the Docker Image
uses: actions/cache@v4
with:
path: ${{ env.IMAGE_FILE }}
key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.DOCKERFILE, env.PACKAGES_FILE, env.EXTRA_FILE ) }}
fail-on-cache-miss: true
- name: Load and Check the Docker Image
run: |
docker load -i $IMAGE_FILE
docker images -a $IMAGE
# The docker image contains ccache, but the ccache action uses the ccache
# outside docker for statistics, so install the same ccache version.
# Install in /usr/bin so the ccache action gets the expected environment.
- name: install ccache
if: matrix.test == './.github/do-zephyr'
run: |
wget -nv https://github.com/ccache/ccache/releases/download/v4.8.2/ccache-4.8.2-linux-x86_64.tar.xz
sudo tar xf ccache-4.8.2-linux-x86_64.tar.xz -C /usr/bin --strip-components=1 --no-same-owner ccache-4.8.2-linux-x86_64/ccache
rm -f ccache-*-linux-x86_64.tar.xz
# Key on job name and cache size to get separate caches for linux
# and zephyr.
- name: ccache
if: matrix.test == './.github/do-zephyr'
uses: hendrikmuhs/[email protected]
with:
key: compilation-${{ runner.os }}-${{ github.job }}-${{ matrix.meson_flags }}-${{ env.CCACHE_SIZE }}
max-size: ${{ env.CCACHE_SIZE }}
- name: CMake test
run: |
docker run -v $(readlink -f picolibc):/picolibc -w /picolibc -v $GITHUB_WORKSPACE/.ccache:/root/.ccache $IMAGE bash --login -c "${{ env.CCACHE_CMD }} --set-config=max_size=${{ env.CCACHE_SIZE }} && ${{ matrix.test }} ${{ matrix.cmake_flags }}"
minsize-linux:
needs: cache-maker
runs-on: ubuntu-latest
strategy:
matrix:
meson_flags: [
"",
# Tinystdio and math configurations, one with multithread disabled and with locale, original malloc and atexit/onexit code
"-Dio-float-exact=false -Dio-long-long=true -Dio-percent-b=true -Dio-long-double=true -Dnewlib-obsolete-math=false -Dwant-math-errno=true -Dnewlib-multithread=false -Dnewlib-retargetable-locking=false -Dnewlib-locale-info=true -Dnewlib-locale-info-extended=true -Dnewlib-mb=true -Dnewlib-iconv-external-ccs=true -Dnewlib-nano-malloc=false -Dpicoexit=false -Dprintf-small-ultoa=true -Dprintf-percent-n=true",
"-Dformat-default=integer -Dfreestanding=true -Dposix-io=false -Dnewlib-obsolete-math=true -Dwant-math-errno=true -Dassert-verbose=false -Dfast-bufio=true",
# Original stdio, one with multithread disabled
"-Dtinystdio=false",
"-Dtinystdio=false -Dnewlib-io-float=true -Dio-long-long=true -Dio-long-double=true -Dnewlib-fvwrite-in-streamio=true -Dnewlib-multithread=false -Dnewlib-retargetable-locking=false",
]
test: [
"./.github/do-linux",
]
steps:
- name: Clone picolibc
uses: actions/checkout@v4
with:
path: picolibc
- name: Restore the Docker Image
uses: actions/cache@v4
with:
path: ${{ env.IMAGE_FILE }}
key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.DOCKERFILE, env.PACKAGES_FILE, env.EXTRA_FILE ) }}
fail-on-cache-miss: true
- name: Load and Check the Docker Image
run: |
docker load -i $IMAGE_FILE
docker images -a $IMAGE
# The docker image contains ccache, but the ccache action uses the ccache
# outside docker for statistics, so install the same ccache version.
# Install in /usr/bin so the ccache action gets the expected environment.
- name: install ccache
if: matrix.test == './.github/do-zephyr'
run: |
wget -nv https://github.com/ccache/ccache/releases/download/v4.8.2/ccache-4.8.2-linux-x86_64.tar.xz
sudo tar xf ccache-4.8.2-linux-x86_64.tar.xz -C /usr/bin --strip-components=1 --no-same-owner ccache-4.8.2-linux-x86_64/ccache
rm -f ccache-*-linux-x86_64.tar.xz
# Key on job name and cache size to get separate caches for linux
# and zephyr.
- name: ccache
if: matrix.test == './.github/do-zephyr'
uses: hendrikmuhs/[email protected]
with:
key: compilation-${{ runner.os }}-${{ github.job }}-${{ matrix.meson_flags }}-${{ env.CCACHE_SIZE }}
max-size: ${{ env.CCACHE_SIZE }}
- name: Minsize test
run: |
docker run -v $(readlink -f picolibc):/picolibc -w /picolibc -v $GITHUB_WORKSPACE/.ccache:/root/.ccache $IMAGE bash --login -c "${{ env.CCACHE_CMD }} --set-config=max_size=${{ env.CCACHE_SIZE }} && ${{ matrix.test }} ${{ matrix.meson_flags }} --buildtype minsize"
release-linux:
needs: cache-maker
runs-on: ubuntu-latest
strategy:
matrix:
meson_flags: [
"",
# Tinystdio and math configurations, one with multithread disabled and with locale, original malloc and atexit/onexit code
"-Dio-float-exact=false -Dio-long-long=true -Dio-percent-b=true -Dio-long-double=true -Dnewlib-obsolete-math=false -Dwant-math-errno=true -Dnewlib-multithread=false -Dnewlib-retargetable-locking=false -Dnewlib-locale-info=true -Dnewlib-locale-info-extended=true -Dnewlib-mb=true -Dnewlib-iconv-external-ccs=true -Dnewlib-nano-malloc=false -Dpicoexit=false -Dprintf-small-ultoa=true -Dprintf-percent-n=true",
"-Dformat-default=integer -Dfreestanding=true -Dposix-io=false -Dnewlib-obsolete-math=true -Dwant-math-errno=true -Dassert-verbose=false -Dfast-bufio=true",
# Original stdio, one with multithread disabled
"-Dtinystdio=false",
"-Dtinystdio=false -Dnewlib-io-float=true -Dio-long-long=true -Dio-long-double=true -Dnewlib-fvwrite-in-streamio=true -Dnewlib-multithread=false -Dnewlib-retargetable-locking=false",
]
test: [
"./.github/do-linux",
]
steps:
- name: Clone picolibc
uses: actions/checkout@v4
with:
path: picolibc
- name: Restore the Docker Image
uses: actions/cache@v4
with:
path: ${{ env.IMAGE_FILE }}
key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.DOCKERFILE, env.PACKAGES_FILE, env.EXTRA_FILE ) }}
fail-on-cache-miss: true
- name: Load and Check the Docker Image
run: |
docker load -i $IMAGE_FILE
docker images -a $IMAGE
# The docker image contains ccache, but the ccache action uses the ccache
# outside docker for statistics, so install the same ccache version.
# Install in /usr/bin so the ccache action gets the expected environment.
- name: install ccache
if: matrix.test == './.github/do-zephyr'
run: |
wget -nv https://github.com/ccache/ccache/releases/download/v4.8.2/ccache-4.8.2-linux-x86_64.tar.xz
sudo tar xf ccache-4.8.2-linux-x86_64.tar.xz -C /usr/bin --strip-components=1 --no-same-owner ccache-4.8.2-linux-x86_64/ccache
rm -f ccache-*-linux-x86_64.tar.xz
# Key on job name and cache size to get separate caches for linux
# and zephyr.
- name: ccache
if: matrix.test == './.github/do-zephyr'
uses: hendrikmuhs/[email protected]
with:
key: compilation-${{ runner.os }}-${{ github.job }}-${{ matrix.meson_flags }}-${{ env.CCACHE_SIZE }}
max-size: ${{ env.CCACHE_SIZE }}
- name: Release test
run: |
docker run -v $(readlink -f picolibc):/picolibc -w /picolibc -v $GITHUB_WORKSPACE/.ccache:/root/.ccache $IMAGE bash --login -c "${{ env.CCACHE_CMD }} --set-config=max_size=${{ env.CCACHE_SIZE }} && ${{ matrix.test }} ${{ matrix.meson_flags }} --buildtype release"