1name: Linux
2
3on:
4  push:
5    branches:
6      - main
7  pull_request:
8    branches:
9      - main
10
11env:
12  IMAGE_FILE: dockerimg.tar
13  IMAGE: picolibc
14  PACKAGES_FILE: picolibc/.github/packages.txt
15  EXTRA_FILE: picolibc/.github/extra-files.txt
16
17jobs:
18  cache-maker:
19    runs-on: ubuntu-latest
20    steps:
21      - name: Clone picolibc
22        uses: actions/checkout@v2
23        with:
24          path: picolibc
25
26      - name: Cache the Docker Image
27        id: cache
28        uses: actions/cache@v2
29        with:
30          path: ${{ env.IMAGE_FILE }}
31          key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.PACKAGES_FILE, env.EXTRA_FILE ) }}
32
33      - name: Set up Docker Buildx
34        if: steps.cache.outputs.cache-hit != 'true'
35        uses: docker/setup-buildx-action@v1
36
37      - name: Build picolibc container
38        if: steps.cache.outputs.cache-hit != 'true'
39        uses: docker/build-push-action@v2
40        with:
41          platforms: linux/amd64
42          file: .github/Dockerfile
43          tags: ${{ env.IMAGE }}:latest
44          outputs: type=docker,dest=${{ env.IMAGE_FILE }}
45
46  cmake-linux:
47    needs: cache-maker
48    runs-on: ubuntu-latest
49    strategy:
50      matrix:
51        cmake_flags: [
52          "",
53          # optional configurations
54          "-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 ",
55        ]
56        test: [
57	  "./.github/do-cmake-linux",
58	]
59    steps:
60      - name: Clone picolibc
61        uses: actions/checkout@v2
62        with:
63          path: picolibc
64
65      - name: Restore the Docker Image
66        uses: actions/cache@v2
67        with:
68          path: ${{ env.IMAGE_FILE }}
69          key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.PACKAGES_FILE, env.EXTRA_FILE ) }}
70
71      - name: Load and Check the Docker Image
72        run: |
73          docker load -i $IMAGE_FILE
74          docker images -a $IMAGE
75
76      - name: CMake test
77        run: |
78          docker run -v $(readlink -f picolibc):/picolibc -w /picolibc $IMAGE ${{ matrix.test }} ${{ matrix.cmake_flags }}
79
80  fortify-source-linux:
81    needs: cache-maker
82    runs-on: ubuntu-latest
83    strategy:
84      matrix:
85        meson_flags: [
86          "",
87
88          # Math configurations
89          "-Dnewlib-obsolete-math=false -Dwant-math-errno=true",
90          "-Dnewlib-obsolete-math=true -Dwant-math-errno=true",
91
92          # Tinystdio configurations
93          "-Dio-float-exact=false -Dio-long-long=true -Dio-percent-b=true -Dio-long-double=true",
94          "-Dformat-default=integer -Dfreestanding=true",
95
96          # Original stdio
97          "-Dtinystdio=false",
98          "-Dtinystdio=false -Dnewlib-io-float=true -Dio-long-long=true -Dio-long-double=true -Dnewlib-fvwrite-in-streamio=true",
99
100          # Locale, iconv, original malloc and original atexit/onexit configurations
101          "-Dnewlib-locale-info=true -Dnewlib-locale-info-extended=true -Dnewlib-mb=true -Dnewlib-iconv-external-ccs=true -Dnewlib-nano-malloc=false -Dpicoexit=false",
102
103          # Multithread disabled
104          "-Dnewlib-multithread=false -Dnewlib-retargetable-locking=false",
105          "-Dnewlib-multithread=false -Dnewlib-retargetable-locking=false -Dtinystdio=false",
106        ]
107        test: [
108	  "./.github/do-linux",
109	]
110    steps:
111      - name: Clone picolibc
112        uses: actions/checkout@v2
113        with:
114          path: picolibc
115
116      - name: Restore the Docker Image
117        uses: actions/cache@v2
118        with:
119          path: ${{ env.IMAGE_FILE }}
120          key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.PACKAGES_FILE, env.EXTRA_FILE ) }}
121
122      - name: Load and Check the Docker Image
123        run: |
124          docker load -i $IMAGE_FILE
125          docker images -a $IMAGE
126
127      - name: Fortity source test
128        run: |
129          docker run -v $(readlink -f picolibc):/picolibc -w /picolibc $IMAGE ${{ matrix.test }} ${{ matrix.meson_flags }} -Dfortify-source=2
130
131  minsize-linux:
132    needs: cache-maker
133    runs-on: ubuntu-latest
134    strategy:
135      matrix:
136        meson_flags: [
137          "",
138
139          # Math configurations
140          "-Dnewlib-obsolete-math=false -Dwant-math-errno=true",
141          "-Dnewlib-obsolete-math=true -Dwant-math-errno=true",
142
143          # Tinystdio configurations
144          "-Dio-float-exact=false -Dio-long-long=true -Dio-percent-b=true -Dio-long-double=true",
145          "-Dformat-default=integer -Dfreestanding=true",
146
147          # Original stdio
148          "-Dtinystdio=false",
149          "-Dtinystdio=false -Dnewlib-io-float=true -Dio-long-long=true -Dio-long-double=true -Dnewlib-fvwrite-in-streamio=true",
150
151          # Locale, iconv, original malloc and original atexit/onexit configurations
152          "-Dnewlib-locale-info=true -Dnewlib-locale-info-extended=true -Dnewlib-mb=true -Dnewlib-iconv-external-ccs=true -Dnewlib-nano-malloc=false -Dpicoexit=false",
153
154          # Multithread disabled
155          "-Dnewlib-multithread=false -Dnewlib-retargetable-locking=false",
156          "-Dnewlib-multithread=false -Dnewlib-retargetable-locking=false -Dtinystdio=false",
157        ]
158        test: [
159	  "./.github/do-linux",
160	]
161    steps:
162      - name: Clone picolibc
163        uses: actions/checkout@v2
164        with:
165          path: picolibc
166
167      - name: Restore the Docker Image
168        uses: actions/cache@v2
169        with:
170          path: ${{ env.IMAGE_FILE }}
171          key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.PACKAGES_FILE, env.EXTRA_FILE ) }}
172
173      - name: Load and Check the Docker Image
174        run: |
175          docker load -i $IMAGE_FILE
176          docker images -a $IMAGE
177
178      - name: Minsize test
179        run: |
180          docker run -v $(readlink -f picolibc):/picolibc -w /picolibc $IMAGE ${{ matrix.test }} ${{ matrix.meson_flags }} --buildtype minsize
181
182  release-linux:
183    needs: cache-maker
184    runs-on: ubuntu-latest
185    strategy:
186      matrix:
187        meson_flags: [
188          "",
189
190          # Math configurations
191          "-Dnewlib-obsolete-math=false -Dwant-math-errno=true",
192          "-Dnewlib-obsolete-math=true -Dwant-math-errno=true",
193
194          # Tinystdio configurations
195          "-Dio-float-exact=false -Dio-long-long=true -Dio-percent-b=true -Dio-long-double=true",
196          "-Dformat-default=integer -Dfreestanding=true",
197
198          # Original stdio
199          "-Dtinystdio=false",
200          "-Dtinystdio=false -Dnewlib-io-float=true -Dio-long-long=true -Dio-long-double=true -Dnewlib-fvwrite-in-streamio=true",
201
202          # Locale, iconv, original malloc and original atexit/onexit configurations
203          "-Dnewlib-locale-info=true -Dnewlib-locale-info-extended=true -Dnewlib-mb=true -Dnewlib-iconv-external-ccs=true -Dnewlib-nano-malloc=false -Dpicoexit=false",
204
205          # Multithread disabled
206          "-Dnewlib-multithread=false -Dnewlib-retargetable-locking=false",
207          "-Dnewlib-multithread=false -Dnewlib-retargetable-locking=false -Dtinystdio=false",
208        ]
209        test: [
210	  "./.github/do-linux",
211	]
212    steps:
213      - name: Clone picolibc
214        uses: actions/checkout@v2
215        with:
216          path: picolibc
217
218      - name: Restore the Docker Image
219        uses: actions/cache@v2
220        with:
221          path: ${{ env.IMAGE_FILE }}
222          key: ${{ env.IMAGE_FILE }}-${{ hashFiles( env.PACKAGES_FILE, env.EXTRA_FILE ) }}
223
224      - name: Load and Check the Docker Image
225        run: |
226          docker load -i $IMAGE_FILE
227          docker images -a $IMAGE
228
229      - name: Release test
230        run: |
231          docker run -v $(readlink -f picolibc):/picolibc -w /picolibc $IMAGE ${{ matrix.test }} ${{ matrix.meson_flags }} --buildtype release
232
233