Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: enable coverage in github actions #515

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ jobs:
- name: build (LLVM ${{ matrix.llvm_version }})
# Run the build manually in `nix develop` to keep non-outputs around
run: |
nix develop .#oid-llvm${{ matrix.llvm_version }} --command cmake -B build -G Ninja -DWITH_FLAKY_TESTS=Off -DFORCE_BOOST_STATIC=Off
nix develop .#oid-llvm${{ matrix.llvm_version }} --command cmake -B build -G Ninja \
-DWITH_FLAKY_TESTS=Off \
-DFORCE_BOOST_STATIC=Off \
-DCODE_COVERAGE=On
nix develop .#oid-llvm${{ matrix.llvm_version }} --command ninja -C build
- name: test (LLVM ${{ matrix.llvm_version }})
env:
Expand All @@ -46,9 +49,29 @@ jobs:
--repeat until-pass:3 \
--exclude-from-file ../../.github/workflows/tests_failing_under_nix.txt \
--output-junit results.xml

- name: upload coverage
continue-on-error: true
uses: coverallsapp/github-action@v2
with:
flag-name: run-${{ join(matrix.*, '-') }}
parallel: true

- name: upload results
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-results-${{ matrix.llvm_version }}
path: build/test/results.xml

finalise-coverage:
needs: build-test
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: finalise coverage
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
carryforward: "run-15,run-16"

93 changes: 57 additions & 36 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
flake-utils.lib.eachSystem [ flake-utils.lib.system.x86_64-linux ] (
system:
let
defaultLlvmVersion = 16;
pkgs = import nixpkgs { inherit system; };

drgnSrc = pkgs.fetchFromGitHub {
Expand All @@ -32,14 +33,16 @@
};

mkOidPackage =
llvmPackages:
with pkgs;
llvmVersion:
let
llvmPackages = pkgs."llvmPackages_${toString llvmVersion}";
in
llvmPackages.stdenv.mkDerivation rec {
name = "oid";

src = self;

nativeBuildInputs = [
nativeBuildInputs = with pkgs; [
autoconf
automake
bison
Expand All @@ -57,36 +60,38 @@
glibcLocales
];

buildInputs = [
llvmPackages.libclang
llvmPackages.llvm
llvmPackages.openmp

boost
bzip2
curl
double-conversion
elfutils
flex
folly
folly.fmt
gflags
glog
gtest
icu
jemalloc
libarchive
libmicrohttpd
liburing
libxml2
lzma
msgpack
range-v3
rocksdb_8_11
sqlite
tomlplusplus
zstd
];
buildInputs =
(with llvmPackages; [
llvmPackages.libclang
llvmPackages.llvm
llvmPackages.openmp
])
++ (with pkgs; [
boost
bzip2
curl
double-conversion
elfutils
flex
folly
folly.fmt
gflags
glog
gtest
icu
jemalloc
libarchive
libmicrohttpd
liburing
libxml2
lzma
msgpack
range-v3
rocksdb_8_11
sqlite
tomlplusplus
zstd
]);

cmakeFlags = [
"-Ddrgn_SOURCE_DIR=${drgnSrc}"
Expand All @@ -95,13 +100,29 @@

outputs = [ "out" ];
};

mkOidDevShell =
llvmVersion:
let
llvmPackages = pkgs."llvmPackages_${toString llvmVersion}";
in
pkgs.mkShell.override { stdenv = llvmPackages.stdenv; } {
inputsFrom = [ self.packages.${system}."oid-llvm${toString llvmVersion}" ];
buildInputs = with pkgs; [ lcov ];
};
in
{
packages = rec {
default = oid-llvm16;
default = self.packages.${system}."oid-llvm${toString defaultLlvmVersion}";

oid-llvm15 = mkOidPackage 15;
oid-llvm16 = mkOidPackage 16;
};
devShells = rec {
default = self.devShells.${system}."oid-llvm${toString defaultLlvmVersion}";

oid-llvm15 = mkOidPackage pkgs.llvmPackages_15;
oid-llvm16 = mkOidPackage pkgs.llvmPackages_16;
oid-llvm15 = mkOidDevShell 15;
oid-llvm16 = mkOidDevShell 16;
};

apps.default = {
Expand Down
Loading