From bcfd45dff1dab1499944194ad0e7ec00a74ff8b0 Mon Sep 17 00:00:00 2001 From: Mikkel Kjeldsen Date: Tue, 14 Apr 2020 12:25:45 +0200 Subject: [PATCH] Integrate GitHub Actions Define a GitHub Actions CI pipeline that builds for Linux on MSRV, stable, and next, and makes a half-arsed attempt at verifying MSRV on Windows. Because several dependencies rely on wildcards the de facto MSRVs are a fair bit higher than advertised: - getopts unceremoniously abandoned MSRV pretence in 0.2.20 and raised MSRV from 1.18 to 1.27, then again to 1.31 in 0.2.21. - libloading 0.6.0 for "unix" uses MaybeUninit, which requires 1.36. - libloading 0.6.0 for "windows" uses pointer::cast(), which requires 1.38, and the non_exhaustive feature, which requires 1.40. Of course, the original MSRVs can be restored by fixing dependencies. I've retained the Linux/Windows MSRV split out of precedence. It makes some sense given the build dependency difference, though I'd argue for simplifying communication by maintaining only one MSRV. --- .github/workflows/ci.yml | 68 ++++++++++++++++++++++++++++++++++++++ ci/ubuntu-install-packages | 5 +++ 2 files changed, 73 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100755 ci/ubuntu-install-packages diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4df0fe7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,68 @@ +name: ci + +on: + pull_request: + push: + branches: + - master + +jobs: + test: + name: test + runs-on: ${{ matrix.os }} + strategy: + matrix: + build: + # MSRV, stable, and next. + - pinned-linux + - stable + - beta + # Best-effort Windows. + - pinned-windows + include: + - build: pinned-linux + os: ubuntu-18.04 + rust: 1.36.0 + + - build: stable + os: ubuntu-18.04 + rust: stable + + - build: beta + os: ubuntu-18.04 + rust: beta + + - build: pinned-windows + os: windows-2019 + rust: 1.40.0 + env: + # libXNVCtrl.a in Ubuntu + LIBRARY_PATH: /usr/lib/x86_64-linux-gnu + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install packages (Ubuntu) + if: matrix.os == 'ubuntu-18.04' + run: | + ci/ubuntu-install-packages + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + profile: minimal + override: true + + # Can't (easily) install NVAPI for Windows. :( + - name: Check-only (Windows) + if: matrix.os == 'windows-2019' + run: cargo check --verbose + + - name: Build + if: matrix.os != 'windows-2019' + run: cargo build --verbose + + - name: Test + if: matrix.os != 'windows-2019' + run: cargo test --verbose diff --git a/ci/ubuntu-install-packages b/ci/ubuntu-install-packages new file mode 100755 index 0000000..523dbb5 --- /dev/null +++ b/ci/ubuntu-install-packages @@ -0,0 +1,5 @@ +#!/bin/sh + +sudo apt-get update +sudo apt-get install --yes --no-install-recommends \ + libxnvctrl-dev