1
- name : Fetch and build NSS
2
- description : Fetch and build NSS
1
+ name : Install NSS
2
+ description : Install NSS
3
3
4
4
inputs :
5
5
type :
6
- description : " Whether to do a debug or release build of NSS"
6
+ description : " When building, whether to do a debug or release build of NSS"
7
7
default : " Release"
8
-
9
- # This step might be removed if the distro included a recent enough
10
- # version of NSS. Ubuntu 20.04 only has 3.49, which is far too old.
11
- # (neqo-crypto/build.rs would also need to query pkg-config to get the
12
- # right build flags rather than building NSS.)
13
- #
14
- # Also see https://github.com/mozilla/neqo/issues/1711
8
+ minimum-version :
9
+ description : " Minimum required version of NSS"
10
+ required : true
15
11
16
12
runs :
17
13
using : composite
18
14
steps :
15
+ - name : Install system NSS (Linux)
16
+ shell : bash
17
+ if : runner.os == 'Linux' && runner.environment == 'github-hosted'
18
+ env :
19
+ DEBIAN_FRONTEND : noninteractive
20
+ run : |
21
+ sudo apt-get update
22
+ sudo apt-get install -y --no-install-recommends libnss3-dev pkg-config
23
+
24
+ - name : Install system NSS (MacOS)
25
+ shell : bash
26
+ if : runner.os == 'MacOS' && runner.environment == 'github-hosted'
27
+ run : |
28
+ brew update
29
+ brew install nss
30
+
19
31
- name : Check system NSS version
20
- id : check
21
32
shell : bash
22
33
run : |
23
34
if ! command -v pkg-config &> /dev/null; then
38
49
fi
39
50
NSS_MAJOR=$(echo "$NSS_VERSION" | cut -d. -f1)
40
51
NSS_MINOR=$(echo "$NSS_VERSION" | cut -d. -f2)
41
- REQ_NSS_MAJOR=$(cut -d. -f1 < neqo-crypto/min_version.txt )
42
- REQ_NSS_MINOR=$(cut -d. -f2 < neqo-crypto/min_version.txt )
52
+ REQ_NSS_MAJOR=$(echo "${{ inputs.minimum-version}}" | cut -d. -f1)
53
+ REQ_NSS_MINOR=$(echo "${{ inputs.minimum-version}}" | cut -d. -f2)
43
54
if [[ "$NSS_MAJOR" -lt "$REQ_NSS_MAJOR" || "$NSS_MAJOR" -eq "$REQ_NSS_MAJOR" && "$NSS_MINOR" -lt "$REQ_NSS_MINOR" ]]; then
44
55
echo "System NSS is too old: $NSS_VERSION"
45
56
echo "BUILD_NSS=1" >> "$GITHUB_ENV"
70
81
id : cache-nss
71
82
uses : actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
72
83
with :
73
- path : ${{ github.workspace }}/dist
74
- key : nss-${{ runner.os }}-${{ runner.arch }}-${{ inputs.type }}-${{ hashFiles('nss/lib/nss/nss.h') }}
84
+ path : |
85
+ ${{ github.workspace }}/dist
86
+ ${{ github.workspace }}/nss/out
87
+ ${{ github.workspace }}/nspr/Debug
88
+ ${{ github.workspace }}/nspr/Release
89
+ key : nss-${{ runner.os }}-${{ runner.arch }}-${{ inputs.type }}-${{ hashFiles('nss/lib/nss/nss.h', 'nspr/pr/include/prinit.h') }}
90
+
91
+ - name : Install build dependencies (Linux)
92
+ shell : bash
93
+ if : runner.os == 'Linux' && env.BUILD_NSS == '1' && runner.environment == 'github-hosted'
94
+ env :
95
+ DEBIAN_FRONTEND : noninteractive
96
+ run : sudo apt-get install -y --no-install-recommends git mercurial gyp ninja-build
97
+
98
+ - name : Install build dependencies (MacOS)
99
+ shell : bash
100
+ if : runner.os == 'MacOS' && env.BUILD_NSS == '1'
101
+ run : |
102
+ brew install mercurial ninja
103
+ echo "gyp-next>=0.18.1" > req.txt
104
+ python3 -m pip install --user --break-system-packages -r req.txt
105
+ echo "$(python3 -m site --user-base)/bin" >> "$GITHUB_PATH"
106
+
107
+ - name : Install build dependencies (Windows)
108
+ shell : bash
109
+ if : runner.os == 'Windows' && env.BUILD_NSS == '1'
110
+ run : |
111
+ # shellcheck disable=SC2028
112
+ {
113
+ echo C:/msys64/usr/bin
114
+ echo C:/msys64/mingw64/bin
115
+ } >> "$GITHUB_PATH"
116
+ /c/msys64/usr/bin/pacman -S --noconfirm python3-pip mercurial nsinstall
117
+ echo "gyp-next>=0.18.1" > req.txt
118
+ python3 -m pip install -r req.txt
119
+
120
+ - name : Set up MSVC (Windows)
121
+ if : runner.os == 'Windows' && env.BUILD_NSS == '1'
122
+ uses : ilammy/msvc-dev-cmd@v1
123
+ # TODO: Would like to pin this, but the Mozilla org allowlist requires "ilammy/msvc-dev-cmd@v1*"
124
+ # uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
125
+
126
+ - name : Set up build environment (Windows)
127
+ shell : bash
128
+ if : runner.os == 'Windows' && env.BUILD_NSS == '1'
129
+ run : |
130
+ {
131
+ echo "GYP_MSVS_OVERRIDE_PATH=$VSINSTALLDIR"
132
+ echo "GYP_MSVS_VERSION=2022"
133
+ echo "BASH=$SHELL"
134
+ } >> "$GITHUB_ENV"
135
+ # See https://github.com/ilammy/msvc-dev-cmd#name-conflicts-with-shell-bash
136
+ rm /usr/bin/link.exe || true
75
137
76
138
- name : Build
77
139
shell : bash
@@ -82,20 +144,18 @@ runs:
82
144
# we also want debug symbols and frame pointers for that, which the normal optimized NSS
83
145
# build process doesn't provide.
84
146
OPT="-o"
85
- NSS_TARGET=Release
86
147
[ "${{ runner.os }}" != "Windows" ] && export CFLAGS="-ggdb3 -fno-omit-frame-pointer"
87
- else
88
- NSS_TARGET=Debug
89
- fi
90
- if [ "${{ steps.cache-nss.outputs.cache-hit }}" != "true" ]; then
91
- $NSS_DIR/build.sh -g -Ddisable_tests=1 $OPT --static
92
148
fi
149
+ NSS_TARGET="${{ inputs.type }}"
93
150
echo "NSS_TARGET=$NSS_TARGET" >> "$GITHUB_ENV"
94
151
NSS_OUT="$NSS_DIR/../dist/$NSS_TARGET"
95
152
echo "LD_LIBRARY_PATH=$NSS_OUT/lib" >> "$GITHUB_ENV"
96
153
echo "DYLD_FALLBACK_LIBRARY_PATH=$NSS_OUT/lib" >> "$GITHUB_ENV"
97
154
echo "$NSS_OUT/lib" >> "$GITHUB_PATH"
98
155
echo "NSS_DIR=$NSS_DIR" >> "$GITHUB_ENV"
156
+ if [ "${{ steps.cache-nss.outputs.cache-hit }}" != "true" ]; then
157
+ $NSS_DIR/build.sh -g -Ddisable_tests=1 $OPT --static
158
+ fi
99
159
env :
100
160
NSS_DIR : ${{ github.workspace }}/nss
101
161
NSPR_DIR : ${{ github.workspace }}/nspr
0 commit comments