Skip to content

Commit c8c84e0

Browse files
committed
Updated MaxMind version to 1.7.1
* Also reworked build scripts to download a released file rather than clone a repository.
1 parent c5891bf commit c8c84e0

File tree

4 files changed

+93
-74
lines changed

4 files changed

+93
-74
lines changed

.github/workflows/nuget-mmdb-1.6.0.yml renamed to .github/workflows/nuget-mmdb-1.7.1.yml

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# to restart build numbers from `1`. This is necessary because GitHub
99
# maintains build numbers per workflow file name.
1010
#
11-
name: MaxMindDB v1.6.0-1
11+
name: MaxMindDB v1.7.1-1
1212

1313
#
1414
# When `publish-package` is set to `yes`, the workflow will build
@@ -30,7 +30,7 @@ on:
3030
workflow_dispatch:
3131
inputs:
3232
publish-package:
33-
description: Publish Nuget Package?
33+
description: Publish Nuget Package (yes/no)?
3434
required: false
3535

3636
#
@@ -45,11 +45,19 @@ on:
4545
# adding or removing files, changing any text in README files, etc.
4646
#
4747
env:
48-
PKG_VER: 1.6.0
48+
PKG_VER: 1.7.1
4949
PKG_REV: 1
5050
BUILD_NUMBER: ${{ github.run_number }}
5151

52-
SRC_TAG: 1.6.0
52+
#
53+
# GitHub won't allow referencing `env` within this section, which
54+
# means that in order to reference the source directory we need
55+
# to concatenate variables in-place (e.g. `libmaxminddb-${{ env.PKG_VER }}`)
56+
# or to define them in each step where the source directory is
57+
# referenced.
58+
#
59+
MAXMIND_FNAME: libmaxminddb-%PKG_VER%
60+
MAXMIND_SHA256: e8414f0dedcecbc1f6c31cb65cd81650952ab0677a4d8c49cab603b3b8fb083e
5361

5462
# for VS Community Edition, replace `Enterprise` with `Community` in the path
5563
VCVARSALL: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall'
@@ -64,43 +72,37 @@ defaults:
6472
jobs:
6573
build-libmmdb:
6674
name: Build libmaxminddb
67-
runs-on: windows-latest
75+
runs-on: windows-2022
6876

6977
steps:
7078
- name: Checkout
71-
uses: actions/checkout@v2
79+
uses: actions/checkout@v3
7280

73-
#
74-
# This project is set up with two sub-modules, one for tests
75-
# and one for test MMDB databases. This script explicitly
76-
# excludes tests from the CMake build, so we can get just the
77-
# main project.
78-
#
79-
- name: Clone libmaxminddb
80-
run: |
81-
git clone --branch ${{ env.SRC_TAG }} https://github.com/maxmind/libmaxminddb.git libmaxminddb
82-
83-
- name: Create build directories
84-
working-directory: libmaxminddb
81+
- name: Download libmaxminddb
8582
run: |
86-
mkdir build-x64
87-
mkdir build-x86
83+
curl --location --output ${{ env.MAXMIND_FNAME }}.tar.gz https://github.com/maxmind/libmaxminddb/releases/download/${{ env.PKG_VER }}/${{ env.MAXMIND_FNAME }}.tar.gz
84+
85+
- name: Verify libmaxminddb checksum
86+
run: 7z h -scrcSHA256 ${{ env.MAXMIND_FNAME }}.tar.gz | findstr /C:"SHA256 for data" | call devops\check-sha256 "${{ env.MAXMIND_SHA256 }}"
8887

8988
- name: Build x64
90-
working-directory: libmaxminddb\build-x64
89+
working-directory: ${{ env.MAXMIND_FNAME }}
9190
run: |
9291
call ${{ env.VCVARSALL }} x64
93-
cmake -DBUILD_TESTING=OFF -A x64 ..
94-
cmake --build . --config Debug
95-
cmake --build . --config Release
92+
mkdir build\x64
93+
cmake -S . -B build\x64 -DBUILD_TESTING=OFF -A x64
94+
cmake --build build\x64 --config Debug
95+
cmake --build build\x64 --config Release
9696
97+
# VCVARSALL is invoked only for tools and CMake sets the platform
9798
- name: Build Win32
98-
working-directory: libmaxminddb\build-x86
99+
working-directory: ${{ env.MAXMIND_FNAME }}
99100
run: |
100-
call ${{ env.VCVARSALL }} x86
101-
cmake -DBUILD_TESTING=OFF -A Win32 ..
102-
cmake --build . --config Debug
103-
cmake --build . --config Release
101+
call ${{ env.VCVARSALL }} x64
102+
mkdir build\Win32
103+
cmake -S . -B build\Win32 -DBUILD_TESTING=OFF -A Win32
104+
cmake --build build\Win32 --config Debug
105+
cmake --build build\Win32 --config Release
104106
105107
#
106108
# Unfortunately, release builds are set up not to generate PDB,
@@ -109,38 +111,34 @@ jobs:
109111
- name: Collect build artifacts
110112
run: |
111113
mkdir nuget\licenses\
112-
copy /Y libmaxminddb\LICENSE. nuget\licenses\
114+
copy /Y ${{ env.MAXMIND_FNAME }}\LICENSE. nuget\licenses\
113115
114116
mkdir nuget\build\native\include\
115-
copy /Y libmaxminddb\include\*.h nuget\build\native\include\
117+
copy /Y ${{ env.MAXMIND_FNAME }}\include\*.h nuget\build\native\include\
116118
117119
mkdir nuget\build\native\lib\x64\Debug
118-
copy /Y libmaxminddb\build-x64\Debug\maxminddb.lib nuget\build\native\lib\x64\Debug\
119-
copy /Y libmaxminddb\build-x64\Debug\maxminddb.pdb nuget\build\native\lib\x64\Debug\
120+
copy /Y ${{ env.MAXMIND_FNAME }}\build-x64\Debug\maxminddb.lib nuget\build\native\lib\x64\Debug\
121+
copy /Y ${{ env.MAXMIND_FNAME }}\build-x64\Debug\maxminddb.pdb nuget\build\native\lib\x64\Debug\
120122
121123
mkdir nuget\build\native\lib\x64\Release
122-
copy /Y libmaxminddb\build-x64\Release\maxminddb.lib nuget\build\native\lib\x64\Release\
124+
copy /Y ${{ env.MAXMIND_FNAME }}\build-x64\Release\maxminddb.lib nuget\build\native\lib\x64\Release\
123125
124126
mkdir nuget\build\native\lib\Win32\Debug
125-
copy /Y libmaxminddb\build-x86\Debug\maxminddb.lib nuget\build\native\lib\Win32\Debug\
126-
copy /Y libmaxminddb\build-x86\Debug\maxminddb.pdb nuget\build\native\lib\Win32\Debug\
127+
copy /Y ${{ env.MAXMIND_FNAME }}\build-x86\Debug\maxminddb.lib nuget\build\native\lib\Win32\Debug\
128+
copy /Y ${{ env.MAXMIND_FNAME }}\build-x86\Debug\maxminddb.pdb nuget\build\native\lib\Win32\Debug\
127129
128130
mkdir nuget\build\native\lib\Win32\Release
129-
copy /Y libmaxminddb\build-x86\Release\maxminddb.lib nuget\build\native\lib\Win32\Release\
130-
131-
- name: Clean up
132-
run: |
133-
rmdir /S /Q libmaxminddb
131+
copy /Y ${{ env.MAXMIND_FNAME }}\build-x86\Release\maxminddb.lib nuget\build\native\lib\Win32\Release\
134132
135133
# this is an unconventional use of the pre-release version - see README.md
136134
- name: Make CI Nuget package
137135
if: ${{ github.event.inputs.publish-package != 'yes' }}
138136
run: |
139-
nuget pack nuget\StoneSteps.MaxMindDB.Static.nuspec -Suffix "ci.%BUILD_NUMBER%" -Version ${{ env.PKG_VER }}.${{ env.PKG_REV }}
137+
nuget pack nuget\StoneSteps.MaxMindDB.Static.nuspec -Suffix "ci.${{ env.BUILD_NUMBER }}" -Version ${{ env.PKG_VER }}.${{ env.PKG_REV }}
140138
141139
- name: Upload CI Nuget package
142140
if: ${{ github.event.inputs.publish-package != 'yes' }}
143-
uses: actions/upload-artifact@v2.2.1
141+
uses: actions/upload-artifact@v3
144142
with:
145143
name: MaxMindDB CI Nuget package
146144
path: StoneSteps.MaxMindDB.Static.${{ env.PKG_VER }}.${{ env.PKG_REV }}-ci.${{ env.BUILD_NUMBER }}.nupkg

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
/.vs/
33

44
# extracted MMDB source
5-
/libmaxminddb/
5+
/libmaxminddb-*/
6+
7+
# downloaded MMDB package file
8+
/libmaxminddb-*.tar.gz
69

710
# collected zLib build artifacts
811
/nuget/build/native/include/

devops/check-sha256.bat

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@echo off
2+
3+
setlocal
4+
5+
rem
6+
rem The only reason this batch file exists is that `set /p` won't
7+
rem work within a single batch file, so we need to call this batch
8+
rem file with the SHA-256 value in the standard input, so we can
9+
rem evaluate it and return success (0) or failure (1).
10+
rem
11+
set /p SHA256_7zip=
12+
13+
set SHA256=%SHA256_7zip:~-64%
14+
15+
if /I "%SHA256%" == "%~1" (
16+
exit 0
17+
) else (
18+
echo Bad SHA-256 signatire
19+
exit 1
20+
)

devops/make-package.bat

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ if "%~1" == "" (
77
goto :EOF
88
)
99

10-
set PKG_VER=1.6.0
10+
set PKG_VER=1.7.1
1111
set PKG_REV=%~1
1212

13-
set SRC_TAG=1.6.0
13+
set MAXMIND_FNAME=libmaxminddb-%PKG_VER%
14+
set MAXMIND_SHA256=e8414f0dedcecbc1f6c31cb65cd81650952ab0677a4d8c49cab603b3b8fb083e
1415

1516
rem
1617
rem Replace `Community` with `Enterprise` for Enterprise Edition
1718
rem
18-
set VCVARSALL=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall
19+
set VCVARSALL=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall
20+
set SEVENZIP_EXE=c:\Program Files\7-Zip\7z.exe
1921

2022
rem
2123
rem We don't need to set the environment for compiling, but rather
@@ -25,65 +27,61 @@ rem type.
2527
rem
2628
call "%VCVARSALL%" x64
2729

28-
rem
29-
rem This project is set up with two sub-modules, one for tests
30-
rem and one for test MMDB databases. This script explicitly
31-
rem excludes tests from the CMake build, so we can get just the
32-
rem main project.
33-
rem
34-
git clone --branch %SRC_TAG% https://github.com/maxmind/libmaxminddb.git libmaxminddb
30+
curl --location --output %MAXMIND_FNAME%.tar.gz https://github.com/maxmind/libmaxminddb/releases/download/%PKG_VER%/%MAXMIND_FNAME%.tar.gz
31+
32+
"%SEVENZIP_EXE%" h -scrcSHA256 %MAXMIND_FNAME%.tar.gz | findstr /C:"SHA256 for data" | call devops\check-sha256 "%MAXMIND_SHA256%"
33+
34+
tar xzf %MAXMIND_FNAME%.tar.gz
3535

36-
cd libmaxminddb
36+
cd %MAXMIND_FNAME%
3737

3838
rem
3939
rem Build debug and release configurations for x64
4040
rem
41-
mkdir build-x64 && cd build-x64
41+
mkdir build\x64
4242

4343
rem generate project files for the x64 platform
44-
cmake -DBUILD_TESTING=OFF -A x64 ..
44+
cmake -S . -B build\x64 -DBUILD_TESTING=OFF -A x64
4545

4646
rem build both configurations
47-
cmake --build . --config Debug
48-
cmake --build . --config Release
49-
50-
cd ..
47+
cmake --build build\x64 --config Debug
48+
cmake --build build\x64 --config Release
5149

5250
rem
5351
rem Build debug and release configurations for Win32
5452
rem
55-
mkdir build-x86 && cd build-x86
53+
mkdir build\Win32
5654

57-
cmake -DBUILD_TESTING=OFF -A Win32 ..
55+
cmake -S . -B build\Win32 -DBUILD_TESTING=OFF -A Win32
5856

59-
cmake --build . --config Debug
60-
cmake --build . --config Release
57+
cmake --build build\Win32 --config Debug
58+
cmake --build build\Win32 --config Release
6159

62-
cd ..\..\
60+
cd ..
6361

6462
rem
6563
rem Collect all package files in the staging area
6664
rem
6765
mkdir nuget\licenses\
68-
copy /Y libmaxminddb\LICENSE. nuget\licenses\
66+
copy /Y %MAXMIND_FNAME%\LICENSE. nuget\licenses\
6967

7068
mkdir nuget\build\native\include\
71-
copy /Y libmaxminddb\include\*.h nuget\build\native\include\
69+
copy /Y %MAXMIND_FNAME%\include\*.h nuget\build\native\include\
7270

7371
mkdir nuget\build\native\lib\x64\Debug
74-
copy /Y libmaxminddb\build-x64\Debug\maxminddb.lib nuget\build\native\lib\x64\Debug\
75-
copy /Y libmaxminddb\build-x64\Debug\maxminddb.pdb nuget\build\native\lib\x64\Debug\
72+
copy /Y %MAXMIND_FNAME%\build\x64\Debug\maxminddb.lib nuget\build\native\lib\x64\Debug\
73+
copy /Y %MAXMIND_FNAME%\build\x64\Debug\maxminddb.pdb nuget\build\native\lib\x64\Debug\
7674

7775
rem unfortunately, no PDB for the release build, which \help in debugging
7876
mkdir nuget\build\native\lib\x64\Release
79-
copy /Y libmaxminddb\build-x64\Release\maxminddb.lib nuget\build\native\lib\x64\Release\
77+
copy /Y %MAXMIND_FNAME%\build\x64\Release\maxminddb.lib nuget\build\native\lib\x64\Release\
8078

8179
mkdir nuget\build\native\lib\Win32\Debug
82-
copy /Y libmaxminddb\build-x86\Debug\maxminddb.lib nuget\build\native\lib\Win32\Debug\
83-
copy /Y libmaxminddb\build-x86\Debug\maxminddb.pdb nuget\build\native\lib\Win32\Debug\
80+
copy /Y %MAXMIND_FNAME%\build\Win32\Debug\maxminddb.lib nuget\build\native\lib\Win32\Debug\
81+
copy /Y %MAXMIND_FNAME%\build\Win32\Debug\maxminddb.pdb nuget\build\native\lib\Win32\Debug\
8482

8583
mkdir nuget\build\native\lib\Win32\Release
86-
copy /Y libmaxminddb\build-x86\Release\maxminddb.lib nuget\build\native\lib\Win32\Release\
84+
copy /Y %MAXMIND_FNAME%\build\Win32\Release\maxminddb.lib nuget\build\native\lib\Win32\Release\
8785

8886
rem
8987
rem Create a package

0 commit comments

Comments
 (0)