Skip to content

Commit

Permalink
Merge pull request #126 from AbsaOSS/enable-codecov
Browse files Browse the repository at this point in the history
Enable codecov
  • Loading branch information
Patrik-Stas authored Oct 4, 2020
2 parents 5077af2 + dc20cfb commit dc66c75
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 82 deletions.
162 changes: 81 additions & 81 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,87 +203,87 @@ jobs:
- name: Verify libvcx image was loaded
run: |
docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_LIBVCX" || { echo "Image $DOCKER_IMG_NAME_LIBVCX was not found!" ; exit 1; }
#
# build-image-codecov:
# needs: workflow-setup
# runs-on: ubuntu-latest
# env:
# DOCKER_BUILDKIT: 1
# steps:
# - name: Load up custom variables
# run: |
# echo ::set-env name=CACHE_KEY_CODECOV::$(echo ${{needs.workflow-setup.outputs.CACHE_KEY_CODECOV}})
# echo ::set-env name=DOCKER_IMG_NAME_CODECOV::$(echo ${{needs.workflow-setup.outputs.DOCKER_IMG_NAME_CODECOV}})
# - name: Git checkout
# uses: actions/checkout@v2
# - name: Try load from cache.
# id: cache-image-codecov
# uses: actions/cache@v2
# with:
# path: /tmp/imgcache
# key: ${{ env.CACHE_KEY_CODECOV }}
# - name: If NOT found in cache, build and cache image.
# if: steps.cache-image-codecov.outputs.cache-hit != 'true'
# run: |
# set -x
# docker build -f ci/libvcx-ubuntu.dockerfile \
# -t "$DOCKER_IMG_NAME_CODECOV" \
# .
# mkdir -p /tmp/imgcache
# docker save "$DOCKER_IMG_NAME_CODECOV" > /tmp/imgcache/img_codecov.rar
#
# - name: Load codecov image from cache
# run: |
# docker load < /tmp/imgcache/img_codecov.rar
# - name: Verify codecov image was loaded
# run: |
# docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_CODECOV" || { echo "Image $DOCKER_IMG_NAME_CODECOV was not found!" ; exit 1; }
#
# code-coverage-unit-tests:
# runs-on: ubuntu-latest
# needs: [workflow-setup, build-image-codecov]
# env:
# DOCKER_BUILDKIT: 1
# steps:
# - name: Git checkout
# uses: actions/checkout@v2
# - name: Docker setup
# run: |
# echo ::set-env name=CACHE_KEY_CODECOV::$(echo ${{needs.workflow-setup.outputs.CACHE_KEY_CODECOV}})
# echo ::set-env name=DOCKER_IMG_NAME_CODECOV::$(echo ${{needs.workflow-setup.outputs.DOCKER_IMG_NAME_CODECOV}})
#
# - name: Load codecov image cache
# id: load-cached-codecov-image
# uses: actions/cache@v2
# with:
# path: /tmp/imgcache
# key: ${{ env.CACHE_KEY_CODECOV }}
# - name: If no cached image found
# if: steps.load-cached-codecov-image.outputs.cache-hit != 'true'
# run: echo "ERROR == Expected to find image from cache $CACHE_KEY_CODECOV"; exit -1
# - name: Load image from cache
# run: docker load < /tmp/imgcache/img_codecov.rar
#
# - run: mkdir -p /tmp/artifacts/coverage
#
# - name: Run quick unit tests
# uses: ./.github/actions/codecov-unit-tests
# with:
# docker-img-name: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_CODECOV }}
# cov-file-path: libvcx/coverage.lcov
#
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v1
# with:
# file: libvcx/coverage.lcov
# flags: unittests
# name: codecov-unit-tests
# fail_ci_if_error: true
# path_to_write_report: /tmp/artifacts/coverage/codecov_report.gz
# - uses: actions/upload-artifact@v2
# with:
# name: code-coverage-report-unit-tests
# path: /tmp/artifacts/coverage
build-image-codecov:
needs: workflow-setup
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
steps:
- name: Load up custom variables
run: |
echo ::set-env name=CACHE_KEY_CODECOV::$(echo ${{needs.workflow-setup.outputs.CACHE_KEY_CODECOV}})
echo ::set-env name=DOCKER_IMG_NAME_CODECOV::$(echo ${{needs.workflow-setup.outputs.DOCKER_IMG_NAME_CODECOV}})
- name: Git checkout
uses: actions/checkout@v2
- name: Try load from cache.
id: cache-image-codecov
uses: actions/cache@v2
with:
path: /tmp/imgcache
key: ${{ env.CACHE_KEY_CODECOV }}
- name: If NOT found in cache, build and cache image.
if: steps.cache-image-codecov.outputs.cache-hit != 'true'
run: |
set -x
docker build -f ci/libvcx-ubuntu.dockerfile \
-t "$DOCKER_IMG_NAME_CODECOV" \
.
mkdir -p /tmp/imgcache
docker save "$DOCKER_IMG_NAME_CODECOV" > /tmp/imgcache/img_codecov.rar
- name: Load codecov image from cache
run: |
docker load < /tmp/imgcache/img_codecov.rar
- name: Verify codecov image was loaded
run: |
docker image ls --format "{{.Repository}}:{{.Tag}}" | grep "$DOCKER_IMG_NAME_CODECOV" || { echo "Image $DOCKER_IMG_NAME_CODECOV was not found!" ; exit 1; }
code-coverage-unit-tests:
runs-on: ubuntu-latest
needs: [workflow-setup, build-image-codecov]
env:
DOCKER_BUILDKIT: 1
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Docker setup
run: |
echo ::set-env name=CACHE_KEY_CODECOV::$(echo ${{needs.workflow-setup.outputs.CACHE_KEY_CODECOV}})
echo ::set-env name=DOCKER_IMG_NAME_CODECOV::$(echo ${{needs.workflow-setup.outputs.DOCKER_IMG_NAME_CODECOV}})
- name: Load codecov image cache
id: load-cached-codecov-image
uses: actions/cache@v2
with:
path: /tmp/imgcache
key: ${{ env.CACHE_KEY_CODECOV }}
- name: If no cached image found
if: steps.load-cached-codecov-image.outputs.cache-hit != 'true'
run: echo "ERROR == Expected to find image from cache $CACHE_KEY_CODECOV"; exit -1
- name: Load image from cache
run: docker load < /tmp/imgcache/img_codecov.rar

- run: mkdir -p /tmp/artifacts/coverage

- name: Run quick unit tests
uses: ./.github/actions/codecov-unit-tests
with:
docker-img-name: ${{ needs.workflow-setup.outputs.DOCKER_IMG_NAME_CODECOV }}
cov-file-path: libvcx/coverage.lcov

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: libvcx/coverage.lcov
flags: unittests
name: codecov-unit-tests
fail_ci_if_error: true
path_to_write_report: /tmp/artifacts/coverage/codecov_report.gz
- uses: actions/upload-artifact@v2
with:
name: code-coverage-report-unit-tests
path: /tmp/artifacts/coverage

# code-coverage-integration-tests:
# runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion ci/libvcx-ubuntu.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ARG UID=1000
ARG INDYSDK_PATH=/home/indy/indy-sdk
ARG INDYSDK_REVISION=v1.15.0
ARG INDYSDK_REPO=https://github.com/hyperledger/indy-sdk
ARG RUST_VER=nightly
ARG RUST_VER=nightly-2020-08-20

# Install dependencies
RUN apt-get update && \
Expand Down

0 comments on commit dc66c75

Please sign in to comment.