verilator/ci/ci-ccache-size.bash
Yutetsu TAKATSUKASA 73a7595335
Add the initial version of CI using GitHub Actions (#2665)
* Add the initial version of CI using GitHub Actions

* Update .github/workflows/check_pr.yml

Co-authored-by: Wilson Snyder <wsnyder@wsnyder.org>

* remove setting for travis

* rename travis-*.bash to ci-*.bash

* Rename TRAVIS_ variables to CI_

* install ccache and libsystemc(-dev) in ci-install.bash

* Use CI_ variables and Ubuntu-20.04 that provides SystemC

* call ccache maintenance

Co-authored-by: Wilson Snyder <wsnyder@wsnyder.org>
2020-12-05 00:30:46 +09:00

38 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# DESCRIPTION: Verilator: CI ccache sizer
#
# Copyright 2020 by Geza Lore. This program is free software; you
# can redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.
#
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
################################################################################
# This script computes the size of the ccache to be used for a job. We want the
# ccache to be just big enough to be able to hold a whole build so a re-build
# of the same does not miss in the cache due to capacity, but we don't want the
# ccache too big as pulling it down from the network takes time, and it is
# unlikely objects from much earlier builds would be useful.
################################################################################
fatal() {
echo "ERROR: $(basename "$0"): $1" >&2; exit 1;
}
if [ "$CI_BUILD_STAGE_NAME" = "build" ]; then
if [ "$COVERAGE" == 1 ]; then
echo "4096M"
else
echo "4096M"
fi
elif [ "$CI_BUILD_STAGE_NAME" = "test" ]; then
if [[ $TESTS == coverage-* ]]; then
echo "4096M"
else
echo "4096M"
fi
else
fatal "Unknown build stage: '$CI_BUILD_STAGE_NAME'"
fi