2020-09-09 15:49:35 +00:00
|
|
|
name: Docker Build
|
|
|
|
|
|
|
|
on: [pull_request]
|
|
|
|
jobs:
|
2022-04-18 22:31:23 +00:00
|
|
|
build:
|
|
|
|
name: Run docker build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Run docker build
|
|
|
|
run: make docker-build
|
2021-02-19 20:23:45 +00:00
|
|
|
test:
|
2021-04-19 11:24:58 +00:00
|
|
|
name: Run unit tests
|
2021-02-19 20:23:45 +00:00
|
|
|
env:
|
|
|
|
GOPATH: /tmp/go
|
2022-04-18 22:27:38 +00:00
|
|
|
# To run the unit tests you need to add secrets to your repository.
|
2022-04-18 20:42:20 +00:00
|
|
|
BUILD_HOSTNAME: ${{ secrets.BUILD_HOSTNAME }}
|
|
|
|
BUILD_USERNAME: ${{ secrets.BUILD_USERNAME }}
|
|
|
|
BUILD_KEY: ${{ secrets.BUILD_KEY }}
|
2022-04-18 21:39:28 +00:00
|
|
|
#strategy:
|
|
|
|
# matrix:
|
|
|
|
# go-version: [1.16.x, 1.17.x]
|
2022-04-18 20:20:41 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-02-19 20:23:45 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2022-04-18 20:20:41 +00:00
|
|
|
|
|
|
|
# Passed experience with GHA has taught me to store variables in files instead of passing them as variables.
|
2022-04-18 21:21:33 +00:00
|
|
|
- name: Output variables to files
|
2022-04-18 20:20:41 +00:00
|
|
|
run: |
|
2022-04-18 21:04:49 +00:00
|
|
|
echo $GITHUB_REPOSITORY > /tmp/git_repository
|
|
|
|
echo $GITHUB_HEAD_REF > /tmp/git_head_ref
|
2022-04-18 21:52:04 +00:00
|
|
|
echo "-----BEGIN OPENSSH PRIVATE KEY-----" >> /tmp/key
|
2022-04-18 21:51:07 +00:00
|
|
|
echo ${{ env.BUILD_KEY }} >> /tmp/key
|
2022-04-18 21:52:04 +00:00
|
|
|
echo "-----END OPENSSH PRIVATE KEY-----" >> /tmp/key
|
2022-04-18 21:40:23 +00:00
|
|
|
chmod 400 /tmp/key
|
2022-04-18 21:21:33 +00:00
|
|
|
cat /tmp/git_repository
|
|
|
|
cat /tmp/git_head_ref
|
2022-04-18 21:58:05 +00:00
|
|
|
|
2022-04-18 21:21:33 +00:00
|
|
|
- name: Raw SCP
|
|
|
|
run: |
|
2022-04-18 22:41:54 +00:00
|
|
|
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key /tmp/git_repository ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/git_repository
|
|
|
|
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key /tmp/git_head_ref ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/git_head_ref
|
|
|
|
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key .github/workflows/run_unit_test.sh ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/run_unit_test.sh
|
2022-04-18 20:20:41 +00:00
|
|
|
|
|
|
|
- name: Trigger Unit Test
|
2022-04-18 22:02:58 +00:00
|
|
|
run: |
|
2022-04-18 22:41:54 +00:00
|
|
|
ssh -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }} chmod +x /tmp/run_unit_test.sh /tmp/run_unit_test.sh
|
|
|
|
ssh -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }} /tmp/run_unit_test.sh
|
2022-04-18 20:20:41 +00:00
|
|
|
|
|
|
|
- name: Get the logs and cat them
|
|
|
|
run: |
|
2022-04-18 22:41:54 +00:00
|
|
|
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/test.log .
|
2022-04-18 20:20:41 +00:00
|
|
|
cat ./test.log
|
|
|
|
|
|
|
|
- name: Check Error Code
|
2021-02-19 20:23:45 +00:00
|
|
|
run: |
|
2022-04-18 22:41:54 +00:00
|
|
|
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/return_test.txt .
|
2022-04-18 22:36:28 +00:00
|
|
|
[ $(cat ./return_test.txt) -eq 0 ]
|
2021-04-19 11:43:21 +00:00
|
|
|
|
2022-04-18 22:31:23 +00:00
|
|
|
integrationtest:
|
|
|
|
name: Run integration tests
|
|
|
|
env:
|
|
|
|
GOPATH: /tmp/go
|
|
|
|
DB_WRITE: true
|
|
|
|
ETH_FORWARD_ETH_CALLS: false
|
|
|
|
ETH_PROXY_ON_ERROR: false
|
2022-03-21 06:11:34 +00:00
|
|
|
ETH_HTTP_PATH: "dapptools:8545"
|
2022-04-18 22:31:23 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
go-version: [1.16.x]
|
|
|
|
os: [ubuntu-latest]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Create GOPATH
|
|
|
|
run: mkdir -p /tmp/go
|
|
|
|
- name: Install Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Run database
|
|
|
|
run: docker-compose -f docker-compose.test.yml -f docker-compose.yml up -d ipld-eth-db dapptools contract eth-server
|
|
|
|
- name: Test
|
|
|
|
run: |
|
|
|
|
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8081)" != "200" ]; do echo "waiting for ipld-eth-server..." && sleep 5; done && \
|
|
|
|
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8545)" != "200" ]; do echo "waiting for geth-statediff..." && sleep 5; done && \
|
|
|
|
make integrationtest
|
|
|
|
|
|
|
|
integrationtest_forwardethcalls:
|
|
|
|
name: Run integration tests for direct proxy fall-through of eth_calls
|
|
|
|
env:
|
|
|
|
GOPATH: /tmp/go
|
|
|
|
DB_WRITE: false
|
|
|
|
ETH_FORWARD_ETH_CALLS: true
|
|
|
|
ETH_PROXY_ON_ERROR: false
|
|
|
|
ETH_HTTP_PATH: "dapptools:8545"
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
go-version: [1.16.x]
|
|
|
|
os: [ubuntu-latest]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Create GOPATH
|
|
|
|
run: mkdir -p /tmp/go
|
|
|
|
- name: Install Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Run database
|
|
|
|
run: docker-compose -f docker-compose.test.yml -f docker-compose.yml up -d ipld-eth-db dapptools contract eth-server
|
|
|
|
- name: Test
|
|
|
|
run: |
|
|
|
|
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8081)" != "200" ]; do echo "waiting for ipld-eth-server..." && sleep 5; done && \
|
|
|
|
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8545)" != "200" ]; do echo "waiting for geth-statediff..." && sleep 5; done && \
|
|
|
|
make integrationtest
|
2022-03-16 16:15:31 +00:00
|
|
|
|
|
|
|
integrationtest_watchedaddress_gapfillingservice:
|
|
|
|
name: Run integration tests for watched addresses with gap filling service enabled
|
|
|
|
env:
|
|
|
|
GOPATH: /tmp/go
|
|
|
|
DB_WRITE: true
|
|
|
|
ETH_FORWARD_ETH_CALLS: false
|
|
|
|
ETH_PROXY_ON_ERROR: false
|
2022-03-21 06:11:34 +00:00
|
|
|
ETH_HTTP_PATH: "dapptools:8545"
|
2022-03-16 16:15:31 +00:00
|
|
|
WATCHED_ADDRESS_GAP_FILLER_ENABLED: true
|
|
|
|
WATCHED_ADDRESS_GAP_FILLER_INTERVAL: 2
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
go-version: [1.16.x]
|
|
|
|
os: [ubuntu-latest]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Create GOPATH
|
|
|
|
run: mkdir -p /tmp/go
|
|
|
|
- name: Install Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Run database
|
|
|
|
run: docker-compose -f docker-compose.test.yml -f docker-compose.yml up -d ipld-eth-db dapptools contract eth-server
|
|
|
|
- name: Test
|
|
|
|
run: |
|
|
|
|
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8081)" != "200" ]; do echo "waiting for ipld-eth-server..." && sleep 5; done && \
|
|
|
|
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8545)" != "200" ]; do echo "waiting for geth-statediff..." && sleep 5; done && \
|
|
|
|
make integrationtest
|