Welcome to mirror list, hosted at ThFree Co, Russian Federation.

linux.yml « workflows « .github - github.com/dosbox-staging/dosbox-staging.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d1ecf67aec97237d04b9f238b8537751d0e71090 (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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
name: Linux builds

on: [push, pull_request]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  CCACHE_DIR:      "/dev/shm/.ccache"
  CCACHE_MAXSIZE:  "64M"
  CCACHE_COMPRESS: "true"
  CLAMDB_DIR:      "/var/lib/clamav"

jobs:
  build_ubuntu:
    name: ${{ matrix.conf.name }}
    runs-on: ${{ matrix.conf.os }}
    if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
    strategy:
      matrix:
        conf:
          - name: GCC 10, Ubuntu 20.04
            os: ubuntu-20.04
            packages: g++-10
            build_flags: -Dbuildtype=debug -Dunit_tests=disabled --native-file=.github/meson/native-gcc-10.ini
            max_warnings: 0

          - name: Clang 12, Ubuntu 20.04
            os: ubuntu-20.04
            packages: clang-12
            build_flags: -Dbuildtype=debug -Dunit_tests=disabled --native-file=.github/meson/native-clang-12.ini
            max_warnings: 0

          - name: GCC, Ubuntu 18.04
            os: ubuntu-18.04
            build_flags: -Dbuildtype=debug -Dunit_tests=disabled --native-file=.github/meson/native-gcc-9.ini
            max_warnings: 0

          - name: GCC, +tests
            os: ubuntu-20.04
            build_flags: -Dbuildtype=debug
            run_tests: true
            max_warnings: -1

          - name: GCC, +debugger
            os: ubuntu-20.04
            build_flags: -Denable_debugger=normal
            max_warnings: 0

          - name: GCC, -dyn-x86
            os: ubuntu-20.04
            build_flags: -Dbuildtype=debug -Dunit_tests=disabled -Ddynamic_core=dynrec
            max_warnings: 0

          - name: GCC, -dyn-x86, +debugger
            os: ubuntu-20.04
            build_flags: -Ddynamic_core=dynrec -Dunit_tests=disabled -Denable_debugger=normal
            max_warnings: 0

          - name: GCC, -network
            os: ubuntu-20.04
            build_flags: -Dbuildtype=debug -Dunit_tests=disabled -Duse_sdl2_net=false -Duse_slirp=false
            max_warnings: 0

          - name: GCC, minimum build
            os: ubuntu-20.04
            build_flags: >-
              -Dbuildtype=debug
              -Dunit_tests=disabled
              -Duse_alsa=false
              -Duse_fluidsynth=false
              -Duse_mt32emu=false
              -Duse_opengl=false
              -Duse_png=false
              -Duse_sdl2_net=false
              -Duse_slirp=false
            min_dependencies: true
            max_warnings: 0

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
        with:
          submodules: false

      - run: |
          export DEBIAN_FRONTEND=noninteractive
          sudo apt-get update
          # use the following to force full upgrades
          # sudo apt-get -y upgrade
          # sudo apt-get -y --with-new-pkgs upgrade
          # sudo apt-get -y install -y aptitude
          # echo -e "n\ny\ny" | sudo aptitude -y -f full-upgrade
          # sudo apt-get update
          # sudo apt-get -y upgrade

      - name: Install dependencies (minimum set)
        if:   matrix.conf.min_dependencies
        run: |
          sudo apt-get install -y build-essential ccache libsdl2-dev libopusfile-dev libspeexdsp-dev python3-setuptools
          sudo pip3 install --upgrade meson ninja

      - name: Install dependencies
        if:   matrix.conf.min_dependencies != true
        run: |
          sudo apt-get install -y \
            ${{ matrix.conf.packages }} \
            $(cat packages/${{ matrix.conf.os }}-apt.txt)
          sudo pip3 install --upgrade meson ninja

      - name:  Prepare compiler cache
        id:    prep-ccache
        shell: bash
        run: |
          mkdir -p "${CCACHE_DIR}"
          echo "dir=$CCACHE_DIR"                                                 >> $GITHUB_OUTPUT
          echo "today=$(date -I)"                                                >> $GITHUB_OUTPUT
          echo "yesterday=$(date --date=yesterday -I)"                           >> $GITHUB_OUTPUT
          echo "name_hash=$(echo '${{ matrix.conf.name }}' | shasum | cut -b-8)" >> $GITHUB_OUTPUT

      - uses:  actions/cache@v3.0.11
        id:    cache-ccache
        with:
          path: ${{ steps.prep-ccache.outputs.dir }}
          key:  ccache-${{ matrix.conf.os }}-${{ steps.prep-ccache.outputs.name_hash }}-${{ steps.prep-ccache.outputs.today }}-1
          restore-keys: |
            ccache-${{ matrix.conf.os }}-${{ steps.prep-ccache.outputs.name_hash }}-${{ steps.prep-ccache.outputs.yesterday }}-1

      - name:  Cache subprojects
        uses:  actions/cache@v3.0.11
        with:
          path: subprojects/packagecache
          key:  subprojects-${{ hashFiles('subprojects/*.wrap') }}

      - name: Log environment
        run:  ./scripts/log-env.sh

      - run:  meson setup ${{ matrix.conf.build_flags }} build

      - name: Build
        run: |
          set -xo pipefail
          meson compile -C build |& tee build.log
          ccache -s

      - name: Run tests
        if:   matrix.conf.run_tests
        run:  meson test --num-processes 128 -t 0 -C build --print-errorlogs

      - name: Summarize warnings
        if:   matrix.conf.run_tests != true
        env:
          MAX_WARNINGS: ${{ matrix.conf.max_warnings }}
        run:  ./scripts/count-warnings.py -lf build.log


  build_linux_release:
    name: Release build
    runs-on: ubuntu-18.04
    if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
        with:
          submodules: false

      - run:  sudo apt-get update

      - name: Install dependencies
        run: |
          sudo apt-get install -y tree \
            $(cat packages/ubuntu-18.04-apt.txt)
          sudo pip3 install --upgrade meson ninja

      # Workaround frequent HTTPS-based connectivity issues
      # https://gitlab.freedesktop.org/freedesktop/freedesktop/-/issues/407
      - name:  Fetch the libffi subproject for Glib
        run: ./scripts/fetch-libffi-subproject.sh

      - name:  Prepare compiler cache
        id:    prep-ccache
        shell: bash
        run: |
          mkdir -p "${CCACHE_DIR}"
          echo "dir=$CCACHE_DIR"                       >> $GITHUB_OUTPUT
          echo "today=$(date -I)"                      >> $GITHUB_OUTPUT
          echo "yesterday=$(date --date=yesterday -I)" >> $GITHUB_OUTPUT

      - uses:  actions/cache@v3.0.11
        id:    cache-ccache
        with:
          path: ${{ steps.prep-ccache.outputs.dir }}
          key:  ccache-linux-release-${{ steps.prep-ccache.outputs.today }}-1
          restore-keys: |
            ccache-linux-release-${{ steps.prep-ccache.outputs.yesterday }}-1

      - name:  Cache subprojects
        uses:  actions/cache@v3.0.11
        with:
          path: subprojects/packagecache
          key:  subprojects-${{ hashFiles('subprojects/*.wrap') }}-1

      - name: Log environment
        run:  ./scripts/log-env.sh

      - name: Inject version string
        run: |
          set -x
          git fetch --prune --unshallow
          export VERSION=$(git describe --abbrev=5)
          echo "VERSION=$VERSION" >> $GITHUB_ENV

      - name: Setup release build
        run: |
          meson setup \
            -Ddefault_library=static \
            --wrap-mode=forcefallback \
            -Db_lto=true -Db_lto_threads=$(nproc) \
            --native-file=.github/meson/native-gcc-9.ini \
            build

      - name: Build
        run:  meson compile -C build

      - name: Package
        run: |
          ./scripts/create-package.sh \
            -p linux \
            build \
            "dosbox-staging-linux-$VERSION"

      - name: Create tarball
        run: tar -cJf "dosbox-staging-linux-$VERSION.tar.xz" "dosbox-staging-linux-$VERSION"

      - name:  Prepare Clam AV DB cache
        id:    prep-clamdb
        shell: bash
        run: |
          sudo mkdir -p "${CLAMDB_DIR}"
          sudo chmod 777 "${CLAMDB_DIR}"
          echo "today=$(date -I)"                      >> $GITHUB_OUTPUT
          echo "yesterday=$(date --date=yesterday -I)" >> $GITHUB_OUTPUT
      - uses:  actions/cache@v3.0.11
        id:    cache-clamdb
        with:
          path: ${{ env.CLAMDB_DIR }}/*.cvd
          key:  clamdb-linux-${{ steps.prep-clamdb.outputs.today }}-1
          restore-keys: |
            clamdb-linux-${{ steps.prep-clamdb.outputs.yesterday }}-1

      - name: Clam AV scan
        run: |
          set -x
          sudo apt-get install clamav
          sudo systemctl stop clamav-freshclam
          sudo sed -i 's/30/20000/g' /etc/clamav/freshclam.conf
          sudo freshclam --foreground
          clamscan --heuristic-scan-precedence=yes --recursive --infected .

      - name: Upload tarball
        uses: actions/upload-artifact@v3
        # GitHub automatically zips the artifacts (there's no way to create
        # a tarball), and it removes all executable flags while zipping.
        # Letting it zip a tarball preserves flags in the compressed files.
        with:
          name: dosbox-staging-linux-x86_64
          path: dosbox-staging-linux-${{ env.VERSION }}.tar.xz


  # This job exists only to publish an artifact with version info when building
  # from main branch, so snapshot build version will be visible on:
  # https://dosbox-staging.github.io/downloads/devel/
  #
  publish_additional_artifacts:
    name: Publish additional artifacts
    needs: build_linux_release
    runs-on: ubuntu-18.04
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: false

      - name: Generate changelog
        run: |
          set +x
          git fetch --unshallow
          VERSION=$(git describe --abbrev=4)
          echo "VERSION=$VERSION" >> $GITHUB_ENV
          NEWEST_TAG=$(git describe --abbrev=0)
          git log "$NEWEST_TAG..HEAD" > changelog-$VERSION.txt
      - uses: actions/upload-artifact@v3
        with:
          # Keep exactly this artifact name; it's being used to propagate
          # version info via GitHub REST API
          name: changelog-${{ env.VERSION }}.txt
          path: changelog-${{ env.VERSION }}.txt