Skip to content

Commit

Permalink
Migrate CI pipeline to GitHub actions (#622)
Browse files Browse the repository at this point in the history
* Add default pipeline
* Refactor test-pipeline
* Prevent tests from running twice
* CI: increase timeout
* CI: explicitly use local ganache
* Danger deploy cmd: fixes

Co-authored-by: Septen <[email protected]>
  • Loading branch information
strokovok and sept-en authored Dec 18, 2021
1 parent b0d31dd commit 1a473b7
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 2 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/contracts-eth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
on:
push:
branches:
- master
pull_request:
branches:
- "*"
name: Contracts (ETH)
jobs:
test:
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
include:
- job-name: nearbridge test
cmd: |
cd contracts/eth/nearbridge
yarn
yarn test
timeout-minutes: 40

- job-name: nearprover test
cmd: |
cd contracts/eth/nearprover
yarn
yarn test
timeout-minutes: 40

- job-name: verify near headers
cmd: |
yarn
cd contracts/eth/
ci/test_verify_near_headers.sh
timeout-minutes: 40

- job-name: verify near proofs
cmd: |
yarn
cd contracts/eth/
ci/test_verify_near_proofs.sh
timeout-minutes: 40

name: ${{ matrix.job-name }}
steps:
- name: Clone the repository
uses: actions/checkout@v2

- name: Execute
run: ${{ matrix.cmd }}
timeout-minutes: ${{ matrix.timeout-minutes }}
38 changes: 38 additions & 0 deletions .github/workflows/contracts-near.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
on:
push:
branches:
- master
pull_request:
branches:
- "*"
name: Contracts (NEAR)
jobs:
test:
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
include:
- job-name: build all rust contracts
cmd: |
cd contracts/near/eth-client
./build.sh
cd ../eth-prover
./build.sh
git status
changed_files=$(git status --porcelain --untracked-files=no | wc -l)
if [ $changed_files -gt 0 ]; then
echo 'contract changed, please rebuild contract'
exit 1
fi
timeout-minutes: 40

name: ${{ matrix.job-name }}
steps:
- name: Clone the repository
uses: actions/checkout@v2

- name: Execute
run: ${{ matrix.cmd }}
timeout-minutes: ${{ matrix.timeout-minutes }}
70 changes: 70 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
on:
push:
branches:
- master
pull_request:
branches:
- "*"
name: Tests
jobs:
test:
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
include:
- job-name: Linter
cmd: |
yarn
yarn standard
yarn prettier-solidity
timeout-minutes: 5

- job-name: E2E
cmd: ./testing/ci/e2e.sh
timeout-minutes: 60

- job-name: E2E myerc20
cmd: ./testing/ci/e2e_deploy_contract.sh
timeout-minutes: 60

- job-name: Challenge with watchdog
cmd: ./testing/ci/test_challenge.sh
timeout-minutes: 60

- job-name: Test eth-relay catchup
cmd: ./testing/ci/test_ethrelay_catchup.sh
timeout-minutes: 60

name: ${{ matrix.job-name }}
steps:
- name: Clone the repository
uses: actions/checkout@v2

- name: Install nearup
run: |
pip3 install nearup --upgrade --user
echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH

- name: Execute
run: ${{ matrix.cmd }}
timeout-minutes: ${{ matrix.timeout-minutes }}

- name: Collect logs
if: ${{ always() }}
run: |
mkdir logs_artifact
if [[ -d ~/.rainbow/logs ]]; then
cp -r ~/.rainbow/logs logs_artifact/rainbow-logs
fi
if [[ -f ~/.pm2/pm2.log ]]; then
cp ~/.pm2/pm2.log logs_artifact/pm2.log
fi

- name: Upload logs
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.job-name }} (logs)
path: logs_artifact
2 changes: 1 addition & 1 deletion cli/commands/danger-deploy-myerc20.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class DangerDeployMyERC20 {

const tokenAddress = normalizeEthKey(txContract.options.address)
console.log(tokenAddress)
web3.currentProvider.connection.close()
web3.currentProvider.disconnect()
}
}

Expand Down
1 change: 1 addition & 0 deletions contracts/near/eth-client/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ else
fi

docker run \
--rm \
--mount type=bind,source=$DIR/..,target=/host \
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined $userflag \
-w /host/eth-client \
Expand Down
1 change: 1 addition & 0 deletions contracts/near/eth-prover/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ else
fi

docker run \
--rm \
--mount type=bind,source=$DIR/..,target=/host \
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined $userflag \
-w /host/eth-prover \
Expand Down
4 changes: 3 additions & 1 deletion testing/ci/e2e_deploy_contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ node index.js init-eth-locker
node index.js init-near-token-factory

# deploy myerc20 token
node index.js DANGER deploy_test_erc20 > /tmp/eth2neartransfer.out
node index.js DANGER deploy_test_erc20 \
--eth-node-url http://localhost:9545 \
> /tmp/eth2neartransfer.out
cat /tmp/eth2neartransfer.out | xargs node index.js deploy-token myerc20

# First start pm2 daemon
Expand Down

0 comments on commit 1a473b7

Please sign in to comment.