diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 9d4a8a8349..aa042d68cd 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -1,27 +1,32 @@ -name: Build/Test for PR and collaborator push +name: Build/Test Cyclus on: # allows us to run workflows manually workflow_dispatch: pull_request: paths-ignore: - - '.github/workflows/build_test_publish.yml' + - '.github/workflows/publish_latest.yml' + - '.github/workflows/publish_release.yml' - '.github/workflows/changelog_test.yml' - - 'docker/**' + - '.github/workflows/code_coverage.yml' - 'doc/**' - 'CHANGELOG.rst' push: paths-ignore: - - '.github/workflows/build_test_publish.yml' + - '.github/workflows/publish_latest.yml' + - '.github/workflows/publish_release.yml' - '.github/workflows/changelog_test.yml' - - 'docker/**' + - '.github/workflows/code_coverage.yml' - 'doc/**' - 'CHANGELOG.rst' jobs: - build-and-test: + build-test-cyclus: runs-on: ubuntu-latest - + permissions: + contents: read + packages: write + pull-requests: write strategy: fail-fast: false matrix: @@ -30,77 +35,95 @@ jobs: 22.04, ] pkg_mgr : [ - apt, - conda, + 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: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - - 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: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - 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: Checkout Cyclus + uses: actions/checkout@v4 - - name: Cyclus Unit Tests - run: | - cyclus_unit_tests + - name: Build and Test Cyclus + id: build-cyclus + uses: docker/build-push-action@v5 + with: + file: docker/Dockerfile + cache-from: type=registry,ref=ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:ci-layer-cache + cache-to: type=registry,ref=ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:ci-layer-cache,mode=max + tags: ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:ci-image-cache + push: true + build-args: | + pkg_mgr=${{ matrix.pkg_mgr }} + ubuntu_version=${{ matrix.ubuntu_versions }} - - name: Cyclus Python Tests - run: | - cd tests && python -m pytest + - name: Checkout Cycamore + if: ${{ github.event_name == 'pull_request' && steps.build-cyclus.outcome == 'success' }} + uses: actions/checkout@v4 + with: + repository: cyclus/cycamore + path: ${{ github.workspace }}/cycamore - - 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 + - name: Build and Test Cycamore + id: build-cycamore + if: ${{ github.event_name == 'pull_request' && steps.build-cyclus.outcome == 'success' }} + continue-on-error: true + uses: docker/build-push-action@v5 with: - name: cyclus-coverage-report-${{ matrix.ubuntu_versions }}-${{ matrix.pkg_mgr }} - path: ${{ env.artifactPath }} + context: ${{ github.workspace }}/cycamore + file: ${{ github.workspace }}/cycamore/docker/Dockerfile + cache-from: type=registry,ref=ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache + cache-to: type=registry,ref=ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache,mode=max + tags: ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-image-cache + push: true + build-args: | + pkg_mgr=${{ matrix.pkg_mgr }} + ubuntu_version=${{ matrix.ubuntu_versions }} + cyclus_tag=ci-image-cache@${{ steps.build-cyclus.outputs.digest }} - - name: Coveralls - uses: coverallsapp/github-action@v2 + - name: Checkout Cymetric + if: ${{ github.event_name == 'pull_request' && steps.build-cycamore.outcome == 'success' }} + uses: actions/checkout@v4 with: - flag-name: ${{ join(matrix.*, '-') }} - parallel: true - file: ${HOME}/src_coverage.info - format: lcov - compare-ref: main + repository: cyclus/cymetric + path: ${{ github.workspace }}/cymetric - finish-coveralls: - needs: build-and-test - runs-on: ubuntu-latest - steps: - - name: Coveralls Finished - uses: coverallsapp/github-action@v2 - with: - parallel-finished: true + - name: Build and Test Cymetric + if: ${{ github.event_name == 'pull_request' && steps.build-cycamore.outcome == 'success' }} + id: build-cymetric + continue-on-error: true + uses: docker/build-push-action@v5 + with: + context: ${{ github.workspace }}/cymetric + file: ${{ github.workspace }}/cymetric/docker/Dockerfile + cache-from: type=registry,ref=ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache + cache-to: type=registry,ref=ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache,mode=max + tags: ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-image-cache + push: true + build-args: | + pkg_mgr=${{ matrix.pkg_mgr }} + ubuntu_version=${{ matrix.ubuntu_versions }} + cycamore_tag=ci-image-cache@${{ steps.build-cycamore.outputs.digest }} + + - name: PR Comment + if: ${{ github.event_name == 'pull_request' }} + uses: thollander/actions-comment-pull-request@v2 + with: + comment_tag: ${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }} + message: | + ## Downstream build statuses using cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }} + - Cycamore: ${{steps.build-cycamore.outcome == 'success' && '*Success* :white_check_mark:' || + steps.build-cycamore.outcome == 'failure' && '**Failure** :x:' || + '**Skipped due to upstream failure** :warning:'}} + - Cymetric: ${{steps.build-cymetric.outcome == 'success' && '*Success* :white_check_mark:' || + steps.build-cymetric.outcome == 'failure' && '**Failure** :x:' || + '**Skipped due to upstream failure** :warning:'}} \ No newline at end of file diff --git a/.github/workflows/build_test_publish.yml b/.github/workflows/build_test_publish.yml deleted file mode 100644 index 0c99d194ca..0000000000 --- a/.github/workflows/build_test_publish.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Build and Test Dependency Images - -on: - # allows us to run workflows manually - workflow_dispatch: - pull_request: - paths: - - '.github/workflows/build_test_publish.yml' - - 'docker/**' - push: - branches: - - main - -jobs: - build-dependency-and-test-img: - runs-on: ubuntu-latest - - strategy: - matrix: - ubuntu_versions : [ - 20.04, - 22.04, - ] - pkg_mgr : [ - apt, - conda, - ] - - name: Installing Dependencies, Building cyclus and running tests - steps: - - name: default environment - run: | - echo "tag-latest-on-default=false" >> "$GITHUB_ENV" - - - name: condition on trigger parameters - if: ${{ github.repository_owner == 'cyclus' && github.ref == 'refs/heads/main' }} - run: | - echo "tag-latest-on-default=true" >> "$GITHUB_ENV" - - - name: Log in to the Container registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Installing Dependencies in Docker image - uses: firehed/multistage-docker-build-action@v1 - with: - repository: ghcr.io/${{ github.repository_owner }}/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }} - stages: ${{ matrix.pkg_mgr }}-deps, cyclus - server-stage: cyclus-test - quiet: false - parallel: true - tag-latest-on-default: ${{ env.tag-latest-on-default }} - dockerfile: docker/Dockerfile - build-args: pkg_mgr=${{ matrix.pkg_mgr }}, ubuntu_version=${{ matrix.ubuntu_versions }} \ No newline at end of file diff --git a/.github/workflows/changelog_test.yml b/.github/workflows/changelog_test.yml index b8cdd106d3..07225b5ca5 100644 --- a/.github/workflows/changelog_test.yml +++ b/.github/workflows/changelog_test.yml @@ -22,7 +22,7 @@ jobs: git --version - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: | git config --global --add safe.directory ${GITHUB_WORKSPACE} diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml new file mode 100644 index 0000000000..a15d606244 --- /dev/null +++ b/.github/workflows/code_coverage.yml @@ -0,0 +1,71 @@ +name: Code Coverage + +on: + # allows us to run workflows manually + workflow_dispatch: + pull_request: + paths-ignore: + - '.github/workflows/build_test.yml' + - '.github/workflows/publish_latest.yml' + - '.github/workflows/publish_release.yml' + - '.github/workflows/changelog_test.yml' + - 'doc/**' + - 'CHANGELOG.rst' + +jobs: + build-and-test: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + strategy: + fail-fast: false + matrix: + ubuntu_versions : [ + 22.04, + ] + pkg_mgr : [ + apt, + ] + + name: Build, Test, Report Coverage + steps: + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Checkout Cyclus + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build, Test, and Report Coverage + uses: docker/build-push-action@v5 + with: + cache-from: type=registry,ref=ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus-coverage:ci-layer-cache + cache-to: type=registry,ref=ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus-coverage:ci-layer-cache,mode=max + file: docker/Dockerfile + target: coverage-report + outputs: type=local,dest=. + build-args: | + pkg_mgr=${{ matrix.pkg_mgr }} + ubuntu_version=${{ matrix.ubuntu_versions }} + + - name: Coveralls + uses: coverallsapp/github-action@v2 + with: + file: ${{ github.workspace }}/total_coverage.info + format: lcov + compare-ref: main + + - name: Upload Coverage HTML Artifact + uses: actions/upload-pages-artifact@v2 + with: + name: cyclus-coverage-report-${{ matrix.ubuntu_versions }}-${{ matrix.pkg_mgr }} + path: ${{ github.workspace }}/html + \ No newline at end of file diff --git a/.github/workflows/publish_latest.yml b/.github/workflows/publish_latest.yml new file mode 100644 index 0000000000..f0d384cb34 --- /dev/null +++ b/.github/workflows/publish_latest.yml @@ -0,0 +1,108 @@ +name: Publish Latest Cyclus + +on: + # allows us to run workflows manually + workflow_dispatch: + pull_request: + paths: + - '.github/workflows/publish_latest.yml' + push: + branches: + - main + +jobs: + build-dependency-img: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + strategy: + matrix: + ubuntu_versions : [ + 20.04, + 22.04, + ] + pkg_mgr : [ + apt, + conda, + ] + + name: Build, Test, Publish + steps: + - name: Tag as ci-image-cache + run: | + echo "tag=ci-image-cache" >> "$GITHUB_ENV" + + - name: Tag as latest + if: ${{ github.repository_owner == 'cyclus' && github.ref == 'refs/heads/main' }} + run: | + echo "tag=latest" >> "$GITHUB_ENV" + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Checkout Cyclus + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build, Test, and Push Cyclus + uses: docker/build-push-action@v5 + with: + cache-from: type=registry,ref=ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:ci-layer-cache + cache-to: type=registry,ref=ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:ci-layer-cache,mode=max + file: docker/Dockerfile + push: true + tags: ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:${{ env.tag }} + build-args: | + pkg_mgr=${{ matrix.pkg_mgr }} + ubuntu_version=${{ matrix.ubuntu_versions }} + + - name: Checkout Cycamore + uses: actions/checkout@v4 + with: + repository: cyclus/cycamore + path: ${{ github.workspace }}/cycamore + + - name: Build, Test, and Push Cycamore + id: build-cycamore + continue-on-error: true + uses: docker/build-push-action@v5 + with: + context: ${{ github.workspace }}/cycamore + file: ${{ github.workspace }}/cycamore/docker/Dockerfile + cache-from: type=registry,ref=ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache + cache-to: type=registry,ref=ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:ci-layer-cache,mode=max + tags: ghcr.io/cyclus/cycamore_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cycamore:${{ env.tag }} + push: true + build-args: | + pkg_mgr=${{ matrix.pkg_mgr }} + ubuntu_version=${{ matrix.ubuntu_versions }} + cyclus_tag=${{ env.tag }}@${{ steps.build-cyclus.outputs.digest }} + + - name: Checkout Cymetric + uses: actions/checkout@v4 + with: + repository: cyclus/cymetric + path: ${{ github.workspace }}/cymetric + + - name: Build, Test, and Push Cymetric + continue-on-error: true + uses: docker/build-push-action@v5 + with: + context: ${{ github.workspace }}/cymetric + file: ${{ github.workspace }}/cymetric/docker/Dockerfile + cache-from: type=registry,ref=ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache + cache-to: type=registry,ref=ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:ci-layer-cache,mode=max + tags: ghcr.io/cyclus/cymetric_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cymetric:${{ env.tag }} + push: true + build-args: | + pkg_mgr=${{ matrix.pkg_mgr }} + ubuntu_version=${{ matrix.ubuntu_versions }} + cycamore_tag=${{ env.tag }}@${{ steps.build-cycamore.outputs.digest }} \ No newline at end of file diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index a782b1634d..e5c9a96ae8 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -1,12 +1,18 @@ -name: Publish Cyclus Release +name: Publish Stable Cyclus on: + pull_request: + paths: + - '.github/workflows/publish_release.yml' release: - types: [published, created, edited] + types: [released] jobs: build-and-test-for-release: runs-on: ubuntu-latest + permissions: + contents: read + packages: write strategy: fail-fast: false @@ -20,35 +26,43 @@ jobs: conda ] - name: Installing Dependencies, Building cyclus and running tests + name: Build, Test, Publish steps: - - name: default environment + - name: Tag as ci-image-cache run: | - echo "tag-latest-on-default=false" >> "$GITHUB_ENV" - - - name: condition on trigger parameters - if: ${{ github.repository_owner == 'cyclus' }} + echo "version_tag=ci-image-cache" >> "$GITHUB_ENV" + echo "stable_tag=ci-image-cache" >> "$GITHUB_ENV" + + - name: Tag as stable + if: ${{ github.repository_owner == 'cyclus' && github.event_name == 'release' }} run: | - echo "tag-latest-on-default=true" >> "$GITHUB_ENV" - + echo "version_tag=${{ github.event.release.tag_name }}" >> "$GITHUB_ENV" + echo "stable_tag=stable" >> "$GITHUB_ENV" + - name: Log in to the Container registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout Cyclus + uses: actions/checkout@v4 - - name: Installing Dependencies in Docker image - uses: firehed/multistage-docker-build-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build, Test, and Push Cyclus + uses: docker/build-push-action@v5 with: - repository: ghcr.io/${{ github.repository_owner }}/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}_${{ github.ref }} - stages: ${{ matrix.pkg_mgr }}-deps, cyclus - server-stage: cyclus-test - quiet: false - parallel: true - tag-latest-on-default: ${{ env.tag-latest-on-default }} - dockerfile: docker/Dockerfile - build-args: pkg_mgr=${{ matrix.pkg_mgr }}, ubuntu_version=${{ matrix.ubuntu_versions }} + cache-from: type=registry,ref=ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:ci-layer-cache + cache-to: type=registry,ref=ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:ci-layer-cache,mode=max + file: docker/Dockerfile + push: true + tags: | + ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:${{ env.version_tag }} + ghcr.io/cyclus/cyclus_${{ matrix.ubuntu_versions }}_${{ matrix.pkg_mgr }}/cyclus:${{ env.stable_tag }} + build-args: | + pkg_mgr=${{ matrix.pkg_mgr }} + ubuntu_version=${{ matrix.ubuntu_versions }} + diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a69ff6acc9..2c60811ca2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -17,7 +17,7 @@ Since last release will fail unless update-alternatives has been used to point python at the correct python3 version (#1558) * build and test are now fown on githubAction in place or CircleCI (#1569) -* Have separate workflows for testing, publishing dependency images, and publishing release images (#1597, #1602, #1606, #1609, #1629, #1633) +* Have separate workflows for testing, publishing dependency images, and publishing release images (#1597, #1602, #1606, #1609, #1629, #1633, #1637) * Add Ubuntu 20.04 to the list of supported platforms (#1605, #1608) * Add random number generator (Mersenne Twister 19937, from boost) and the ability to set the seed in the simulation control block (#1599) * Added code coverage reporting to GitHub workflows (#1616) @@ -31,7 +31,7 @@ Since last release **Changed:** * Moved to unified CHANGELOG Entry and check them with GithubAction (#1571) -* Major update and modernization of build (#1587, #1632, #1640) +* Major update and modernization of build (#1587, #1632) * Changed Json formatting for compatibility with current python standards (#1587) * Changed README.rst installation instructions, tested on fresh Ubuntu-22.04 system with Python 3.11 (#1617, #1644) diff --git a/docker/Dockerfile b/docker/Dockerfile index 4ca08f92c4..02c61734f2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,4 @@ ARG pkg_mgr=apt -ARG make_cores=2 ARG ubuntu_version=22.04 FROM ubuntu:${ubuntu_version} as common-base @@ -112,6 +111,33 @@ ENV CC /opt/conda/bin/x86_64-conda_cos6-linux-gnu-gcc ENV CXX /opt/conda/bin/x86_64-conda_cos6-linux-gnu-g++ ENV CPP /opt/conda/bin/x86_64-conda_cos6-linux-gnu-cpp +FROM apt-deps as apt-coverage-deps +RUN apt install -y lcov curl +ENV GCOV /usr/bin/gcov + +FROM conda-deps as conda-coverage-deps +RUN mamba install -y lcov curl +ENV GCOV /opt/conda/bin/x86_64-conda-linux-gnu-gcov + +FROM ${pkg_mgr}-coverage-deps as cyclus-coverage +ARG make_cores=2 + +COPY . /cyclus +WORKDIR /cyclus + +RUN python install.py -j ${make_cores} --build-type=Release --core-version 999999.999999 --allow-milps --code_coverage +ENV PATH /root/.local/bin:$PATH +ENV LD_LIBRARY_PATH /root/.local/lib:/root/.local/lib/cyclus +RUN lcov -c --rc lcov_branch_coverage=1 -d /cyclus -o initial_coverage.info --gcov-tool ${GCOV} --initial --no-external && \ + cyclus_unit_tests && \ + cd tests && python -m pytest && cd .. && \ + lcov -c --rc lcov_branch_coverage=1 -d /cyclus -o test_coverage.info --gcov-tool ${GCOV} --no-external && \ + lcov --add-tracefile initial_coverage.info --add-tracefile test_coverage.info --rc lcov_branch_coverage=1 -o total_coverage.info && \ + mkdir -p html && genhtml total_coverage.info --output-directory html --branch-coverage + +FROM scratch as coverage-report +COPY --from=cyclus-coverage /cyclus / + FROM ${pkg_mgr}-deps as cyclus ARG make_cores=2 @@ -135,3 +161,4 @@ RUN cyclus_unit_tests FROM cyclus-test as cyclus-pytest RUN cd tests && python -m pytest +