Add Windows and MacOS to the CI matrix #25
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: Neqo Build and Test | |
env: | |
RUSTFLAGS: -C link-arg=-fuse-ld=lld | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
rust-toolchain: [stable, 1.65.0] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install Packages (Linux) | |
if: runner.os == 'Linux' | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
llvm_version: 14 | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
build-essential \ | |
clang \ | |
coreutils \ | |
curl \ | |
git \ | |
gyp \ | |
libclang-dev \ | |
libssl-dev \ | |
lld \ | |
llvm-"$llvm_version" \ | |
llvm-"$llvm_version"-runtime \ | |
make \ | |
mercurial \ | |
ninja-build \ | |
pkg-config \ | |
ssh \ | |
zlib1g-dev \ | |
--no-install-recommends | |
[ -d "/usr/lib/llvm-$llvm_version/lib" ] | |
echo "LIBCLANG_DIR=/usr/lib/llvm-$llvm_version/lib" >> "$GITHUB_ENV" | |
- name: Install Packages (Windows) | |
if: runner.os == 'Windows' | |
run: | |
- name: Install Packages (MacOS) | |
if: runner.os == 'MacOS' | |
run: | |
# Rust installation cribbed from Dockerfiles at https://github.com/rust-lang/docker-rust | |
- name: Install Rust (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
export RUSTUP_HOME=~/.rustup | |
export CARGO_HOME=~/.cargo | |
rustup_dir=`mktemp -d /tmp/rustup-XXXXX` | |
mkdir -p "$rustup_dir" | |
rustup_init="$rustup_dir/rustup-init" | |
rustup_url="https://static.rust-lang.org/rustup/archive/$rustup_version/$rustup_host/rustup-init" | |
curl -SsLf "$rustup_url" -o "$rustup_init" | |
echo "${rustup_hash} $rustup_init" | sha256sum -c - | |
chmod +x "$rustup_init" | |
"$rustup_init" -y -q --no-modify-path --profile minimal \ | |
--default-toolchain ${{ matrix.rust-toolchain }} \ | |
--default-host "$rustup_host" \ | |
--component clippy --component rustfmt | |
rm -rf "$rustup_dir" | |
chmod -R a+w "$RUSTUP_HOME" "$CARGO_HOME" | |
"$CARGO_HOME/bin/rustup" default ${{ matrix.rust-toolchain }} | |
echo "RUSTUP_HOME=$RUSTUP_HOME" >> "$GITHUB_ENV" | |
echo "CARGO_HOME=$CARGO_HOME" >> "$GITHUB_ENV" | |
echo "$CARGO_HOME/bin" >> "$GITHUB_PATH" | |
env: | |
rustup_version: 1.26.0 | |
rustup_host: x86_64-unknown-linux-gnu | |
rustup_hash: 0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db | |
- name: Install Rust (Windows) | |
if: runner.os == 'Windows' | |
run: | |
- name: Install Rust (MacOS) | |
if: runner.os == 'MacOS' | |
run: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# 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 "$NSPR_DIR" | |
git clone --depth=1 https://github.com/nss-dev/nss "$NSS_DIR" | |
echo "NSS_DIR=$NSS_DIR" >> "$GITHUB_ENV" | |
echo "NSPR_DIR=$NSPR_DIR" >> "$GITHUB_ENV" | |
env: | |
NSS_DIR: ${{ github.workspace }}/nss | |
NSPR_DIR: ${{ github.workspace }}/nspr | |
- name: Build | |
run: cargo +${{ matrix.rust-toolchain }} build -v --tests | |
- name: Run Tests | |
run: cargo +${{ matrix.rust-toolchain }} test -v | |
env: | |
LD_LIBRARY_PATH: ${{ github.workspace }}/dist/Debug/lib | |
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() }} |