Skip to content

Commit

Permalink
Merge pull request #167 from covalenthq/develop
Browse files Browse the repository at this point in the history
CI Improvements and reporting
  • Loading branch information
noslav committed Oct 18, 2023
2 parents 04fa044 + 557a7ca commit 8736bdd
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 24 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/docker-ci-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ jobs:
deploy-test:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Artifact Registry/GCR
uses: docker/login-action@v2
with:
Expand All @@ -30,13 +35,22 @@ jobs:
- name: Create .env file
run: |
GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV
touch .env
echo WEB3_JWT=${{ secrets.WEB3_JWT }} >> .env
echo IPFS_PINNER_URL=${{ secrets.IPFS_PINNER_URL }} >> .env
echo ERIGON_NODE=${{ secrets.ERIGON_NODE }} >> .env
echo NODE_ETHEREUM_MAINNET=${{ secrets.NODE_ETHEREUM_MAINNET }} >> .env
echo BLOCK_RESULT_OPERATOR_PRIVATE_KEY=${{ secrets.BLOCK_RESULT_OPERATOR_PRIVATE_KEY }} >> .env
echo EVM_SERVER_URL=${{ secrets.EVM_SERVER_URL }} >> .env
echo CI=${{ secrets.CI }} >> .env
echo CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} >> .env
echo GITHUB_REF=${{ github.ref_name }} >> .env
echo CODECOV_SLUG=covalenthq/rudder >> .env
echo GITHUB_SHA=$GITHUB_SHA >> .env
echo GITHUB_HEAD_REF=$GITHUB_HEAD_REF >> .env
echo GITHUB_ENV=$GITHUB_ENV >> .env
cat .env
- name: Load .env file
Expand Down
24 changes: 12 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@ FROM elixir:1.14.3-otp-24 as deployer

RUN apt-get update && apt-get install -y git bash curl netcat-traditional && apt-get clean && rm -rf /var/lib/apt/lists/*

RUN mkdir -p /app/_build /app/config /app/deps /app/lib /app/priv node/test /app/test-data
RUN mkdir -p /mix/_build /mix/config /mix/deps /mix/lib /mix/priv node/test /mix/test-data
# used in case alpine image are used
# RUN apk update && apk add --no-cache git=2.36.3-r0 bash=5.1.16-r2 curl=7.83.1-r4 go=1.18.7-r0 make=4.3-r0 gcc=11.2.1_git20220219-r2
WORKDIR /app
RUN mix local.hex --force
RUN mix local.rebar --force

COPY --from=builder-elixir /mix/_build /app/_build
COPY --from=builder-elixir /mix/config /app/config
COPY --from=builder-elixir /mix/deps /app/deps
COPY --from=builder-elixir /mix/lib /app/lib
COPY --from=builder-elixir /mix/priv /app/priv
COPY --from=builder-elixir /mix/mix.exs /app/
COPY --from=builder-elixir /mix/mix.lock /app/
# COPY --from=builder-elixir /mix/_build/dev/rel/rudder/ /app/prod/
COPY --from=builder-elixir /mix/test/ /app/test
COPY --from=builder-elixir /mix/test-data/ /app/test-data
COPY --from=builder-elixir /mix/_build /mix/_build
COPY --from=builder-elixir /mix/config /mix/config
COPY --from=builder-elixir /mix/deps /mix/deps
COPY --from=builder-elixir /mix/lib /mix/lib
COPY --from=builder-elixir /mix/priv /mix/priv
COPY --from=builder-elixir /mix/mix.exs /mix/
COPY --from=builder-elixir /mix/mix.lock /mix/
# COPY --from=builder-elixir /mix/_build/dev/rel/rudder/ /mix/prod/
COPY --from=builder-elixir /mix/test/ /mix/test
COPY --from=builder-elixir /mix/test-data/ /mix/test-data

# Used only for testing in compose
# CMD [ "mix", "test", "./test/block_specimen_decoder_test.exs", "./test/block_result_uploader_test.exs"]

CMD ["/app/prod/bin/rudder", "start"]
CMD ["/mix/prod/bin/rudder", "start"]

EXPOSE 9568
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
<a href="https://github.com/covalenthq/rudder/actions/workflows/hadolint.ymlquery=branch%3Amain+workflow%3Ahadolint">
<img alt="Docker Lint Status" src="https://github.com/covalenthq/rudder/actions/workflows/hadolint.yml/badge.svg?branch=main" />
</a>
<a href="https://codecov.io/github/covalenthq/rudder" >
<img src="https://codecov.io/github/covalenthq/rudder/graph/badge.svg?token=u6d8eqXldF"/>
</a>
<a href="https://twitter.com/@Covalent_HQ">
<img alt="Twitter Follow Covalent" src="https://img.shields.io/twitter/follow/Covalent_HQ"/>
</a>
Expand Down
12 changes: 9 additions & 3 deletions docker-compose-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ services:
echo "hardhat-node-address:" $NODE_ETHEREUM_MAINNET;
echo "brp-op-pk:" $BLOCK_RESULT_OPERATOR_PRIVATE_KEY;
echo "evm-server-address:" $EVM_SERVER_URL;
echo "code-test-coverage:" $CODECOV_TOKEN;
echo Waiting for proof-chain to be deployed...;
while ! nc -v -l -k -p 8008;
do
Expand All @@ -97,14 +98,19 @@ services:
curl -F "filedata=@/app/test-data/codec-0.35/encoded/1-17090940-replica-0x7b8e1d463a0fbc6fce05b31c5c30e605aa13efaca14a1f3ba991d33ea979b12b" http://ipfs-pinner:3001/upload;
curl -F "filedata=@/app/test-data/codec-0.35/encoded/1-17090960-replica-0xc95d44182ee006e79f1352ef32664210f383baa016988d5ab2fd950b52bf22ff" http://ipfs-pinner:3001/upload;
echo Test bsp files uploaded!;
cd /app;
MIX_ENV=docker mix test --trace --slowest 10;
exit $?;"
cd /mix;
MIX_ENV=docker mix coveralls.json;
curl -Os https://uploader.codecov.io/latest/linux/codecov;
chmod +x codecov;
./codecov -t $CODECOV_TOKEN -C $GITHUB_SHA -r $CODECOV_SLUG -B $GITHUB_HEAD_REF;
exit 0; "
environment:
- NODE_ETHEREUM_MAINNET=${NODE_ETHEREUM_MAINNET}
- BLOCK_RESULT_OPERATOR_PRIVATE_KEY=${BLOCK_RESULT_OPERATOR_PRIVATE_KEY}
- EVM_SERVER_URL=${EVM_SERVER_URL}
- IPFS_PINNER_URL=${IPFS_PINNER_URL}
- CODECOV_TOKEN=${CODECOV_TOKEN}
- CI=${CI}
networks:
- cqt-net

Expand Down
10 changes: 5 additions & 5 deletions docker-compose-mbase.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3'
version: "3"
# runs the entire rudder pipeline with all supporting services (including rudder) in docker
# set .env such that all services in docker are talking to each other only

Expand Down Expand Up @@ -53,7 +53,7 @@ services:
echo "moonbase-node:" $NODE_ETHEREUM_MAINNET;
echo "evm-server:" $EVM_SERVER_URL;
echo "ipfs-node:" $IPFS_PINNER_URL;
cd /app;
cd /mix;
MIX_ENV=dev mix release --overwrite;
MIX_ENV=dev mix run --no-halt --eval 'Rudder.ProofChain.BlockSpecimenEventListener.start()';"
environment:
Expand All @@ -64,16 +64,16 @@ services:
networks:
- cqt-net
ports:
- "9568:9568" # prometheus metrics will be exported at http://localhost:9568/metrics etc.
- "9568:9568" # prometheus metrics will be exported at http://localhost:9568/metrics etc.

autoheal:
image: willfarrell/autoheal
container_name: autoheal
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
- "/var/run/docker.sock:/var/run/docker.sock"
environment:
- AUTOHEAL_INTERVAL=10
- CURL_TIMEOUT=30

networks:
cqt-net:
cqt-net:
6 changes: 3 additions & 3 deletions docker-compose-mbeam.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3'
version: "3"
# runs the entire rudder pipeline with all supporting services (including rudder) in docker
# set .env such that all services in docker are talking to each other only
services:
Expand Down Expand Up @@ -54,7 +54,7 @@ services:
echo "moonbeam-node:" $NODE_ETHEREUM_MAINNET;
echo "evm-server:" $EVM_SERVER_URL;
echo "ipfs-node:" $IPFS_PINNER_URL;
cd /app;
cd /mix;
MIX_ENV=prod mix release --overwrite;
MIX_ENV=prod mix run --no-halt --eval 'Rudder.ProofChain.BlockSpecimenEventListener.start()';"
environment:
Expand All @@ -71,7 +71,7 @@ services:
image: willfarrell/autoheal
container_name: autoheal
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
- "/var/run/docker.sock:/var/run/docker.sock"
environment:
- AUTOHEAL_INTERVAL=10
- CURL_TIMEOUT=30
Expand Down
10 changes: 9 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ defmodule Rudder.MixProject do
version: "0.2.15",
elixir: "~> 1.14.3",
start_permanent: Mix.env() == :prod,
deps: deps()
deps: deps(),
test_coverage: [tool: ExCoveralls, export: "cov"],
preferred_cli_env: [
coveralls: :docker,
"coveralls.detail": :docker,
"coveralls.post": :docker,
"coveralls.html": :docker
]
]
end

Expand Down Expand Up @@ -64,6 +71,7 @@ defmodule Rudder.MixProject do
# static code analysis
{:dialyxir, "~> 1.0", only: [:dev], runtime: false},
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
{:excoveralls, "~> 0.10", only: [:test, :docker], runtime: false},

# avro tools
{:avrora, "~> 0.21"},
Expand Down
1 change: 1 addition & 0 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"ex_keccak": {:hex, :ex_keccak, "0.7.3", "33298f97159f6b0acd28f6e96ce5ea975a0f4a19f85fe615b4f4579b88b24d06", [:mix], [{:rustler, ">= 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.6.1", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "4c5e6d9d5f77b64ab48769a0166a9814180d40ced68ed74ce60a5174ab55b3fc"},
"ex_rlp": {:hex, :ex_rlp, "0.6.0", "985391d2356a7cb8712a4a9a2deb93f19f2fbca0323f5c1203fcaf64d077e31e", [:mix], [], "hexpm", "7135db93b861d9e76821039b60b00a6a22d2c4e751bf8c444bffe7a042f1abaf"},
"ex_secp256k1": {:hex, :ex_secp256k1, "0.7.2", "33398c172813b90fab9ab75c12b98d16cfab472c6dcbde832b13c45ce1c01947", [:mix], [{:rustler, ">= 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.6", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "f3b1bf56e6992e28b9d86e3bf741a4aca3e641052eb47d13ae4f5f4d4944bdaf"},
"excoveralls": {:hex, :excoveralls, "0.16.1", "0bd42ed05c7d2f4d180331a20113ec537be509da31fed5c8f7047ce59ee5a7c5", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "dae763468e2008cf7075a64cb1249c97cb4bc71e236c5c2b5e5cdf1cfa2bf138"},
"expo": {:hex, :expo, "0.4.1", "1c61d18a5df197dfda38861673d392e642649a9cef7694d2f97a587b2cfb319b", [:mix], [], "hexpm", "2ff7ba7a798c8c543c12550fa0e2cbc81b95d4974c65855d8d15ba7b37a1ce47"},
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
"finch": {:hex, :finch, "0.16.0", "40733f02c89f94a112518071c0a91fe86069560f5dbdb39f9150042f44dcfb1a", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6 or ~> 1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f660174c4d519e5fec629016054d60edd822cdfe2b7270836739ac2f97735ec5"},
Expand Down

0 comments on commit 8736bdd

Please sign in to comment.