Implement randomness into active and dormant buying periods in toolkit/buy policy #250
Workflow file for this run
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: Build/Test for PR and collaborator push | |
on: | |
# allows us to run workflows manually | |
workflow_dispatch: | |
pull_request: | |
paths-ignore: | |
- '.github/workflows/build_test_publish.yml' | |
- '.github/workflows/changelog_test.yml' | |
- 'docker/**' | |
- 'doc/**' | |
- 'CHANGELOG.rst' | |
push: | |
paths-ignore: | |
- '.github/workflows/build_test_publish.yml' | |
- '.github/workflows/changelog_test.yml' | |
- 'docker/**' | |
- 'doc/**' | |
- 'CHANGELOG.rst' | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ubuntu_versions : [ | |
20.04, | |
22.04, | |
] | |
pkg_mgr : [ | |
apt, | |
conda, | |
] | |
container: | |
image: ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/${{ matrix.pkg_mgr }}-deps | |
steps: | |
- name: Checkout and Build Cyclus | |
uses: actions/checkout@v3 | |
- name: Building Cyclus | |
run: | | |
mkdir -p `python -m site --user-site` | |
python install.py -j 2 --build-type=Release --core-version 999999.999999 --allow-milps --code_coverage | |
echo "PATH=${HOME}/.local/bin:$PATH" >> "$GITHUB_ENV" | |
echo "LD_LIBRARY_PATH=${HOME}/.local/lib:${HOME}/.local/lib/cyclus:$LD_LIBRARY_PATH" >> "$GITHUB_ENV" | |
- name: Install lcov for apt | |
if: matrix.pkg_mgr == 'apt' | |
run: | | |
apt update --fix-missing && apt install -y lcov curl | |
echo "GCOV=/usr/bin/gcov" >> "$GITHUB_ENV" | |
- name: Install lcov for conda | |
if: matrix.pkg_mgr == 'conda' | |
run: | | |
mamba install -c conda-forge -y lcov curl | |
echo "GCOV=/opt/conda/bin/x86_64-conda-linux-gnu-gcov" >> "$GITHUB_ENV" | |
- name: Initial Coverage Report | |
run: | | |
lcov -c --rc lcov_branch_coverage=1 --initial -d ${PWD}/build/src -o ${HOME}/initial_coverage.info --gcov-tool ${{ env.GCOV }} | |
- name: Cyclus Unit Tests | |
run: | | |
cyclus_unit_tests | |
- name: Cyclus Python Tests | |
run: | | |
cd tests && python -m pytest --ignore test_main.py | |
- name: Unit Test Coverage Report | |
run: | | |
lcov -c --rc lcov_branch_coverage=1 -d ${PWD}/build/src -o ${HOME}/test_coverage.info --gcov-tool ${{ env.GCOV }} | |
lcov --add-tracefile ${HOME}/initial_coverage.info --add-tracefile ${HOME}/test_coverage.info --rc lcov_branch_coverage=1 -o ${HOME}/total_coverage.info | |
lcov --remove ${HOME}/total_coverage.info -o ${HOME}/src_coverage.info --rc lcov_branch_coverage=1 "/usr/**" "/opt/**" | |
mkdir -p ${HOME}/cyclus_coverage/html | |
genhtml ${HOME}/src_coverage.info --output-directory ${HOME}/cyclus_coverage/html --branch-coverage | |
echo "artifactPath=${HOME}/cyclus_coverage/html/" >> $GITHUB_ENV | |
- name: Upload Coverage HTML Artifacts | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
name: cyclus-coverage-report-${{ matrix.ubuntu_versions }}-${{ matrix.pkg_mgr }} | |
path: ${{ env.artifactPath }} | |
- name: Coveralls | |
uses: coverallsapp/github-action@v2 | |
with: | |
flag-name: ${{ join(matrix.*, '-') }} | |
parallel: true | |
file: ${HOME}/src_coverage.info | |
format: lcov | |
compare-ref: main | |
finish-coveralls: | |
needs: build-and-test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Coveralls Finished | |
uses: coverallsapp/github-action@v2 | |
with: | |
parallel-finished: true |