Skip to content

Commit

Permalink
De-dockerize integration test (#106)
Browse files Browse the repository at this point in the history
* de dockerize integration test

* push trigger on master

* touchups

* bump action versions

* parallel jobs

* revert to single run

* parallel tests

* fix script

* fix makefile

* update script

* remove workflow dispatch trigger

* consistent workflow file

* disable docker integration test

* touchups
  • Loading branch information
rnbguy authored Jun 8, 2023
1 parent 74bc740 commit 3af29ac
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 19 deletions.
108 changes: 108 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Integration tests
on:
pull_request:
push:
branches:
- master

jobs:
cleanup-runs:
runs-on: ubuntu-latest
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"

ibc-integration:
runs-on: ubuntu-latest
env:
COMETBFT_VERSION: 0.37.1
GAIA_VERSION: 6.0.0
HERMES_VERSION: 1.4.0
RUST_VERSION: 1.65
IBC_COMMITISH: master
steps:
- uses: actions/checkout@v3

- name: Download CometBFT
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: cometbft/cometbft
version: "tags/v${{ env.COMETBFT_VERSION }}"
file: "cometbft_${{ env.COMETBFT_VERSION }}_linux_amd64.tar.gz"

- name: Download Gaia
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: cosmos/gaia
version: "tags/v${{ env.GAIA_VERSION }}"
file: "gaiad-v${{ env.GAIA_VERSION }}-linux-amd64"

- name: Download Hermes
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: informalsystems/hermes
version: "tags/v${{ env.HERMES_VERSION }}"
file: "hermes-v${{ env.HERMES_VERSION }}-x86_64-unknown-linux-gnu.tar.gz"

- name: Setup scripts and directories
working-directory: ci/
run: |
echo "${HOME}"
mkdir -p ~/local/bin
cp entrypoint.sh ~/local/bin
mkdir -p ~/.cometbft
cp -r cometbft-config/ ~/.cometbft/config
mkdir -p ~/.hermes
cp hermes-config.toml ~/.hermes/config.toml
cp one-chain ~
cp user_seed.json ~
cp Makefile ..
cp -r tests/ ~
- name: Download and setup binaries
run: |
tar -xzf "cometbft_${COMETBFT_VERSION}_linux_amd64.tar.gz"
mv "gaiad-v${GAIA_VERSION}-linux-amd64" gaiad
tar -xzf "hermes-v${HERMES_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
chmod +x cometbft
chmod +x gaiad
chmod +x hermes
mv cometbft gaiad hermes ~/local/bin
- name: Update environment path
run: |
echo "${HOME}/local/bin" >> $GITHUB_PATH
- name: Validate binaries
run: |
cometbft version
gaiad version
hermes version
- uses: actions/cache@v3
with:
path: |
~/.cargo
target
~/build
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-rust-
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Set environment variables
run: |
echo "BASECOIN_SRC=$(pwd)" >> $GITHUB_ENV
echo "LOG_DIR=$(pwd)/log" >> $GITHUB_ENV
- name: Run integration tests
working-directory: ~
run: |
mkdir -p "${LOG_DIR}"
entrypoint.sh make test -j4
16 changes: 0 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,3 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: test

ibc-integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build Docker image
run: |
docker build \
-f ci/Dockerfile \
-t informaldev/basecoin-rs-ci \
./ci
- name: Run test
run: |
docker run --rm \
-v `pwd`:/src/basecoin-rs \
informaldev/basecoin-rs-ci
18 changes: 18 additions & 0 deletions ci/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.PHONY: test create-channel token-transfer upgrade-client

test: create-channel token-transfer upgrade-client

create-channel:
@echo "Creating channel..."
bash ~/tests/create-channel.sh
@echo "Channel created"

token-transfer: create-channel
@echo "Transferring tokens..."
bash ~/tests/token-transfer.sh
@echo "Tokens transferred"

upgrade-client: create-channel
@echo "Upgrading client..."
bash ~/tests/upgrade-client.sh
@echo "Client upgraded"
6 changes: 3 additions & 3 deletions ci/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ HERMES_CONFIG="${HOME}/.hermes/config.toml"
LOG_DIR=${LOG_DIR:-/var/log/basecoin-rs}
TESTS_DIR=${TESTS_DIR:-${HOME}/tests}

if [ ! -f "${BASECOIN_SRC}/Cargo.toml" ]; then
if [[ ! -f "${BASECOIN_SRC}/Cargo.toml" ]]; then
echo "basecoin-rs sources must be mounted into ${BASECOIN_SRC} for this script to work properly."
exit 1
fi
Expand Down Expand Up @@ -61,8 +61,8 @@ set -e
# Will fail if we still can't reach the CometBFT node
curl "http://127.0.0.1:26357/abci_info" > /dev/null 2>&1

if [ ! -z "$@" ]; then
cd "${HOME}"
if [[ ! -z "$@" ]]; then
# cd "${HOME}"
exec "$@"
else
echo ""
Expand Down

0 comments on commit 3af29ac

Please sign in to comment.