new #563
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
check: | |
name: Build & test | |
strategy: | |
fail-fast: false | |
matrix: | |
# os: [ubuntu-latest, macos-latest, windows-latest] | |
os: [windows-latest] | |
rust-toolchain: [1.65.0] #, stable] #, beta] | |
runs-on: ${{ matrix.os }} | |
env: | |
RUSTFLAGS: -C link-arg=-fuse-ld=lld | |
defaults: | |
run: | |
shell: bash | |
steps: | |
# - name: Install Rust | |
# uses: dtolnay/rust-toolchain@master | |
# with: | |
# toolchain: ${{ matrix.rust-toolchain }} | |
# components: rustfmt, clippy | |
- name: Install dependencies (Linux) | |
if: runner.os == 'Linux' | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo apt-get install -y --no-install-recommends gyp mercurial ninja-build | |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash | |
- name: Install dependencies (MacOS) | |
if: runner.os == 'MacOS' | |
run: | | |
brew install ninja mercurial cargo-binstall | |
# python3 -m pip install gyp-next | |
# Above does not work, since pypi only has gyp 0.15.0, which is too old | |
# for the homebrew python3. Install from source instead. | |
python3 -m pip install git+https://github.com/nodejs/gyp-next | |
python3 -m pip install packaging | |
echo "$(python3 -m site --user-base)/bin" >> "$GITHUB_PATH" | |
# - name: Install dependencies (Windows) | |
# if: runner.os == 'Windows' | |
# shell: pwsh | |
# run: Set-ExecutionPolicy Unrestricted -Scope Process; iex (iwr "https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.ps1").Content | |
- name: Set up Windows build environment | |
if: runner.os == 'Windows' | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Install moztools (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
# curl -L -o moztools.zip https://ftp.mozilla.org/pub/mozilla/libraries/win32/moztools-static.zip | |
# unzip moztools.zip | |
# mv moztools/bin/nsinstall.exe /usr/bin | |
# rm -r moztools.zip moztools | |
pacman -S --noconfirm nsinstall | |
# See https://github.com/ilammy/msvc-dev-cmd#name-conflicts-with-shell-bash | |
rm /usr/bin/link.exe | |
echo "BASH=$SHELL" >> "$GITHUB_ENV" | |
python3 -m pip install git+https://github.com/nodejs/gyp-next | |
python3 -m pip install packaging | |
echo "$(python3 -m site --user-base)/bin" >> "$GITHUB_PATH" | |
echo "GYP_MSVS_OVERRIDE_PATH=$VSINSTALLDIR" >> $GITHUB_ENV | |
echo "GYP_MSVS_VERSION=2022" >> $GITHUB_ENV | |
echo "C:\\msys64\\usr\\bin" >> $GITHUB_PATH | |
echo "C:\\msys64\\mingw64\\bin" >> $GITHUB_PATH | |
# - name: Install Rust tools | |
# run: cargo +${{ matrix.rust-toolchain }} binstall --no-confirm cargo-llvm-cov cargo-nextest | |
# - name: Checkout | |
# uses: actions/checkout@v4 | |
# This step might be removed if the distro included a recent enough | |
# version of NSS. Ubuntu 20.04 only has 3.49, which is far too old. | |
# (neqo-crypto/build.rs would also need to query pkg-config to get the | |
# right build flags rather than building NSS.) | |
- name: Fetch NSS and NSPR | |
run: | | |
hg clone https://hg.mozilla.org/projects/nspr | |
git clone --depth=1 https://github.com/nss-dev/nss | |
echo "NSS_DIR=$(cygpath $NSS_DIR)" >> "$GITHUB_ENV" | |
echo "NSPR_DIR=$(cygpath $NSPR_DIR)" >> "$GITHUB_ENV" | |
echo "NSS_JOBS=$NUMBER_OF_PROCESSORS" >> "$GITHUB_ENV" | |
echo go | |
# find "$NSPR_DIR" -name Makefile.in -exec sed -i.bak -e 's|$(NSINSTALL) -D|mkdir -p|g' -e 's|$(NSINSTALL) -t|install -p|g' {} \; | |
# hg diff "$NSPR_DIR" | |
# sed -i.bak -e 's|$(NSINSTALL) -D|mkdir -p|g' "$NSPR_DIR"/pr/include/md/Makefile.in | |
# sed -i.bak -e 's|$(NSINSTALL) -t|install|g' "$NSPR_DIR"/pr/include/md/Makefile.in | |
# cat "$NSPR_DIR"/pr/include/md/Makefile.in | |
nss/build.sh -v || true | |
echo done | |
find /d/a/neqo/neqo/dist -ls | |
exit 1 | |
env: | |
NSS_DIR: ${{ github.workspace }}/nss | |
NSPR_DIR: ${{ github.workspace }}/nspr | |
# Ideally, we could just use the build.sh script that comes with NSS. | |
# The ugiest bit is really the plumbing needed to build mozpkix. | |
- name: Rewire NSS build.sh (Windows) | |
if: 0 && runner.os == 'Windows' | |
run: | | |
echo "#!/usr/bin/env bash" > "$NSS_DIR"/build.sh | |
echo "make -C \"$NSS_DIR\" -j \"$NSS_JOBS\" nss_build_all USE_64=1 NSS_DISABLE_GTESTS=1" >> "$NSS_DIR"/build.sh | |
echo "BASH=$SHELL" >> "$GITHUB_ENV" | |
sed -i.bak 's/smime ssl/smime ssl mozpkix/' "$NSS_DIR"/lib/Makefile | |
cp "$NSS_DIR"/lib/libpkix/manifest.mn "$NSS_DIR"/lib/mozpkix/ | |
cp "$NSS_DIR"/lib/smime/Makefile "$NSS_DIR"/lib/smime/config.mk "$NSS_DIR"/lib/mozpkix/ | |
sed -i.bak 's/pkix pkix_pl_nss/lib/' "$NSS_DIR"/lib/mozpkix/manifest.mn | |
# echo "LIBRARY_NAME = mozpkix" >> "$NSS_DIR"/lib/mozpkix/manifest.mn | |
# echo "MODULE = mozpkix" >> "$NSS_DIR"/lib/mozpkix/manifest.mn | |
cp "$NSS_DIR"/lib/libpkix/include/Makefile "$NSS_DIR"/lib/mozpkix/lib/ | |
echo 'CFLAGS += -I$(SOURCE_XP_DIR)/public/nss' >> "$NSS_DIR"/lib/mozpkix/lib/Makefile | |
echo 'EXTRA_LIBS += -L $(SOURCE_LIB_DIR) -lnspr4' >> "$NSS_DIR"/lib/mozpkix/lib/Makefile | |
cp "$NSS_DIR"/lib/libpkix/manifest.mn "$NSS_DIR"/lib/mozpkix/lib | |
sed -i.bak -e 's/include pkix pkix_pl_nss//' -e 's|../..|../../..|g' "$NSS_DIR"/lib/mozpkix/lib/manifest.mn | |
echo "CPPSRCS = \\" >> "$NSS_DIR"/lib/mozpkix/lib/manifest.mn | |
ls "$NSS_DIR"/lib/mozpkix/lib/*.cpp | sed -e 's|.*/||' -e 's|$| \\|' >> "$NSS_DIR"/lib/mozpkix/lib/manifest.mn | |
echo '$(NULL)' >> "$NSS_DIR"/lib/mozpkix/lib/manifest.mn | |
echo "LIBRARY_NAME = mozpkix" >> "$NSS_DIR"/lib/mozpkix/lib/manifest.mn | |
# echo "MODULE = nss" >> "$NSS_DIR"/lib/mozpkix/lib/manifest.mn | |
cp "$NSS_DIR"/lib/libpkix/include/Makefile "$NSS_DIR"/lib/mozpkix/include/ | |
cp "$NSS_DIR"/lib/libpkix/manifest.mn "$NSS_DIR"/lib/mozpkix/include | |
sed -i.bak -e 's/include pkix pkix_pl_nss/pkix/' -e 's|../..|../../..|g' "$NSS_DIR"/lib/mozpkix/include/manifest.mn | |
# echo "MODULE = mozpkix" >> "$NSS_DIR"/lib/mozpkix/include/manifest.mn | |
cp "$NSS_DIR"/lib/libpkix/include/Makefile "$NSS_DIR"/lib/mozpkix/include/pkix/ | |
cat "$NSS_DIR"/lib/libpkix/include/manifest.mn | grep -Ev 'pkix|NULL|CSRCS|PRIVATE' > "$NSS_DIR"/lib/mozpkix/include/pkix/manifest.mn | |
sed -i.bak -e 's|../../..|../../../..|g' "$NSS_DIR"/lib/mozpkix/include/pkix/manifest.mn | |
echo "EXPORTS = \\" >> "$NSS_DIR"/lib/mozpkix/include/pkix/manifest.mn | |
cp "$NSS_DIR"/cpputil/nss_scoped_ptrs.h "$NSS_DIR"/lib/mozpkix/include/pkix/ | |
ls "$NSS_DIR"/lib/mozpkix/include/pkix/pkix*.h | sed -e 's|.*/||' -e 's|$| \\|' >> "$NSS_DIR"/lib/mozpkix/include/pkix/manifest.mn | |
echo '$(NULL)' >> "$NSS_DIR"/lib/mozpkix/include/pkix/manifest.mn | |
echo "PRIVATE_EXPORTS = \\" >> "$NSS_DIR"/lib/mozpkix/include/pkix/manifest.mn | |
ls "$NSS_DIR"/lib/mozpkix/include/pkix/[A-Z]*.h | sed -e 's|.*/||' -e 's|$| \\|' >> "$NSS_DIR"/lib/mozpkix/include/pkix/manifest.mn | |
echo 'nss_scoped_ptrs.h \' >> "$NSS_DIR"/lib/mozpkix/include/pkix/manifest.mn | |
echo '$(NULL)' >> "$NSS_DIR"/lib/mozpkix/include/pkix/manifest.mn | |
echo "MODULE = mozpkix" >> "$NSS_DIR"/lib/mozpkix/include/pkix/manifest.mn | |
cp "$NSS_DIR"/gtests/pkcs11testmodule/pkcs11testmodule.rc "$NSS_DIR"/lib/mozpkix/mozpkix.rc | |
sed -i.bak -e 's|"pkcs11testmodule"|"mozpkix"|' -e 's|NSS PKCS #11 Test Module|mozpkix|' "$NSS_DIR"/lib/mozpkix/mozpkix.rc | |
# - name: Install moztools (Windows) | |
# if: runner.os == 'Windows' | |
# run: | | |
# curl -L -o moztools.zip https://ftp.mozilla.org/pub/mozilla/libraries/win32/moztools-static.zip | |
# unzip moztools.zip | |
# mv moztools/bin/nsinstall.exe /usr/bin | |
# rm -r moztools.zip moztools | |
# # See https://github.com/ilammy/msvc-dev-cmd#name-conflicts-with-shell-bash | |
# rm /usr/bin/link.exe | |
# echo "BASH=$SHELL" >> "$GITHUB_ENV" | |
# sed -i.bak -e 's|mv -f $(DESTDIR)|echo DESTDIR $(DESTDIR) \&\& echo includedir $(includedir) \&\& find $(includedir) -ls \&\& mv -f $(DESTDIR)|' "$NSPR_DIR"/pr/include/md/Makefile.in | |
# sed -i.bak 's|$(includedir)$|$(includedir)/|' "$NSPR_DIR"/pr/include/md/Makefile.in | |
# cat "$NSPR_DIR"/pr/include/md/Makefile.in | |
# which nsinstall | |
- name: Build | |
run: | | |
cargo +${{ matrix.rust-toolchain }} build -v --all-targets || true | |
pwd | |
find dist | |
exit 1 | |
echo "LD_LIBRARY_PATH=${{ github.workspace }}/dist/Debug/lib" >> "$GITHUB_ENV" | |
echo "DYLD_LIBRARY_PATH=${{ github.workspace }}/dist/Debug/lib" >> "$GITHUB_ENV" | |
env: | |
RUST_BACKTRACE: 1 | |
- name: Run tests | |
run: cargo +${{ matrix.rust-toolchain }} nextest run -v --no-fail-fast | |
env: | |
RUST_BACKTRACE: 1 | |
RUST_LOG: neqo=debug | |
- name: Check formatting | |
run: cargo +${{ matrix.rust-toolchain }} fmt --all -- --check | |
# if: success() || failure() | |
- name: Clippy | |
run: cargo +${{ matrix.rust-toolchain }} clippy -v --tests -- -D warnings | |
# if: success() || failure() | |
- name: Determine coverage | |
run: cargo +${{ matrix.rust-toolchain }} llvm-cov nextest --all-targets --no-fail-fast --lcov --output-path lcov.info | |
env: | |
RUST_BACKTRACE: 1 | |
RUST_LOG: neqo=debug | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
file: lcov.info | |
fail_ci_if_error: true | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |