-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaction.yml
63 lines (59 loc) · 2.57 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
# at the Lawrence Livermore National Laboratory. All Rights reserved. See files
# LICENSE and NOTICE for details. LLNL-CODE-806117.
#
# This file is part of the MFEM library. For more information and source code
# availability visit https://mfem.org.
#
# MFEM is free software; you can redistribute it and/or modify it under the
# terms of the BSD-3 license. We welcome feedback and contributions, see file
# CONTRIBUTING.md for details.
name: Upload Coverage
description: Upload coverage to codecov, requires lcov.
inputs:
name:
description: "Job name"
required: true
project_dir:
description: "Path to the project directory"
required: true
directories:
descripton: "List of directories to look for coverage info"
required: false
runs:
using: "composite"
steps:
- run: |
cd ${{ inputs.project_dir }}
# Restrict search to directories listed, if any.
directory_list="${{ inputs.directories }}"
dirs_opts=""
if [[ -n "${directory_list}" ]]; then
for dir in ${directory_list}; do dirs_opts+=" --directory=${dir}"; done
fi
keep_going_flag=""
if [[ "$(lcov --version)" =~ "lcov: LCOV version 2" ]]; then
keep_going_flag="--keep-going"
fi
# Generate the coverage report.
lcov ${keep_going_flag} --no-external --gcov-tool gcov ${dirs_opts} --capture --output-file lcov.info
# The variable $RUNNER_OS should be either "Linux" or "macOS"
os_lowercase=$(echo $RUNNER_OS | awk '{print tolower($0)}')
# The prefix will end with "linux" or "macos" depending on the runner OS
prefix="https://uploader.codecov.io/latest/$os_lowercase"
curl -Os "$prefix/codecov"
# Workaround for GPG issue: need to create the GNUPGHOME (with proper
# permissions) otherwise the trustedkeys file is not created.
export GNUPGHOME="$HOME/gnupg"
mkdir "$GNUPGHOME"
chmod 700 "$GNUPGHOME"
# Check integrity of the binary uploader (cf. https://docs.codecov.com/docs/codecov-uploader#integrity-checking-the-uploader)
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.kbx --import # One-time step
curl -Os "$prefix/codecov.SHA256SUM"
curl -Os "$prefix/codecov.SHA256SUM.sig"
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
shasum -a 256 -c codecov.SHA256SUM
# Run the uploader
chmod +x codecov
./codecov -n "${{ inputs.name }}"
shell: bash