-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #788 from oceanprotocol/feature/check_deployment
add barge deploy check
- Loading branch information
Showing
6 changed files
with
3,145 additions
and
3,018 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: 'CI' | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
check_deployment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
- name: Cache node_modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-test-unit-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: ${{ runner.os }}-test-unit-${{ env.cache-name }}- | ||
# Env var expansion workaround | ||
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable | ||
- name: Set ADDRESS_FILE | ||
run: echo "ADDRESS_FILE=${HOME}/.ocean/ocean-contracts/artifacts/address.json" >> $GITHUB_ENV | ||
- name: Build local docker file | ||
run: docker build -t 'oceanprotocol/ocean-contracts:test' . | ||
- name: Checkout Barge | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: 'oceanprotocol/barge' | ||
path: 'barge' | ||
|
||
- name: Run Ganache with Barge | ||
working-directory: ${{ github.workspace }}/barge | ||
run: | | ||
bash -x start_ocean.sh --no-aquarius --no-elasticsearch --no-provider --no-dashboard 2>&1 > start_ocean.log & | ||
env: | ||
CONTRACTS_VERSION: test | ||
- run: npm ci | ||
- name: Wait for contracts deployment | ||
working-directory: ${{ github.workspace }}/barge | ||
run: | | ||
for i in $(seq 1 250); do | ||
sleep 5 | ||
[ -f "$HOME/.ocean/ocean-contracts/artifacts/ready" ] && break | ||
done | ||
ls -la "$HOME/.ocean/ocean-contracts/artifacts/" | ||
- run: cat ${HOME}/.ocean/ocean-contracts/artifacts/address.json | ||
- run: node scripts/check_deployment.js | ||
- name: docker logs | ||
run: docker logs ocean_ocean-contracts_1 | ||
if: ${{ failure() }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,38 @@ | ||
FROM ubuntu:20.04 | ||
LABEL maintainer="Ocean Protocol <devops@oceanprotocol.com>" | ||
RUN apt-get update && \ | ||
apt-get -y install build-essential python3 git bash curl gcc g++ make | ||
|
||
FROM ubuntu:20.04 as base | ||
RUN apt-get update && apt-get -y install bash curl | ||
RUN curl -sL https://deb.nodesource.com/setup_18.x -o /tmp/nodesource_setup.sh | ||
RUN bash /tmp/nodesource_setup.sh | ||
RUN apt install nodejs | ||
|
||
|
||
|
||
FROM base as builder | ||
RUN apt-get update && apt-get -y install wget | ||
COPY . /ocean-contracts | ||
WORKDIR /ocean-contracts | ||
RUN rm package-lock.json | ||
RUN rm -rf ./node-modules/ | ||
RUN npm i | ||
ENV NODE_ENV=production | ||
RUN npm install | ||
RUN wget https://gobinaries.com/tj/node-prune --output-document - | /bin/sh && node-prune | ||
|
||
|
||
|
||
|
||
FROM base as runner | ||
ENV NODE_ENV=production | ||
RUN mkdir -p /ocean-contracts | ||
RUN mkdir -p /ocean-contracts/test/ | ||
COPY ./addresses /ocean-contracts/addresses/ | ||
COPY ./contracts /ocean-contracts/contracts/ | ||
COPY ./hardhat.config* /ocean-contracts/ | ||
COPY ./package* /ocean-contracts/ | ||
COPY ./scripts /ocean-contracts/scripts/ | ||
COPY ./test /ocean-contracts/test/ | ||
WORKDIR /ocean-contracts | ||
COPY --from=builder /ocean-contracts/node_modules/ /ocean-contracts/node_modules/ | ||
ENV SLEEP_FOR_GANACHE=10 | ||
RUN cp hardhat.config.barge.js hardhat.config.js | ||
ENV NETWORK=barge | ||
ENV NETWORK_RPC_URL=127.0.0.1:8545 | ||
RUN npx hardhat compile | ||
RUN npx hardhat compile --force | ||
ENTRYPOINT ["/ocean-contracts/scripts/deploy_docker.sh"] |
Oops, something went wrong.