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

windows.yml « workflows « .github - github.com/dosbox-staging/dosbox-staging.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a34356c0d437ce7626cd12a98b2d63b1effda676 (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
name: Windows builds

on: [push, pull_request]

jobs:
  build_windows_vs:
    name: ${{ matrix.conf.name }}
    runs-on: windows-latest
    if: github.event_name != 'pull_request' || contains('dreamer,kcgen,ant-222,Wengier', github.actor) == false
    strategy:
      matrix:
        conf:
          - name: MSVC 32-bit
            arch: x86
            max_warnings: 274
          - name: MSVC 64-bit
            arch: x64
            max_warnings: 1967
    steps:
      - name:  Backup existing vcpkg installation
        shell: pwsh
        run: |
          mv c:\vcpkg c:\vcpkg-bak
          md c:\vcpkg -ea 0

      - name: Generate vcpkg cache key
        id:    prep-vcpkg
        shell: bash
        run: |
          echo "::set-output name=year_and_week::$(date '+%Y%W')"

      - name: Cache vcpkg
        uses: actions/cache@v2
        id:   cache-vcpkg
        with:
          path: c:\vcpkg
          key: vcpkg-${{ matrix.conf.arch }}-${{ steps.prep-vcpkg.outputs.year_and_week }}-2

      - name:  Install new packages using vcpkg
        if:    steps.cache-vcpkg.outputs.cache-hit != 'true'
        shell: pwsh
        run: |
          rm -R c:\vcpkg
          mv c:\vcpkg-bak c:\vcpkg
          vcpkg install --triplet ${{ matrix.conf.arch }}-windows libpng sdl2 sdl2-net libmt32emu opusfile fluidsynth gtest
          if (-not $?) { throw "vcpkg failed to install library dependencies" }
          rm -R c:\vcpkg\buildtrees\fluidsynth\src\*.clean\sf2

      - name:  Integrate packages
        shell: pwsh
        run: |
          vcpkg integrate install
          if (-not $?) { throw "vcpkg failed to integrate packages" }

      - uses:  actions/checkout@v2
      - name:  Log environment
        shell: pwsh
        run:   .\scripts\log-env.ps1

      - name:  Run tests
        shell: pwsh
        env:
          PATH: '${env:PATH};C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\amd64'
        run: |
          cd vs
          # TODO: get unit tests working in Debug-mode; for now use release flags (better than nothing)
          MSBuild -m dosbox.sln -t:tests:Rebuild -p:Configuration=Release -p:Platform=${{ matrix.conf.arch }}

      - name:  Build
        shell: pwsh
        env:
          PATH: '${env:PATH};C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\amd64'
        run: |
          cd vs
          MSBuild -m dosbox.sln -t:dosbox:Rebuild -p:Configuration=Debug -p:Platform=${{ matrix.conf.arch }} | Tee-Object build.log

      - name:  Summarize warnings
        shell: pwsh
        env:
          MAX_WARNINGS: ${{ matrix.conf.max_warnings }}
        run: python scripts\count-warnings.py -f --msvc vs\build.log


  build_windows_vs_release:
    name: ${{ matrix.conf.name }}
    needs: build_windows_vs
    runs-on: windows-latest
    strategy:
      matrix:
        conf:
          - name: Release build (32-bit)
            arch: x86
            vs-release-dirname: Win32
          - name: Release build (64-bit)
            arch: x64
            vs-release-dirname: x64

    steps:

      - name:  Prepare vcpkg for cache restore
        shell: pwsh
        run: |
          mv c:\vcpkg c:\vcpkg-bak
          md c:\vcpkg -ea 0

      - name: Generate vcpkg cache key
        id:    prep-vcpkg
        shell: bash
        run: |
          echo "::set-output name=year_and_week::$(date '+%Y%W')"

      - name: Restore the most recent cache of vcpkg
        uses: actions/cache@v2
        with:
          path: c:\vcpkg
          key: vcpkg-${{ matrix.conf.arch }}-${{ steps.prep-vcpkg.outputs.year_and_week }}-2

      - name:  Integrate packages
        shell: pwsh
        run: |
          vcpkg integrate install
          if (-not $?) { throw "vcpkg failed to integrate packages" }

      - uses:  actions/checkout@v2
      - name:  Log environment
        shell: pwsh
        run:   .\scripts\log-env.ps1

      - name:  Adjust config.h
        shell: bash
        run: |
          set -x
          git fetch --prune --unshallow
          eval $(scripts/version.sh)
          echo "VERSION=$VERSION" >> $GITHUB_ENV
          # inject version based on vcs
          sed -i "s|DOSBOX_DETAILED_VERSION \"git\"|DOSBOX_DETAILED_VERSION \"$VERSION\"|" src/platform/visualc/config.h
          # overwrite .conf file branding for release build
          sed -i "s|CONF_SUFFIX \"-staging-git\"|CONF_SUFFIX \"-staging\"|" src/platform/visualc/config.h

      - name:  Build
        shell: pwsh
        env:
          PATH: '${env:PATH};C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\amd64'
        run: |
          cd vs
          MSBuild -m dosbox.sln -t:dosbox:Rebuild -p:Configuration=Release -p:Platform=${{ matrix.conf.arch }}

      - name:  Package
        shell: bash
        env:
          VC_REDIST_PATH: 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC'
        run: |
          set -x

          # Prepare content
          readonly RELEASE_DIR=${{ matrix.conf.vs-release-dirname }}/Release
          ls "vs/$RELEASE_DIR"
          mkdir -p dest/doc
          cp vs/$RELEASE_DIR/dosbox.exe           dest/
          cp COPYING                              dest/COPYING.txt
          cp docs/README.template                 dest/README.txt
          cp docs/README.video                    dest/doc/video.txt
          cp docs/vc_redist.txt                   dest/doc/vc_redist.txt
          cp README                               dest/doc/manual.txt
          cp vs/$RELEASE_DIR/libfluidsynth-3.dll  dest/
          cp vs/$RELEASE_DIR/glib-2.0-0.dll       dest/ # fluidsynth dependency
          cp vs/$RELEASE_DIR/intl-8.dll           dest/ # glib dependency
          cp vs/$RELEASE_DIR/pcre.dll             dest/ # glib dependency
          cp vs/$RELEASE_DIR/iconv-2.dll          dest/ # glib dependency
          cp vs/$RELEASE_DIR/mt32emu-2.dll        dest/
          cp vs/$RELEASE_DIR/ogg.dll              dest/
          cp vs/$RELEASE_DIR/opus.dll             dest/
          cp vs/$RELEASE_DIR/SDL2.dll             dest/
          cp vs/$RELEASE_DIR/SDL2_net.dll         dest/
          cp vs/$RELEASE_DIR/libpng16.dll         dest/
          cp src/libs/zmbv/$RELEASE_DIR/zlib1.dll dest/ # libpng dependency
          cp src/libs/zmbv/$RELEASE_DIR/zmbv.dll  dest/

          # Prepare translation files
          #
          # Note:
          #   We conciously drop the dialect postfix because no dialects are available.
          #   (US was the default DOS dialect and therefore is the default for 'en').
          #   There users get the generic translation and benefit from simpler filenames.
          #   Dialect translations will be added if/when they're available.
          #
          mkdir -p dest/translations
          cp contrib/translations/de/de_DE.lng       dest/translations/de.lng
          cp contrib/translations/en/en_US.lng       dest/translations/en.lng
          cp contrib/translations/es/es_ES.lng       dest/translations/es.lng
          cp contrib/translations/fr/fr_FR.lng       dest/translations/fr.lng
          cp contrib/translations/it/it_IT.lng       dest/translations/it.lng
          cp contrib/translations/pl/pl_PL.CP437.lng dest/translations/pl.cp437.lng
          cp contrib/translations/pl/pl_PL.lng       dest/translations/pl.lng
          cp contrib/translations/ru/ru_RU.lng       dest/translations/ru.lng

          # List version of available Visual C++ Redistributable files
          ls -l "$VC_REDIST_PATH"

          # Include the necessary dlls from one of available versions
          readonly VC_REDIST_VERSION="14.29.30133"
          readonly VC_REDIST_DIR="$VC_REDIST_PATH/$VC_REDIST_VERSION/${{ matrix.conf.arch }}/Microsoft.VC142.CRT"
          cp "$VC_REDIST_DIR/msvcp140.dll"       dest/
          cp "$VC_REDIST_DIR/vcruntime140.dll"   dest/
          cp "$VC_REDIST_DIR/vcruntime140_1.dll" dest/ || true # might be missing, depending on arch

          # Fill README template file
          sed -i "s|%GIT_COMMIT%|$GITHUB_SHA|"               dest/README.txt
          sed -i "s|%GIT_BRANCH%|${GITHUB_REF#refs/heads/}|" dest/README.txt
          sed -i "s|%GITHUB_REPO%|$GITHUB_REPOSITORY|"       dest/README.txt

          # Create dir for zipping
          mv dest dosbox-staging-windows-${{ matrix.conf.arch }}-${{ env.VERSION }}

      - name: Windows Defender AV Scan
        shell: powershell
        run: |
          $ErrorActionPreference = 'Stop'
          $dosboxDir = "${{ github.workspace }}\dosbox-staging-windows-${{ matrix.conf.arch }}-${{ env.VERSION }}"
          & 'C:\Program Files\Windows Defender\MpCmdRun.exe' -Scan -ScanType 3 -DisableRemediation -File $dosboxDir
          if( $LASTEXITCODE -ne 0 ) {
              Get-Content -Path $env:TEMP\MpCmdRun.log
              Throw "Exit $LASTEXITCODE : Windows Defender found an issue"
          }

      - name: Upload package
        uses: actions/upload-artifact@v2
        with:
          name: dosbox-staging-windows-${{ matrix.conf.arch }}-${{ env.VERSION }}
          path: dosbox-staging-windows-${{ matrix.conf.arch }}-${{ env.VERSION }}


  # This job exists only to publish an artifact with version info when building
  # from master 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_windows_vs_release
    runs-on: windows-latest
    if: github.event_name == 'push' && github.ref == 'refs/heads/master'
    steps:
      - uses: actions/checkout@v2
      - name: Generate changelog
        shell: bash
        run: |
          set +x
          git fetch --unshallow
          NEWEST_TAG=$(git describe --abbrev=0)
          git log "$NEWEST_TAG..HEAD" > changelog.txt
          scripts/version.sh >> $GITHUB_ENV
      - uses: actions/upload-artifact@v2
        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.txt