aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: f0517538e3cda277e51b668601c108cd134c6f64 (plain)
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: Build SOS

on:
  workflow_dispatch:
  push:
    tags:
      - '*'

jobs:
  build-mentos:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout the sources
        uses: actions/checkout@v4

      - name: Cache build dir
        id: mentos-cached-build
        uses: actions/cache@v4
        with:
          path: MentOS/build
          key: 4b1a6ca-mentos-cached-build

      - name: Checkout MentOS submodule
        if: steps.mentos-cached-build.outputs.cache-hit != 'true'
        run: git submodule update --init MentOS

      - name: Install dependencies
        if: steps.mentos-cached-build.outputs.cache-hit != 'true'
        run: |
          sudo apt-get update
          sudo apt-get install -y nasm fuse2fs

      - name: Build
        if: steps.mentos-cached-build.outputs.cache-hit != 'true'
        run: |
          cd MentOS
          cmake -B build -DKEYMAP_TYPE=KEYMAP_DE
          cmake --build build --parallel 2 --target exercises filesystem_permissions bootloader.bin

      - name: Upload MentOS artifact
        uses: actions/upload-artifact@v4
        with:
          name: MentOS
          path: MentOS/build


  build-qemu:
    runs-on: windows-latest
    defaults:
      run:
        shell: msys2 {0}

    steps:
      - name: Checkout the sources
        uses: actions/checkout@v4

      - name: Cache build dir
        id: qemu-cached-build
        uses: actions/cache@v4
        with:
          path: qemu/build
          key: v8.2.2-qemu-cached-build

      - name: Setup mingw build environment
        if: steps.qemu-cached-build.outputs.cache-hit != 'true'
        uses: msys2/setup-msys2@v2
        with:
          update: true
          install: >-
            base-devel
            mingw-w64-x86_64-toolchain
            git
            python
            meson
            ninja
            mingw-w64-x86_64-glib2
            mingw-w64-x86_64-pixman
            python-setuptools
            mingw-w64-x86_64-gtk3

      - name: Checkout MentOS submodule
        if: steps.qemu-cached-build.outputs.cache-hit != 'true'
        run: git submodule update --init qemu

      - name: Create needed directories
        if: steps.qemu-cached-build.outputs.cache-hit != 'true'
        run: >
          mkdir qemu/build
          mkdir qemu-install

      - name: Configure QEMU build
        if: steps.qemu-cached-build.outputs.cache-hit != 'true'
        run: >
          cd qemu/build;
          ../configure
          --prefix=$GITHUB_WORKSPACE/qemu-install
          --target-list=i386-softmmu
          --disable-werror
          --disable-stack-protector
          --disable-qom-cast-debug
          --enable-gtk
          --disable-sdl
          --disable-kvm
          --disable-dsound
          --disable-dbus-display
          --disable-guest-agent
          --disable-vnc
          --disable-tools
          --disable-bochs

      - name: Build QEMU
        run: cd qemu/build; make -j 2 all install
        if: steps.qemu-cached-build.outputs.cache-hit != 'true'

      - name: Copy required DLLs into the build directory
        if: steps.qemu-cached-build.outputs.cache-hit != 'true'
        run: >
          cp /mingw64/bin/libbz2-1.dll
          /mingw64/bin/liblzo2-2.dll
          /mingw64/bin/libcairo-2.dll
          /mingw64/bin/libcairo-gobject-2.dll
          /mingw64/bin/libwinpthread-1.dll
          /mingw64/bin/libepoxy-0.dll
          /mingw64/bin/libgdk-3-0.dll
          /mingw64/bin/libgdk_pixbuf-2.0-0.dll
          /mingw64/bin/libgio-2.0-0.dll
          /mingw64/bin/libglib-2.0-0.dll
          /mingw64/bin/libgmodule-2.0-0.dll
          /mingw64/bin/libgobject-2.0-0.dll
          /mingw64/bin/libgtk-3-0.dll
          /mingw64/bin/libiconv-2.dll
          /mingw64/bin/libintl-8.dll
          /mingw64/bin/libncursesw6.dll
          /mingw64/bin/libpixman-1-0.dll
          /mingw64/bin/libpng16-16.dll
          /mingw64/bin/zlib1.dll
          /mingw64/bin/libzstd.dll
          /mingw64/bin/libgcc_s_seh-1.dll
          /mingw64/bin/libstdc++-6.dll
          /mingw64/bin/libfontconfig-1.dll
          /mingw64/bin/libfreetype-6.dll
          /mingw64/bin/libfribidi-0.dll
          /mingw64/bin/libpango-1.0-0.dll
          /mingw64/bin/libpangocairo-1.0-0.dll
          /mingw64/bin/libpangowin32-1.0-0.dll
          /mingw64/bin/libpangoft2-1.0-0.dll
          /mingw64/bin/libffi-8.dll
          /mingw64/bin/libpcre2-8-0.dll
          /mingw64/bin/libharfbuzz-0.dll
          /mingw64/bin/libatk-1.0-0.dll
          /mingw64/bin/libexpat-1.dll
          /mingw64/bin/libbrotlidec.dll
          /mingw64/bin/libbrotlicommon.dll
          /mingw64/bin/libthai-0.dll
          /mingw64/bin/libgraphite2.dll
          /mingw64/bin/libdatrie-1.dll
          qemu-install

      - name: Upload qemu artifact
        uses: actions/upload-artifact@v4
        with:
          name: qemu
          path: |
            qemu-install
            run.bat


  build-course:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout the sources
        uses: actions/checkout@v4

      - name: Install dependencies
        run: |
          sudo apt update
          sudo apt install texlive-latex-extra texlive-lang-german

      - name: Install pandoc
        run: |
          wget https://github.com/jgm/pandoc/releases/download/3.1.11.1/pandoc-3.1.11.1-linux-amd64.tar.gz
          tar xf pandoc*.tar.gz
          sudo cp pandoc*/bin/pandoc /usr/bin

      - name: Install pandoc-plot
        run: |
          wget https://github.com/LaurentRDC/pandoc-plot/releases/download/1.7.0/pandoc-plot-Linux-x86_64-static.zip
          unzip pandoc-plot*.zip
          chmod a+rx pandoc-plot
          sudo cp pandoc-plot /usr/bin

      - name: Build course material
        run: |
          make -C course

      - name: Upload course artifact
        uses: actions/upload-artifact@v4
        with:
          name: course
          path: course/build


  publish:
    runs-on: ubuntu-latest
    needs:
      - build-mentos
      - build-qemu
      - build-course

    permissions:
      contents: write

    steps:
      - name: Download artifacts
        uses: actions/download-artifact@v4

      - name: Strip qemu-install subdirectory
        run: mv qemu/qemu-install/* qemu/

      - name: Extract run.bat from qemu artifact
        run: mv qemu/run.bat .

      - name: Zip the windows release
        run: zip -r sos-win.zip run.bat qemu MentOS course

      - name: Release artifacts
        if: startsWith(github.ref, 'refs/tags/')
        uses: softprops/action-gh-release@v1
        with:
          files: sos-win.zip