Commit 7375a949 authored by Maurelian's avatar Maurelian Committed by GitHub

Generate codecoverage and upload to CodeCov (#3348)

* ci: Print forge version

* chore(ci): Download and verify codecov uploader

* chore(ci): Upload go coverage reports

* ci(ctb): Upload forge coverage output

* ci(ctb): Add lcov output command

* ci: Move codecov uploader install to ci-builder

* ci: Pass on codecov failure

* ci: Download codecov in ci-builder
parent b1cec1d5
---
'@eth-optimism/ci-builder': patch
---
Download and verify codecov uploader binary in the ci-builder image
......@@ -2,7 +2,6 @@ version: 2.1
orbs:
go: circleci/go@1.5.0
jobs:
yarn-monorepo:
docker:
......@@ -33,6 +32,9 @@ jobs:
- run:
name: Install dependencies
command: yarn --frozen-lockfile
- run:
name: print forge version
command: forge --version
- save_cache:
key: v2-cache-yarn-install-{{ checksum "yarn.lock" }}
paths:
......@@ -57,6 +59,7 @@ jobs:
paths:
- "."
docker-publish:
environment:
DOCKER_BUILDKIT: 1
......@@ -138,9 +141,19 @@ jobs:
yarn slither || exit 0
working_directory: packages/contracts-bedrock
- run:
name: test
command: yarn test
name: print forge version
command: forge --version
working_directory: packages/contracts-bedrock
- run:
name: test and generate coverage
command: yarn coverage:lcov
environment:
FOUNDRY_PROFILE: ci
working_directory: packages/contracts-bedrock
- run:
name: upload coverage
command: |
./codecov --verbose || exit 0
environment:
FOUNDRY_PROFILE: ci
- run:
......@@ -293,6 +306,10 @@ jobs:
command: |
gotestsum --junitfile /test-results/op-chain-ops.xml -- -coverpkg=github.com/ethereum-optimism/optimism/... -coverprofile=coverage.out -covermode=atomic ./...
working_directory: op-chain-ops
- run:
name: Upload coverage reports to CodeCov
command: |
./codecov --verbose || exit 0
- store_test_results:
path: /test-results
- run:
......
......@@ -41,7 +41,7 @@ COPY --from=geth /usr/local/bin/abigen /usr/local/bin/abigen
COPY check-changed.sh /usr/local/bin/check-changed
RUN apt-get update && \
apt-get install -y bash curl openssh-client git build-essential ca-certificates jq musl && \
apt-get install -y bash curl openssh-client git build-essential ca-certificates jq musl gnupg coreutils && \
curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh && \
curl -sL https://go.dev/dl/go1.19.linux-amd64.tar.gz -o go1.19.linux-amd64.tar.gz && \
tar -C /usr/local/ -xzvf go1.19.linux-amd64.tar.gz && \
......@@ -84,3 +84,12 @@ RUN echo "downloading solidity compilers" && \
rm solc-linux-amd64-v0.8.9+commit.e5eed63a && \
rm solc-linux-amd64-v0.8.10+commit.fc410830 && \
rm solc-linux-amd64-v0.8.12+commit.f00d7308
RUN echo "downloading and verifying Codecov uploader" && \
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step && \
curl -Os "https://uploader.codecov.io/latest/linux/codecov" && \
curl -Os "https://uploader.codecov.io/latest/linux/codecov.SHA256SUM" && \
curl -Os "https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig" && \
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM && \
shasum -a 256 -c codecov.SHA256SUM || sha256sum -c codecov.SHA256SUM && \
chmod +x codecov
......@@ -23,6 +23,7 @@
"deploy": "hardhat deploy",
"test": "yarn build:differential && forge test",
"coverage": "yarn build:differential && forge coverage",
"coverage:lcov": "yarn build:differential && forge coverage --report lcov",
"gas-snapshot": "yarn build:differential && forge snapshot",
"storage-snapshot": "./scripts/storage-snapshot.sh",
"slither": "./scripts/slither.sh",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment