File: build-windows.yml

package info (click to toggle)
sqlitebrowser 3.13.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,472 kB
  • sloc: cpp: 117,707; ansic: 2,143; yacc: 798; lex: 262; sh: 126; xml: 65; python: 27; makefile: 5
file content (195 lines) | stat: -rw-r--r-- 8,963 bytes parent folder | download
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
name: Build - Windows

on:
  workflow_call:

jobs:
  build:
    name: Build
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [windows-2019]
        arch: ["Win32", "Win64"]
    env:
      GH_TOKEN: ${{ github.token }}
      OPENSSL_VERSION: 1.1.1.2100
      QT_VERSION: 5.15.2
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install OpenSSL
        run: |
          if ("${{ matrix.arch }}" -eq "Win32") {
            choco install openssl --x86 --version=${{ env.OPENSSL_VERSION}}
          } else {
            choco install openssl --version=${{ env.OPENSSL_VERSION}}
          }

      # When building SQLCipher, if we specify a path to OpenSSL and
      # there are spaces in the path, an error will occur, so to
      # avoid this, create the symlink.
      - name: Create OpenSSL symlink
        run: |
          mkdir C:\dev
          if ("${{ matrix.arch }}" -eq "Win32") {
            New-Item -Path "C:\dev\OpenSSL-${{ matrix.arch }}" -ItemType SymbolicLink -Value "C:\Program Files (x86)\OpenSSL-Win32\"
          } else {
            New-Item -Path "C:\dev\OpenSSL-${{ matrix.arch }}" -ItemType SymbolicLink -Value "C:\Program Files\OpenSSL"
          }

      - name: Install Qt
        uses: jurplel/install-qt-action@v3
        with:
          arch: ${{ matrix.arch == 'Win32' && 'win32_msvc2019' || matrix.arch == 'Win64' && 'win64_msvc2019_64'}}
          cache: true
          cache-key-prefix: "cache"
          version: ${{ env.QT_VERSION }}

      - name: Download 'nalgeon/sqlean'
        run: |
          if ("${{ matrix.arch }}" -eq "Win32") {
            gh release download --pattern "sqlean-win-x86.zip" --repo "nalgeon/sqlean"
            Expand-Archive -Path sqlean-win-x86.zip -DestinationPath .\sqlean
          } else {
            gh release download --pattern "sqlean-win-x64.zip" --repo "nalgeon/sqlean"
            Expand-Archive -Path sqlean-win-x64.zip -DestinationPath .\sqlean
          }

      - name: Setup MSVC
        uses: ilammy/msvc-dev-cmd@v1
        with:
          arch: ${{ matrix.arch == 'Win32' && 'amd64_x86' || matrix.arch == 'Win64' && 'amd64'}}

      - name: Install SQLite
        run: |
          $htmlContent = Invoke-WebRequest -Uri "https://sqlite.org/download.html" | Select-Object -ExpandProperty Content
          $regex = [regex]::new('PRODUCT,(\d+\.\d+\.\d+),(\d+/sqlite-amalgamation-\d+\.zip),\d+,(.+)')
          $match = $regex.Match($htmlContent)
          $relativeUrl = $match.Groups[2].Value
          $downloadLink = "https://sqlite.org/$relativeUrl"
          Invoke-WebRequest -Uri $downloadLink -OutFile 'sqlite.zip'
          Expand-Archive -Path sqlite.zip -DestinationPath C:\dev\
          Move-Item -Path C:\dev\sqlite-amalgamation-* C:\dev\SQLite-${{ matrix.arch }}
          cd C:\dev\SQLite-${{ matrix.arch }}
          cl sqlite3.c -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_STAT4 -DSQLITE_SOUNDEX -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_MAX_ATTACHED=125 -DSQLITE_API="__declspec(dllexport)" -link -dll -out:sqlite3.dll

      - name: Install SQLite Extensions
        run: |
          cp .\src\extensions\extension-formats.c C:\dev\SQLite-${{ matrix.arch}}\
          cp .\src\extensions\extension-formats.def C:\dev\SQLite-${{ matrix.arch}}\
          cp .\src\extensions\extension-functions.c C:\dev\SQLite-${{ matrix.arch}}\
          cp .\src\extensions\extension-functions.def C:\dev\SQLite-${{ matrix.arch}}\
          cd C:\dev\SQLite-${{ matrix.arch}}\
          cl /MD extension-formats.c -link -dll -def:extension-formats.def -out:formats.dll
          cl /MD extension-functions.c -link -dll -def:extension-functions.def -out:math.dll

      - name: Install SQLCipher
        run: |
          cd C:\dev
          git clone https://github.com/sqlcipher/sqlcipher
          mv sqlcipher SQLCipher-${{ matrix.arch }}
          cd SQLCipher-${{ matrix.arch }}
          git switch $(git describe --tags --abbrev=0)
          nmake /f Makefile.msc sqlcipher.dll USE_AMALGAMATION=1 NO_TCL=1 SQLITE3DLL=sqlcipher.dll SQLITE3LIB=sqlcipher.lib SQLITE3EXE=sqlcipher.exe LTLINKOPTS="C:\dev\OpenSSL-${{ matrix.arch }}\lib\libcrypto.lib" OPT_FEATURE_FLAGS="-DSQLITE_TEMP_STORE=2 -DSQLITE_HAS_CODEC=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_STAT4=1 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_RTREE=1 -DSQLCIPHER_CRYPTO_OPENSSL=1 -DSQLITE_MAX_ATTACHED=125 -IC:\dev\OpenSSL-${{ matrix.arch }}\include"
          mkdir sqlcipher
          copy sqlite3.h sqlcipher

      - name: Patch CMakeLists.txt and WiX Toolset Variables
        run: |
          git apply .github\patch\CMakeLists.txt.patch
          git apply .github\patch\product.wxs.patch
          git apply .github\patch\translations.wxs.patch
          git apply .github\patch\variables.wxi.patch

      - name: Configure build (SQLite)
        run: |
          mkdir release-sqlite && cd release-sqlite
          if ("${{ matrix.arch }}" -eq "Win32") {
            cmake -G "Visual Studio 16 2019" -A "Win32" -DCMAKE_BUILD_TYPE=Release ..\
          } else {
            cmake -G "Visual Studio 16 2019" ..\
          }

      - name: Build (SQLite)
        run: cd release-sqlite && devenv /Build Release sqlitebrowser.sln /Project ALL_BUILD

      - name: Configure build (SQLCipher)
        run: |
          mkdir release-sqlcipher && cd release-sqlcipher
          if ("${{ matrix.arch }}" -eq "Win32") {
            cmake -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Release -Dsqlcipher=1 -A "Win32" ..\
          } else {
            cmake -G "Visual Studio 16 2019" -DCMAKE_BUILD_TYPE=Release -Dsqlcipher=1 ..\
          }

      - name: Build (SQLCipher)
        run: |
          cd release-sqlcipher
          devenv /Build Release sqlitebrowser.sln /Project ALL_BUILD
          mv "Release\DB Browser for SQLite.exe" "Release\DB Browser for SQLCipher.exe"

      - if: github.event_name != 'pull_request'
        name: Create MSI
        env:
          ExePath: ${{ github.workspace }}
          OpenSSLPath: C:\dev\OpenSSL-${{ matrix.arch }}
          SQLCipherPath: C:\dev\SQLCipher-${{ matrix.arch }}
          SqleanPath: ${{ github.workspace }}\sqlean
          SQLitePath: C:\dev\SQLite-${{ matrix.arch }}
        run: |
          cd installer/windows
          ./build.cmd "${{ matrix.arch }}".ToLower()
          $ARCH="${{ matrix.arch }}".ToLower()
          mv DB.Browser.for.SQLite-*.msi "DB.Browser.for.SQLite-v3.13.1-$ARCH.msi"

      - if: github.event_name != 'pull_request'
        name: Upload artifacts for code signing with SignPath
        id: unsigned-artifacts
        uses: actions/upload-artifact@v4
        with:
          name: build-artifacts-${{ matrix.os}}-${{ matrix.arch }}-unsigned
          path: installer\windows\DB.Browser.for.SQLite-*.msi

      # Change the signing-policy-slug when you release an RC, RTM or stable release.
      - if: github.event_name != 'pull_request'
        name: Code signing with SignPath
        uses: signpath/github-action-submit-signing-request@v1
        with:
          api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
          github-artifact-id: '${{ steps.unsigned-artifacts.outputs.artifact-id }}'
          organization-id: '${{ secrets.SIGNPATH_ORGANIZATION_ID }}'
          output-artifact-directory: .\installer\windows
          project-slug: 'sqlitebrowser'
          signing-policy-slug: 'release-signing'
          wait-for-completion: true

      - if: github.event_name != 'pull_request'
        name: Create ZIP
        run: |
          $ARCH="${{ matrix.arch }}".ToLower()
          $FILENAME_FORMAT="DB.Browser.for.SQLite-v3.13.1-$ARCH.zip"
          Start-Process msiexec.exe -ArgumentList "/a $(dir installer\windows\DB.Browser.for.SQLite-*.msi) /q TARGETDIR=$PWD\target\" -Wait
          if ("${{ matrix.arch }}" -eq "Win32") {
            move target\System\* "target\DB Browser for SQLite\"
          } else {
            move target\System64\* "target\DB Browser for SQLite\"
          }
          Compress-Archive -Path "target\DB Browser for SQLite\*" -DestinationPath $FILENAME_FORMAT

      - if: github.event_name != 'pull_request'
        name: Prepare artifacts
        run: |
          mkdir build-artifacts
          move installer\windows\DB.Browser.for.SQLite-*.msi build-artifacts\
          move DB.Browser.for.SQLite-*.zip build-artifacts\
          Compress-Archive -Path build-artifacts\* -DestinationPath build-artifacts-${{ matrix.arch }}.zip

      - if: github.event_name != 'pull_request'
        name: Upload artifacts
        uses: actions/upload-artifact@v4
        with:
          name: build-artifacts-${{ matrix.os }}-${{ matrix.arch }}
          path: build-artifacts-${{ matrix.arch }}.zip